rebase: improve invalid revisions filtering
- Filter rebasestate nullmerge and unrebased revision before considering
updating obsolete. This simplifies the handling of obsolete and make
it ignore unrebased revision rather than extinguishing them.
- Apply obsolete markers only if rebasestate is not empty, testing
rebasetarget was irrelevant.
--- a/hgext/obsolete.py Thu Jun 21 18:00:32 2012 +0200
+++ b/hgext/obsolete.py Thu Jun 21 19:24:19 2012 +0200
@@ -263,7 +263,10 @@
maxrev = len(repo) - 1
try:
res = orig(ui, repo, *args, **kwargs)
- if not res and not kwargs.get('abort') and repo._rebasetarget:
+ # Filter nullmerge or unrebased entries
+ repo._rebasestate = dict(p for p in repo._rebasestate.iteritems()
+ if p[1] >= 0)
+ if not res and not kwargs.get('abort') and repo._rebasestate:
# We have to tell rewritten revisions from removed
# ones. When collapsing, removed revisions are considered
# to be collapsed onto the final one, while in the normal
@@ -278,10 +281,8 @@
targetrev = repo[repo._rebasetarget].rev()
newrevs = set([targetrev])
for rev, newrev in sorted(repo._rebasestate.items()):
- if newrev == -2: # nullmerge
- continue
oldnode = repo[rev].node()
- if newrev not in newrevs and newrev >= 0:
+ if newrev not in newrevs:
newnode = repo[newrev].node()
newrevs.add(newrev)
else: