Patchwork [08,of,13] rebase: explicitly track collapses as fold

login
register
mail settings
Submitter Boris Feld
Date Sept. 27, 2018, 5:08 p.m.
Message ID <95659bcaa0dc2eea9fd5.1538068120@localhost.localdomain>
Download mbox | patch
Permalink /patch/35146/
State Accepted
Headers show

Comments

Boris Feld - Sept. 27, 2018, 5:08 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1537994744 -7200
#      Wed Sep 26 22:45:44 2018 +0200
# Node ID 95659bcaa0dc2eea9fd50da4f249b9869e36392f
# Parent  79a0f8fcb5c1af9a8ad5dd292a8ef67d75b6779d
# EXP-Topic trackfold
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 95659bcaa0dc
rebase: explicitly track collapses as fold

A collapse is a large fold. It is now explicitly tracked (at the cleanupnodes
API level).

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1764,6 +1764,8 @@  def clearrebased(ui, repo, destmap, stat
     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 @@  def clearrebased(ui, repo, destmap, stat
                 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