rebase: explicitly track collapses as fold
authorBoris Feld <boris.feld@octobus.net>
Wed, 26 Sep 2018 22:45:44 +0200
changeset 39919 0428feb1f0d7
parent 39918 a8318c9cb2ad
child 39920 bae6f1418a95
rebase: explicitly track collapses as fold A collapse is a large fold. It is now explicitly tracked (at the cleanupnodes API level).
hgext/rebase.py
--- a/hgext/rebase.py	Wed Sep 26 23:51:11 2018 +0200
+++ b/hgext/rebase.py	Wed Sep 26 22:45:44 2018 +0200
@@ -1764,6 +1764,8 @@
     replacements = {}
     moves = {}
     stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt)
+
+    collapsednodes = []
     for rev, newrev in sorted(state.items()):
         if newrev >= 0 and newrev != rev:
             oldnode = tonode(rev)
@@ -1774,10 +1776,14 @@
                 if rev in skipped:
                     if stripcleanup or not repo[rev].obsolete():
                         succs = ()
+                elif collapsedas:
+                    collapsednodes.append(oldnode)
                 else:
                     succs = (newnode,)
                 if succs is not None:
                     replacements[(oldnode,)] = succs
+    if collapsednodes:
+        replacements[tuple(collapsednodes)] = (collapsedas,)
     scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup)
     if fm:
         hf = fm.hexfunc