Patchwork push: hg should provide hint when no paths configured (issue3692)

login
register
mail settings
Submitter Anurag Goel
Date Feb. 12, 2014, 9:03 a.m.
Message ID <b2bf72fc6b1aca8e697e.1392195830@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/3613/
State Deferred
Headers show

Comments

Anurag Goel - Feb. 12, 2014, 9:03 a.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1392195655 -19800
#      Wed Feb 12 14:30:55 2014 +0530
# Node ID b2bf72fc6b1aca8e697e7d00cb1b2eec37cca8d6
# Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
push: hg should provide hint when no paths configured (issue3692)

I made the changes which mentors told me to do so.
I also run the "test suits" and it passed perfectly.Please guide me ,what should i do next.
Augie Fackler - Feb. 14, 2014, 5:16 p.m.
On Wed, Feb 12, 2014 at 02:33:50PM +0530, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1392195655 -19800
> #      Wed Feb 12 14:30:55 2014 +0530
> # Node ID b2bf72fc6b1aca8e697e7d00cb1b2eec37cca8d6
> # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> push: hg should provide hint when no paths configured (issue3692)
>
> I made the changes which mentors told me to do so.
> I also run the "test suits" and it passed perfectly.Please guide me ,what should i do next.
>
> diff -r d98ba4a87427 -r b2bf72fc6b1a mercurial/commands.py
> --- a/mercurial/commands.py	Mon Feb 10 17:31:26 2014 -0600
> +++ b/mercurial/commands.py	Wed Feb 12 14:30:55 2014 +0530
> @@ -4722,7 +4722,14 @@
>      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!"),
> +                   hint=_("see the \"path\" section in \"hg help config\""))

use single quotes to avoid the \" mess, eg:

_('like "this" to avoid extra escapes')

Other than that, this looks right to me. It'd be good to add a section
to test-push.t that verifies the new behavior works as expected.

> +    else:
> +        other = hg.peer(repo, opts, dest)
>      if revs:
>          revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Feb. 14, 2014, 5:22 p.m.
On 02/12/2014 01:03 AM, Anurag Goel wrote:
> # HG changeset patch
> # User anuraggoel <anurag.dsps@gmail.com>
> # Date 1392195655 -19800
> #      Wed Feb 12 14:30:55 2014 +0530
> # Node ID b2bf72fc6b1aca8e697e7d00cb1b2eec37cca8d6
> # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> push: hg should provide hint when no paths configured (issue3692)

You want to use the active form here

     push: provide a hint when no paths in configured

Then in the long description you shoul tell us more about what the patch 
is doing. Specifically you want to include the new output (and 
optionnaly the output it replace)

> I made the changes which mentors told me to do so.
> I also run the "test suits" and it passed perfectly.Please guide me ,what should i do next.

Those does not belong to the changeset description itself. Also this is 
the second version of your patch, you want to add a V2 flag to the email 
subject (see hg help email for the flag)

Patch

diff -r d98ba4a87427 -r b2bf72fc6b1a mercurial/commands.py
--- a/mercurial/commands.py	Mon Feb 10 17:31:26 2014 -0600
+++ b/mercurial/commands.py	Wed Feb 12 14:30:55 2014 +0530
@@ -4722,7 +4722,14 @@ 
     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!"),
+                   hint=_("see the \"path\" section in \"hg help config\""))
+    else:
+        other = hg.peer(repo, opts, dest)
     if revs:
         revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]