fix outgoing filtering.
--- a/states.py Thu Jul 07 11:24:33 2011 +0200
+++ b/states.py Thu Jul 07 13:42:47 2011 +0200
@@ -228,11 +228,13 @@
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:
break
return state
@@ -310,17 +312,17 @@
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