diff mercurial/scmutil.py @ 41799:64de5f44eec3

rewriting: add an option for rewrite commands to use the archived phase Using the archived phase for cleanup provide the same effect than stripping, but in a faster, append-only way. We keep the feature experimental for now until it gets a bit more testing.
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Jan 2019 03:07:52 +0100
parents e9b9ee9af4a9
children 232d4b9d391a
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Oct 16 15:48:00 2018 +0200
+++ b/mercurial/scmutil.py	Wed Jan 02 03:07:52 2019 +0100
@@ -1016,6 +1016,7 @@
         for phase, nodes in toadvance.items():
             phases.advanceboundary(repo, tr, phase, nodes)
 
+        mayusearchived = repo.ui.config('experimental', 'cleanup-as-archived')
         # Obsolete or strip nodes
         if obsolete.isenabled(repo, obsolete.createmarkersopt):
             # If a node is already obsoleted, and we want to obsolete it
@@ -1033,6 +1034,17 @@
             if rels:
                 obsolete.createmarkers(repo, rels, operation=operation,
                                        metadata=metadata)
+        elif phases.supportinternal(repo) and mayusearchived:
+            # this assume we do not have "unstable" nodes above the cleaned ones
+            allreplaced = set()
+            for ns in replacements.keys():
+                allreplaced.update(ns)
+            if backup:
+                from . import repair # avoid import cycle
+                node = min(allreplaced, key=repo.changelog.rev)
+                repair.backupbundle(repo, allreplaced, allreplaced, node,
+                                    operation)
+            phases.retractboundary(repo, tr, phases.archived, allreplaced)
         else:
             from . import repair # avoid import cycle
             tostrip = list(n for ns in replacements for n in ns)