changeset 17882:36ed69d4593d stable

clone: show status "updating to bookmark @" if bookmark @ is not on the default branch, we show updating to bookmark @ on branch <name>
author Adrian Buehlmann <adrian@cadifra.com>
date Mon, 29 Oct 2012 14:02:30 +0100
parents 603d4fbad36d
children 0188ddfa844e
files mercurial/hg.py tests/test-bookmarks-pushpull.t tests/test-bookmarks.t tests/test-clone.t
diffstat 4 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Sun Oct 28 14:16:16 2012 +0100
+++ b/mercurial/hg.py	Mon Oct 29 14:02:30 2012 +0100
@@ -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)
--- a/tests/test-bookmarks-pushpull.t	Sun Oct 28 14:16:16 2012 +0100
+++ b/tests/test-bookmarks-pushpull.t	Mon Oct 29 14:02:30 2012 +0100
@@ -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
--- a/tests/test-bookmarks.t	Sun Oct 28 14:16:16 2012 +0100
+++ b/tests/test-bookmarks.t	Mon Oct 29 14:02:30 2012 +0100
@@ -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
--- a/tests/test-clone.t	Sun Oct 28 14:16:16 2012 +0100
+++ b/tests/test-clone.t	Mon Oct 29 14:02:30 2012 +0100
@@ -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"