[PATCH 2 of 4] bookmarks: resolve target revision out of the bookmarks loop
Yuya Nishihara
yuya at tcha.org
Fri Nov 8 23:51:38 EST 2019
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1573270340 -32400
# Sat Nov 09 12:32:20 2019 +0900
# Node ID 2562eaf1bb72faf1b2383ef651f63be39b875e4f
# Parent a5d3b2b0f3ddcb858e5d6416d571fa0e8870a6dd
bookmarks: resolve target revision out of the bookmarks loop
The target revision doesn't depend on the bookmark to be added.
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -955,9 +955,14 @@ def addbookmarks(repo, tr, names, rev=No
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 @@ def addbookmarks(repo, tr, names, rev=No
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))
More information about the Mercurial-devel
mailing list