rebase: don't try to prune obsolete changeset already in the destination
authorBoris Feld <boris.feld@octobus.net>
Wed, 26 Sep 2018 22:05:28 +0200
changeset 39915 7198cdbbbde1
parent 39914 b153ca77a52b
child 39916 1857f50a9643
rebase: don't try to prune obsolete changeset already in the destination With similar motivations to the previous changesets, we stop marking changeset from pruning when it is not the command intention. In this case, we still need to distinguish between the strip and the obsolete case.
hgext/rebase.py
--- a/hgext/rebase.py	Wed Sep 26 21:51:29 2018 +0200
+++ b/hgext/rebase.py	Wed Sep 26 22:05:28 2018 +0200
@@ -1763,17 +1763,21 @@
     tonode = repo.changelog.node
     replacements = {}
     moves = {}
+    stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt)
     for rev, newrev in sorted(state.items()):
         if newrev >= 0 and newrev != rev:
             oldnode = tonode(rev)
             newnode = collapsedas or tonode(newrev)
             moves[oldnode] = newnode
             if not keepf:
+                succs = None
                 if rev in skipped:
-                    succs = ()
+                    if stripcleanup or not repo[rev].obsolete():
+                        succs = ()
                 else:
                     succs = (newnode,)
-                replacements[oldnode] = succs
+                if succs is not None:
+                    replacements[oldnode] = succs
     scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup)
     if fm:
         hf = fm.hexfunc