Commits

Patrick Mézard committed 590ac02

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.

Comments (0)

Files changed (1)

hgext/obsolete.py

     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
             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: