changeset 13804:7dc2bd4c0dc8

pull: new output message when there are multiple branches Pull outputs a slightly new message when there are multiple branches and the current branch has many heads: (run 'hg heads .' to see heads, 'hg merge' to merge) This message adds the "." in hg heads to encourage you to consider only the current branch's heads.
author Kevin Berridge <kevin.w.berridge@gmail.com>
date Mon, 28 Mar 2011 20:56:56 -0400
parents e380964d53f8
children 0bc7b1661177
files mercurial/commands.py tests/test-pull-branch.t
diffstat 2 files changed, 53 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Mar 11 20:43:12 2011 -0500
+++ b/mercurial/commands.py	Mon Mar 28 20:56:56 2011 -0400
@@ -2989,8 +2989,11 @@
         else:
             ui.status(_("not updating, since new heads added\n"))
     if modheads > 1:
-        if (len(repo.branchheads()) > 1):
+        currentbranchheads = len(repo.branchheads())
+        if currentbranchheads == modheads:
             ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
+        elif currentbranchheads > 1:
+            ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to merge)\n"))
         else:
             ui.status(_("(run 'hg heads' to see heads)\n"))
     else:
--- a/tests/test-pull-branch.t	Fri Mar 11 20:43:12 2011 -0500
+++ b/tests/test-pull-branch.t	Mon Mar 28 20:56:56 2011 -0400
@@ -139,7 +139,7 @@
   $ hg branch branchC
   marked working directory as branch branchC
   $ echo b1 > bar 
-  $ hg ci -Am "commit on branchC"
+  $ hg ci -Am "commit on branchC on tt"
   adding bar
 
 Make changes on default branch on t
@@ -148,7 +148,7 @@
   $ hg up -C default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo a1 > bar 
-  $ hg ci -Am "commit on default"
+  $ hg ci -Am "commit on default on t"
   adding bar
 
 Pull branchC from tt
@@ -161,3 +161,50 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads' to see heads)
+
+Make changes on default and branchC on tt
+
+  $ cd ../tt
+  $ hg pull ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads)
+  $ hg up -C default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a1 > bar1
+  $ hg ci -Am "commit on default on tt"
+  adding bar1
+  $ hg up branchC
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo a1 > bar2
+  $ hg ci -Am "commit on branchC on tt"
+  adding bar2
+
+Make changes on default and branchC on t
+
+  $ cd ../t
+  $ hg up default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a1 > bar3
+  $ hg ci -Am "commit on default on t"
+  adding bar3
+  $ hg up branchC
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo a1 > bar4
+  $ hg ci -Am "commit on branchC on tt"
+  adding bar4
+
+Pull from tt
+
+  $ hg pull ../tt
+  pulling from ../tt
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files (+2 heads)
+  (run 'hg heads .' to see heads, 'hg merge' to merge)