[PATCH 3 of 7] strip: extract code to create strip backup
Boris Feld
boris.feld at octobus.net
Wed Jan 2 17:35:51 EST 2019
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1546401675 -3600
# Wed Jan 02 05:01:15 2019 +0100
# Node ID 76e9f1990f18a4fe686c3689fa34f827d9318a53
# Parent 80e87a6f0480ef7e1abc954333c54c90095f23ef
# EXP-Topic archived-phase-UX
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 76e9f1990f18
strip: extract code to create strip backup
We will reuse this for soft stripping.
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -168,15 +168,10 @@ def strip(ui, repo, nodelist, backup=Tru
if rev in tostrip:
updatebm.append(m)
- # backup the changeset we are about to strip
backupfile = None
node = nodelist[-1]
if backup:
- backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
- repo.ui.status(_("saved backup bundle to %s\n") %
- vfs.join(backupfile))
- repo.ui.log("backupbundle", "saved backup bundle to %s\n",
- vfs.join(backupfile))
+ backupfile = _createstripbackup(repo, stripbases, node, topic)
# create a changegroup for all the branches we need to keep
tmpbundlefile = None
if saveheads:
@@ -270,6 +265,17 @@ def strip(ui, repo, nodelist, backup=Tru
# extensions can use it
return backupfile
+def _createstripbackup(repo, stripbases, node, topic):
+ # backup the changeset we are about to strip
+ vfs = repo.vfs
+ cl = repo.changelog
+ backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
+ repo.ui.status(_("saved backup bundle to %s\n") %
+ vfs.join(backupfile))
+ repo.ui.log("backupbundle", "saved backup bundle to %s\n",
+ vfs.join(backupfile))
+ return backupfile
+
def safestriproots(ui, repo, nodes):
"""return list of roots of nodes where descendants are covered by nodes"""
torev = repo.unfiltered().changelog.rev
More information about the Mercurial-devel
mailing list