Mercurial > hg > mercurial-source
changeset 36433:fc39e2bfcd70
bookmarks: calculate visibility exceptions only once
In the loop "for mark in names", the rev is same in each iteration, so it does
not makes sense to call unhidehashlikerevs multiple times. Thanks to Yuya for
spotting this.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 15 Jan 2018 00:16:11 +0530 |
parents | a177c6aa055a |
children | 588d02d9208a |
files | mercurial/bookmarks.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -830,7 +830,12 @@ cur = repo.changectx('.').node() newact = None changes = [] - hiddenrevs = set() + hiddenrev = None + + # unhide revs if any + if rev: + repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') + for mark in names: mark = checkformat(repo, mark) if newact is None: @@ -840,17 +845,16 @@ return tgt = cur if rev: - repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') ctx = scmutil.revsingle(repo, rev) if ctx.hidden(): - hiddenrevs.add(ctx.hex()[:12]) + hiddenrev = ctx.hex()[:12] tgt = ctx.node() for bm in marks.checkconflict(mark, force, tgt): changes.append((bm, None)) changes.append((mark, tgt)) - if hiddenrevs: - repo.ui.warn(_("bookmarking hidden changeset %s\n") % - ', '.join(hiddenrevs)) + + if hiddenrev: + repo.ui.warn(_("bookmarking hidden changeset %s\n") % hiddenrev) marks.applychanges(repo, tr, changes) if not inactive and cur == marks[newact] and not rev: activate(repo, newact)