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

Adrian Buehlmann adrian at cadifra.com
Mon Oct 29 08:06:44 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1351515750 -3600
# Branch stable
# Node ID 36ed69d4593d8d47c9340b5d537660f4c44d35ac
# Parent  603d4fbad36de1744329b06e92490c24703527bb
clone: show status "updating to bookmark @"

if bookmark @ is not on the default branch, we show

  updating to bookmark @ on branch <name>

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -411,6 +411,7 @@
                 if update is not True:
                     checkout = srcpeer.lookup(update)
                 uprev = None
+                status = None
                 if checkout is not None:
                     try:
                         uprev = destrepo.lookup(checkout)
@@ -420,13 +421,21 @@
                     try:
                         uprev = destrepo._bookmarks['@']
                         update = '@'
+                        bn = destrepo[uprev].branch()
+                        if bn == 'default':
+                            status = _("updating to bookmark @\n")
+                        else:
+                            status = _("updating to bookmark @ on branch %s\n"
+                                       % bn)
                     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:
                     bookmarks.setcurrent(destrepo, 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
   $ hg -R cloned-bookmarks bookmarks
    * @                         1:9b140be10808
@@ -355,7 +355,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
   $ cd addmarks
   $ echo foo > foo
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
   $ hg -R cloned-bookmarks bookmarks
    * @                         2:db815d6d32e6
@@ -381,7 +381,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
   $ hg -R cloned-bookmarks-pull bookmarks
    * @                         2:db815d6d32e6
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -507,10 +507,20 @@
   $ 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
   $ hg id -i ../i
   a7949464abda
+  $ rm -r ../i
+
+  $ hg bookmark -f -r stable @
+  $ hg bookmarks
+     @                         15:0aae7cf88f0d
+  $ hg clone . ../i
+  updating to bookmark @ on branch stable
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -i ../i
+  0aae7cf88f0d
   $ cd "$TESTTMP"
 
 


More information about the Mercurial-devel mailing list