[PATCH V3] push: provide a hint when no paths in configured (issue3692)

Mads Kiilerich mads at kiilerich.com
Sat Feb 22 09:39:39 CST 2014


On 02/22/2014 03:14 PM, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps at gmail.com>
> # Date 1393077250 -19800
> #      Sat Feb 22 19:24:10 2014 +0530
> # Node ID b542f30f7b0a71608fa4e43030b35c7226753b87
> # Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
> push: provide a hint when no paths in configured (issue3692)
>
> When user type "hg push" command then this patch helps user by providing hint if no default path is configured.

http://mercurial.selenic.com/wiki/ContributingChanges#Patch_descriptions
"all lines less than 80 characters"

> diff -r 0e2877f8605d -r b542f30f7b0a mercurial/commands.py
> --- a/mercurial/commands.py	Sat Feb 15 22:09:32 2014 -0600
> +++ b/mercurial/commands.py	Sat Feb 22 19:24:10 2014 +0530
> @@ -4614,7 +4614,15 @@
>       dest, branches = hg.parseurl(dest, opts.get('branch'))
>       ui.status(_('pushing to %s\n') % util.hidepassword(dest))
>       revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
> -    other = hg.peer(repo, opts, dest)
> +    if dest == "default-push":
> +        try:
> +            other = hg.peer(repo, opts, dest)
> +        except error.RepoError:
> +            raise util.Abort(_("repository default-push not found!"),

How about http://bz.selenic.com/show_bug.cgi?id=3692#c3 ?

(Actually, I would prefer to say something like "default repository not 
configured" and leave the description of the actual names 'default' and 
'default-push' to the help.)

> +                    hint=_('see the "path" section in "hg help config"'))
> +    else:
> +        other = hg.peer(repo, opts, dest)

This way of doing it gives duplication of the 'other =' line.

How about always catching RepoError, then check if dest is default-push 
and either abort or re-raise.

/Mads



More information about the Mercurial-devel mailing list