[PATCH 1 of 2] pull: doesn't suggest running hg merge when added heads are on different branches

Greg Ward greg at gerg.ca
Tue Mar 15 08:42:11 CDT 2011


On 14 March 2011, Kevin Berridge said:
> # HG changeset patch
> # User Kevin Berridge <kevin.w.berridge at gmail.com>
> # Date 1299894192 18000
> # Node ID 74e518e0dc1418c01584cd7efb9bda53e97fb7e2
> # Parent  1bb2a56a9d73b386378564381807fdf8df38ea3f
> 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.

Nice.  This occasionally annoys me, too.  

Nits on your commit message:

  * should say "pull: don't suggrest running ..."
  * lines should be <75 chars long (at least I think that's the
    convention: see the wiki pages starting at DeveloperInfo)

> diff -r 1bb2a56a9d73 -r 74e518e0dc14 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"))

<bikeshedding>
Hmmm: I wonder if it would make sense to recommend "hg heads ." when
there are multiple heads on the current branch, e.g.

  ui.status(_("(run 'hg heads .' to see branch heads, 'hg merge' to merge)\n"))
</bikeshedding>

        Greg
-- 
Greg Ward                                http://www.gerg.ca/
Save energy: be apathetic.


More information about the Mercurial-devel mailing list