strip: compute bookmark target only if we have bookmark to move
This is a small change that seems to make sense.
--- 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]