bookmarks: resolve target revision out of the bookmarks loop
The target revision doesn't depend on the bookmark to be added.
--- a/mercurial/bookmarks.py Sat Nov 09 12:09:50 2019 +0900
+++ b/mercurial/bookmarks.py Sat Nov 09 12:32:20 2019 +0900
@@ -955,9 +955,14 @@
changes = []
hiddenrev = None
+ tgt = cur
# unhide revs if any
if rev:
repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
+ ctx = scmutil.revsingle(repo, rev)
+ if ctx.hidden():
+ hiddenrev = ctx.hex()[:12]
+ tgt = ctx.node()
for mark in names:
mark = checkformat(repo, mark)
@@ -966,12 +971,6 @@
if inactive and mark == repo._activebookmark:
deactivate(repo)
continue
- tgt = cur
- if rev:
- ctx = scmutil.revsingle(repo, rev)
- if ctx.hidden():
- hiddenrev = ctx.hex()[:12]
- tgt = ctx.node()
for bm in marks.checkconflict(mark, force, tgt):
changes.append((bm, None))
changes.append((mark, tgt))