mercurial/bookmarks.py
changeset 43643 1c91576b88bb
parent 43642 2a8cd7edf409
child 43644 fe2e0d100187
--- 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))