Patchwork [V2] push: provide a hint when no paths in configured (issue3692)

login
register
mail settings
Submitter Anurag Goel
Date Feb. 15, 2014, 6:32 p.m.
Message ID <76c749d59a82462328f1.1392489166@ubuntu.ubuntu-domain>
Download mbox | patch
Permalink /patch/3675/
State Superseded
Commit c4f45ce85351ae17d637c8f276d6805d4ed580a4
Headers show

Comments

Anurag Goel - Feb. 15, 2014, 6:32 p.m.
# HG changeset patch
# User anuraggoel <anurag.dsps@gmail.com>
# Date 1392488934 -19800
#      Sat Feb 15 23:58:54 2014 +0530
# Node ID 76c749d59a82462328f194708c63259d61fc32f1
# Parent  c3f90f494d184aa611b9e3d4d3c6f28f8354cbe5
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.

Patch

diff -r c3f90f494d18 -r 76c749d59a82 mercurial/commands.py
--- a/mercurial/commands.py	Fri Feb 14 03:06:44 2014 +0530
+++ b/mercurial/commands.py	Sat Feb 15 23:58:54 2014 +0530
@@ -4722,7 +4722,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!"),
+                    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)]