--- a/hgext/states.py Wed Sep 28 12:35:55 2011 +0200
+++ b/hgext/states.py Wed Sep 28 22:04:52 2011 +0200
@@ -1055,9 +1055,16 @@
statesheads.setdefault(state, set([])).add(nd)
for state, heads in repo._statesheads.iteritems():
- if state.trackheads:
- heads = set(heads) - tostrip | statesheads.get(state, set([]))
- repo._statesheads[state] = list(heads)
+ if not state.trackheads:
+ continue
+ heads = set(heads) - tostrip | statesheads.get(state, set([]))
+ # reduce heads (make them really heads)
+ revs = set(map(cl.rev, heads))
+ minrev = min(revs)
+ for rev in cl.ancestors(*revs):
+ if rev >= minrev:
+ revs.discard(rev)
+ repo._statesheads[state] = map(cl.node, revs)
_writestateshead(repo)
return ostrip(ui, repo, node, backup)
--- a/tests/test-state-strip.t Wed Sep 28 12:35:55 2011 +0200
+++ b/tests/test-state-strip.t Wed Sep 28 22:04:52 2011 +0200
@@ -15,7 +15,7 @@
> hg add "$1"
> hg ci -m "$1"
> }
- $ alias hglog='hg glog --template "{rev} {state} {node}\n"'
+ $ alias hglog='hg glog --template "{desc} {state} {node}\n"'
$ hg init alpha
$ cd alpha
@@ -276,13 +276,13 @@
$ hg strip -n 1
$ hglog
- @ 3 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
+ @ 6 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
|
- o 2 ready 0fc8455e844047eab375a1f51816f697551e34cf
+ o 4 ready 0fc8455e844047eab375a1f51816f697551e34cf
|
- o 1 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
+ o 2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
|
o 0 published 06254b90631198c9b9e426be9886af92fedc9a2d
- $ hg log --template '{rev} {state} {node}\n' -r 'readyheads()'
- 2 ready 0fc8455e844047eab375a1f51816f697551e34cf
+ $ hg log --template '{desc} {state} {node}\n' -r 'readyheads()'
+ 4 ready 0fc8455e844047eab375a1f51816f697551e34cf