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

Anurag Goel anurag.dsps at gmail.com
Sat Feb 22 17:02:57 CST 2014


Apologize for the mistake of "more than 80 characters" in one line.

About the duplication of the 'other =' line, i don't think always catching
RepoError would be a good idea.
There are different RepoError with different abort messages.So if we always
catch RepoError then we have to handle each error message explicitly.
For eg. abort message by "RepoError"  in file "mercurial/sshpeer.py" and
"mercurial/localrepo.py" is different.



On Sat, Feb 22, 2014 at 9:09 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140223/0f16e437/attachment.html>


More information about the Mercurial-devel mailing list