Commits

Pierre-Yves David committed 166694e

hide private changeset to inc and pull.

Comments (0)

Files changed (2)

 
 
 def uisetup(ui):
-    def filter_private(orig, repo, *args,**kwargs):
+    def filterprivateout(orig, repo, *args,**kwargs):
         common, heads = orig(repo, *args, **kwargs)
-        return common, repo._reducehead(heads, repo._publicheads)
-    extensions.wrapfunction(discovery, 'findcommonoutgoing', filter_private)
+        return common, repo._reducehead(heads)
+    def filterprivatein(orig, repo, remote, *args, **kwargs):
+        common, anyinc, heads = orig(repo, remote, *args, **kwargs)
+        heads = remote._reducehead(heads)
+        return common, anyinc, heads
+
+    extensions.wrapfunction(discovery, 'findcommonoutgoing', filterprivateout)
+    extensions.wrapfunction(discovery, 'findcommonincoming', filterprivatein)
 
 def reposetup(ui, repo):
 
             if olds != heads:
                 self._writestateshead()
 
-        def _reducehead(self, candidates, max):
+        def _reducehead(self, candidates):
             selected = set()
             for candidate in candidates:
                 rev = self.changelog.rev(candidate)
                 ok = True
-                for h in max:
+                for h in self._publicheads:
                     revh = self.changelog.rev(h)
                     if self.changelog.descendant(revh, rev):
                         ok = False

tests/test-state.t

   adding file changes
   added 2 changesets with 2 changes to 1 files
   $ hg setstate 0 1 # until we fix push
-  $ echo "cornelius" >> babar
-  $ hg ci -m "great old one"
+  $ echo "tree" >> savainna
+  $ hg add savanna
+  savanna: No such file or directory
+  [1]
+  $ hg ci -m "terrain"
+  nothing changed
+  [1]
   $ echo "flore" >> babar
   $ hg ci -m "children"
   $ hg log --template='{rev}:{node|short}: {state}\n'
-  3:3f5e297fd1c6: 0
-  2:dc0a5281e2d9: 0
+  2:46356f7ddfb9: 0
   1:710fe444b3b0: 0
   0:5caa672bac26: 0
 
-  $ cat >> $HGRCPATH <<EOF
+turn private on (repo side)
+  $ cat > .hg/hgrc << EOF
   > [states]
   > private=yes
   > EOF
   $ hg log --template='{rev}:{node|short}: {state}\n'
-  3:3f5e297fd1c6: 2
-  2:dc0a5281e2d9: 2
+  2:46356f7ddfb9: 2
   1:710fe444b3b0: 0
   0:5caa672bac26: 0
+
+test outgoing and push
   $ hg out  ../remote1 --template='{rev}:{node|short}\n'
   comparing with ../remote1
   searching for changes
   adding file changes
   added 2 changesets with 2 changes to 1 files
 
+turn private off again (repo side)
+  $ sed -i 's/^private=.*$/private=no/' .hg/hgrc
+  $ hg log --template='{rev}:{node|short}: {state}\n'
+  2:46356f7ddfb9: 0
+  1:710fe444b3b0: 0
+  0:5caa672bac26: 0
+  $ hg out  ../remote1 --template='{rev}:{node|short}\n'
+  comparing with ../remote1
+  searching for changes
+  2:46356f7ddfb9
 
+turn private on again (repo side)
+  $ sed -i 's/^private=.*$/private=yes/' .hg/hgrc
 
+test incoming and pull
 
+  $ hg init ../other1
+  $ cd ../other1
+  $ hg incoming ../local --template='{rev}:{node|short}\n'
+  comparing with ../local
+  0:5caa672bac26
+  1:710fe444b3b0
+  $ hg pull  ../local
+  pulling from ../local
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ cd ..
+  $ hg clone local other2
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.