[PATCH 0 of 2] hg pull output message updates for branches

2 views
Skip to first unread message

Kevin Berridge

unread,
Mar 11, 2011, 9:56:34 PM3/11/11
to mercuri...@selenic.com
As discussed on #mercurial IRC...

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

Kevin Berridge

unread,
Mar 11, 2011, 9:56:35 PM3/11/11
to mercuri...@selenic.com
# HG changeset patch
# User Kevin Berridge <kevin.w....@gmail.com>
# Date 1299894192 18000
# Node ID 91ce954ac34a868124f49570e72aca4b012ac43c
# Parent 1bb2a56a9d73b386378564381807fdf8df38ea3f
Hg pull doesn't suggest running hg merge when added heads are on different branches.

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)

Kevin Berridge

unread,
Mar 11, 2011, 9:56:36 PM3/11/11
to mercuri...@selenic.com
# 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"))


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)

Benoit Boissinot

unread,
Mar 12, 2011, 10:43:33 AM3/12/11
to Kevin Berridge, mercuri...@selenic.com
On Sat, Mar 12, 2011 at 3:56 AM, Kevin Berridge
<kevin.w....@gmail.com> wrote:
> # HG changeset patch
> # User Kevin Berridge <kevin.w....@gmail.com>
> # Date 1299894192 18000
> # Node ID 91ce954ac34a868124f49570e72aca4b012ac43c
> # Parent  1bb2a56a9d73b386378564381807fdf8df38ea3f
> Hg pull doesn't suggest running hg merge when added heads are on different branches.

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

Benoit Boissinot

unread,
Mar 12, 2011, 10:45:32 AM3/12/11
to Kevin Berridge, mercuri...@selenic.com
On Sat, Mar 12, 2011 at 3:56 AM, Kevin Berridge
<kevin.w....@gmail.com> wrote:
> # 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.
>

Same command as the first patch, and please fold both patches
together, no need to split them.

cheers,

Benoit

Matt Mackall

unread,
Mar 12, 2011, 1:34:42 PM3/12/11
to Benoit Boissinot, mercuri...@selenic.com
On Sat, 2011-03-12 at 16:45 +0100, Benoit Boissinot wrote:
> On Sat, Mar 12, 2011 at 3:56 AM, Kevin Berridge
> <kevin.w....@gmail.com> wrote:
> > # 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.
> >
>
> Same command as the first patch, and please fold both patches
> together, no need to split them.

..except that I asked him to!

--
Mathematics is the supreme nostalgia of our time.

Benoit Boissinot

unread,
Mar 12, 2011, 1:40:08 PM3/12/11
to Matt Mackall, mercuri...@selenic.com
On Sat, Mar 12, 2011 at 7:34 PM, Matt Mackall <m...@selenic.com> wrote:
> On Sat, 2011-03-12 at 16:45 +0100, Benoit Boissinot wrote:
>> On Sat, Mar 12, 2011 at 3:56 AM, Kevin Berridge
>> <kevin.w....@gmail.com> wrote:
>> > # 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.
>> >
>>
>> Same command as the first patch, and please fold both patches
>> together, no need to split them.
>
> ..except that I asked him to!

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

timeless

unread,
Mar 12, 2011, 3:17:44 PM3/12/11
to Kevin Berridge, mercuri...@selenic.com
On Sat, Mar 12, 2011 at 4:56 AM, Kevin Berridge
<kevin.w....@gmail.com> wrote:
> 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)"

I think it should be 'head(s)' not 'head[s]'

Martin Geisler

unread,
Mar 13, 2011, 5:55:30 AM3/13/11
to Kevin Berridge, mercuri...@selenic.com
Kevin Berridge <kevin.w....@gmail.com> writes:

> # 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/

Reply all
Reply to author
Forward
0 new messages