Patchwork D9638: clone: update to active bookmark, if set

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2020, 6:34 p.m.
Message ID <differential-rev-PHID-DREV-qyrqg7qrsqj26fvuobup-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47948/
State Superseded
Headers show

Comments

phabricator - Dec. 20, 2020, 6:34 p.m.
danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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 `@`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9638

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS




To: danchr, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1013,15 +1013,19 @@ 
                                 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')