# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 2020-12-20 14:38:50 # Node ID 72007a9ac064243ace1657ce99c72394d9077c61 # Parent 2607a9346398f2df63732c643a4f3b69ad0e5d96 clone: update to active bookmark, if set This cannot happen during a normal Mercurial clone, but is useful for extensions like hg-git where we know what to check out — the Git HEAD — but do not wish to track it later on using the `@` bookmark. Test Plan: I have not included an explicit test, as this is much more easily tested within the `hg-git` test suite. Differential Revision: https://phab.mercurial-scm.org/D9638 diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1013,15 +1013,19 @@ def clone( pass if uprev is None: try: - uprev = destrepo._bookmarks[b'@'] - update = b'@' + if destrepo._activebookmark: + uprev = destrepo.lookup(destrepo._activebookmark) + update = destrepo._activebookmark + else: + uprev = destrepo._bookmarks[b'@'] + update = b'@' bn = destrepo[uprev].branch() if bn == b'default': - status = _(b"updating to bookmark @\n") + status = _(b"updating to bookmark %s\n" % update) else: status = ( - _(b"updating to bookmark @ on branch %s\n") % bn - ) + _(b"updating to bookmark %s on branch %s\n") + ) % (update, bn) except KeyError: try: uprev = destrepo.branchtip(b'default')