changeset 41101:f04e0ca04099

strip: compute bookmark target only if we have bookmark to move This is a small change that seems to make sense.
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Jan 2019 05:07:03 +0100
parents 399010051cf4
children c9a2c4d0e80f
files mercurial/repair.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repair.py	Wed Jan 02 05:01:15 2019 +0100
+++ b/mercurial/repair.py	Wed Jan 02 05:07:03 2019 +0100
@@ -153,20 +153,22 @@
         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]