Pierre-Yves David avatar Pierre-Yves David committed a218915

fix outgoing filtering.

Comments (0)

Files changed (1)

         def nodestate(self, node):
             rev = self.changelog.rev(node)
             for state in STATES:
                 # XXX avoid for untracked heads
                 if state.next is not None:
-                    revs = scmutil.revrange(self, ["::%s()" % state.headssymbol])
-                    if rev in revs:
+                    ancestors = map(self.changelog.rev, self.stateheads(state))
+                    ancestors.extend(self.changelog.ancestors(*ancestors))
+                    if rev in ancestors:
             return state
         def _reducehead(self, candidates):
             selected = set()
             st = laststatewithout(_NOSHARE)
-            for candidate in candidates:
-                rev = self.changelog.rev(candidate)
-                ok = True
-                for h in self.stateheads(st):
-                    revh = self.changelog.rev(h)
+            candidates = set(map(self.changelog.rev, candidates))
+            heads = set(map(self.changelog.rev, self.stateheads(st)))
+            shareable = set(self.changelog.ancestors(*heads))
+            shareable.update(heads)
+            selected = candidates & shareable
+            unselected = candidates - shareable
+            for rev in unselected:
+                for revh in heads:
                     if self.changelog.descendant(revh, rev):
-                        ok = False
-                        selected.add(h)
-                if ok:
-                    selected.add(candidate)
-            return sorted(selected)
+                        selected.add(revh)
+            return sorted(map(self.changelog.node, selected))
         ### enable // disable logic
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.