When you pull in new heads which are NOT on the current branch but are on other branches the messages are somewhat confusing. First patch removes suggestion to merge. Second patch adds new message with hg update instructions.
_______________________________________________
Mercurial-devel mailing list
Mercuri...@selenic.com
http://selenic.com/mailman/listinfo/mercurial-devel
After a pull when a new head is added but no head is added on the current branch, the "run 'hg merge'" message can be misleading. This patch doesn't output the merge message in that scenario.
diff -r 1bb2a56a9d73 -r 91ce954ac34a mercurial/commands.py
--- a/mercurial/commands.py Thu Mar 10 13:43:47 2011 +0100
+++ b/mercurial/commands.py Fri Mar 11 20:43:12 2011 -0500
@@ -2891,7 +2891,10 @@
else:
ui.status(_("not updating, since new heads added\n"))
if modheads > 1:
- ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
+ if (len(repo.branchheads()) > 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:
ui.status(_("(run 'hg update' to get a working copy)\n"))
diff -r 1bb2a56a9d73 -r 91ce954ac34a tests/test-pull-branch2.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-branch2.t Fri Mar 11 20:43:12 2011 -0500
@@ -0,0 +1,30 @@
+ $ hg init t
+ $ cd t
+ $ echo 1 > foo
+ $ hg ci -Am1
+ adding foo
+
+ $ cd ..
+ $ hg clone ./t ./tt
+ updating to branch default
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ cd ./tt
+ $ hg branch A
+ marked working directory as branch A
+ $ echo 2 > foo
+ $ hg ci -Am2
+
+ $ cd ../t
+ $ echo a2 > foo
+ $ hg ci -ma3
+
+Pull branch A:
+
+ $ hg pull ../tt
+ pulling from ../tt
+ 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)
This patch changes the output message from hg pull when new heads are added on other branches but not on the current branch to "(new branch head[s] added, run 'hg update [new branch]' to get a working copy)"
diff -r 91ce954ac34a -r 90b19cade984 mercurial/commands.py
--- a/mercurial/commands.py Fri Mar 11 20:43:12 2011 -0500
+++ b/mercurial/commands.py Fri Mar 11 20:55:13 2011 -0500
@@ -2894,7 +2894,8 @@
if (len(repo.branchheads()) > 1):
ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
else:
- ui.status(_("(run 'hg heads' to see heads)\n"))
+ ui.status(_("(new branch head[s] added, run 'hg update" +
+ " [new branch]' to get a working copy)\n"))
else:
ui.status(_("(run 'hg update' to get a working copy)\n"))
diff -r 91ce954ac34a -r 90b19cade984 tests/test-pull-branch2.t
--- a/tests/test-pull-branch2.t Fri Mar 11 20:43:12 2011 -0500
+++ b/tests/test-pull-branch2.t Fri Mar 11 20:55:13 2011 -0500
@@ -27,4 +27,4 @@
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
- (run 'hg heads' to see heads)
+ (new branch head[s] added, run 'hg update [new branch]' to get a working copy)
Hi Kevin,
Couple of remarks:
- we usually format the commit message in a different way:
http://mercurial.selenic.com/wiki/ContributingChanges#Patch_descriptions
- can you try not adding a new test file and possibly reuse a test?
Otherwise looks good.
Benoit
Same command as the first patch, and please fold both patches
together, no need to split them.
cheers,
Benoit
..except that I asked him to!
--
Mathematics is the supreme nostalgia of our time.
Hum, sorry. What was the reason? Is the second change more controversial?
I thought that since the first change introduced the message, we might
as well change it in the first patch.
Benoit
I think it should be 'head(s)' not 'head[s]'
> # HG changeset patch
> # User Kevin Berridge <kevin.w....@gmail.com>
> # Date 1299894913 18000
> # Node ID 90b19cade98425061f755120ffef2849e122e952
> # Parent 91ce954ac34a868124f49570e72aca4b012ac43c
> New output message from hg pull suggests better update action when a new branch head is added.
>
> This patch changes the output message from hg pull when new heads are added on other branches but not on the current branch to "(new branch head[s] added, run 'hg update [new branch]' to get a working copy)"
>
> diff -r 91ce954ac34a -r 90b19cade984 mercurial/commands.py
> --- a/mercurial/commands.py Fri Mar 11 20:43:12 2011 -0500
> +++ b/mercurial/commands.py Fri Mar 11 20:55:13 2011 -0500
> @@ -2894,7 +2894,8 @@
> if (len(repo.branchheads()) > 1):
> ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
> else:
> - ui.status(_("(run 'hg heads' to see heads)\n"))
> + ui.status(_("(new branch head[s] added, run 'hg update" +
> + " [new branch]' to get a working copy)\n"))
We don't do "head[s]" or "head(s)" in Mercurial, we always use the
plural version.
--
Martin Geisler
aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/