[PATCH 4 of 7] strip: compute bookmark target only if we have bookmark to move
Boris Feld
boris.feld at octobus.net
Wed Jan 2 17:35:52 EST 2019
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1546402023 -3600
# Wed Jan 02 05:07:03 2019 +0100
# Node ID b2a59d144ba0849db8302ce92123b70cb2ba2dc6
# Parent 76e9f1990f18a4fe686c3689fa34f827d9318a53
# EXP-Topic archived-phase-UX
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b2a59d144ba0
strip: compute bookmark target only if we have bookmark to move
This is a small change that seems to make sense.
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -153,20 +153,22 @@ def strip(ui, repo, nodelist, backup=Tru
stripobsidx = [i for i, m in enumerate(repo.obsstore)
if m in obsmarkers]
- # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
- # is much faster
- newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
- if newbmtarget:
- newbmtarget = repo[newbmtarget.first()].node()
- else:
- newbmtarget = '.'
-
+ # compute necessary bookmark movement
bm = repo._bookmarks
updatebm = []
for m in bm:
rev = repo[bm[m]].rev()
if rev in tostrip:
updatebm.append(m)
+ newbmtarget = None
+ if updatebm: # don't compute anything is there is no bookmark to move anyway
+ # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)),
+ # but is much faster
+ newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
+ if newbmtarget:
+ newbmtarget = repo[newbmtarget.first()].node()
+ else:
+ newbmtarget = '.'
backupfile = None
node = nodelist[-1]
More information about the Mercurial-devel
mailing list