[PATCH STABLE] clone: show status "updating to bookmark @"

Adrian Buehlmann adrian at cadifra.com
Fri Oct 26 15:49:17 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1351274290 -7200
# Branch stable
# Node ID fdbfbcaf9edf51cbc48bbf79145023a86e7c9514
# Parent  52c7e171e35563c8f27bd74bc12b2de45fe99fa6
clone: show status "updating to bookmark @"

When updating to the @ bookmark, the branch name it is on is rather subordinate
and we are updating to that bookmark, not to a branch.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -410,6 +410,7 @@
                 if update is not True:
                     checkout = srcpeer.lookup(update)
                 uprev = None
+                status = None
                 if checkout is not None:
                     try:
                         uprev = destrepo.lookup(checkout)
@@ -419,13 +420,16 @@
                     try:
                         uprev = destrepo._bookmarks['@']
                         update = '@'
+                        status = _("updating to bookmark @\n")
                     except KeyError:
                         try:
                             uprev = destrepo.branchtip('default')
                         except error.RepoLookupError:
                             uprev = destrepo.lookup('tip')
-                bn = destrepo[uprev].branch()
-                destrepo.ui.status(_("updating to branch %s\n") % bn)
+                if not status:
+                    bn = destrepo[uprev].branch()
+                    status = _("updating to branch %s\n") % bn
+                destrepo.ui.status(status)
                 _update(destrepo, uprev)
                 if update in destrepo._bookmarks:
                     destrepo.ui.status(_("active bookmark: %s\n") % update)
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -335,7 +335,7 @@
   adding manifests
   adding file changes
   added 5 changesets with 5 changes to 3 files (+2 heads)
-  updating to branch default
+  updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   active bookmark: @
   $ hg -R cloned-bookmarks bookmarks
@@ -356,7 +356,7 @@
   adding manifests
   adding file changes
   added 5 changesets with 5 changes to 3 files (+2 heads)
-  updating to branch default
+  updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   active bookmark: @
   $ cd addmarks
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -363,7 +363,7 @@
      a@                        2:db815d6d32e6
      x  y                      2:db815d6d32e6
   $ hg clone . cloned-bookmarks
-  updating to branch default
+  updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   active bookmark: @
   $ hg -R cloned-bookmarks bookmarks
@@ -382,7 +382,7 @@
   adding manifests
   adding file changes
   added 3 changesets with 3 changes to 3 files (+1 heads)
-  updating to branch default
+  updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   active bookmark: @
   $ hg -R cloned-bookmarks-pull bookmarks
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -507,7 +507,7 @@
   $ cd a
   $ hg bookmark -r a7949464abda @  # branch point of stable from default
   $ hg clone . ../i
-  updating to branch default
+  updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   active bookmark: @
   $ hg id -i ../i


More information about the Mercurial-devel mailing list