From patchwork Wed Jan 2 22:35:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 7] strip: compute bookmark target only if we have bookmark to move From: Boris Feld X-Patchwork-Id: 37427 Message-Id: To: mercurial-devel@mercurial-scm.org Cc: gregory.szorc@gmail.com Date: Wed, 02 Jan 2019 23:35:52 +0100 # HG changeset patch # User Boris Feld # 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]