changeset 297:590ac023c536

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.
author Patrick Mezard <patrick@mezard.eu>
date Thu, 21 Jun 2012 19:24:19 +0200
parents c3ff47e6bd36
children f597421662f7
files hgext/obsolete.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: