states.py
changeset 2 166694e62daf
parent 1 beabde937e36
child 5 9445ce78a935
--- a/states.py	Fri May 20 19:14:19 2011 +0200
+++ b/states.py	Fri May 20 19:51:09 2011 +0200
@@ -95,10 +95,16 @@
 
 
 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):
 
@@ -164,12 +170,12 @@
             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