Patchwork [8,of,9,paths,v2] commands.push: begin transition to path API

login
register
mail settings
Submitter Gregory Szorc
Date March 1, 2015, 9:50 p.m.
Message ID <86b20c6cbde1cf67e740.1425246647@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/7869/
State Changes Requested
Headers show

Comments

Gregory Szorc - March 1, 2015, 9:50 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1423427820 28800
#      Sun Feb 08 12:37:00 2015 -0800
# Node ID 86b20c6cbde1cf67e7401f7541cbfca233d34362
# Parent  a18ef66b7b91f6ab396683330e849bc8009c7ad8
commands.push: begin transition to path API

This patch begins the process of converting "hg push" to use the new
path API.

Currently, we only handle detecting the case where the path could not
be resolved.

This changes output in the case where the default path is not configured.
We drop a "pushing to default" line. I believe losing this output is
acceptable, as the error message is actionable.
Matt Mackall - March 3, 2015, 11:46 p.m.
On Sun, 2015-03-01 at 13:50 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1423427820 28800
> #      Sun Feb 08 12:37:00 2015 -0800
> # Node ID 86b20c6cbde1cf67e7401f7541cbfca233d34362
> # Parent  a18ef66b7b91f6ab396683330e849bc8009c7ad8
> commands.push: begin transition to path API
> 
> This patch begins the process of converting "hg push" to use the new
> path API.
> 
> Currently, we only handle detecting the case where the path could not
> be resolved.
> 
> This changes output in the case where the default path is not configured.
> We drop a "pushing to default" line. I believe losing this output is
> acceptable, as the error message is actionable.

I feel like we just changed this.. ahh, here it is:

# HG changeset patch
# User Thomas Arendsen Hein <thomas@intevation.de>
# Date 1424771724 -3600
#      Tue Feb 24 10:55:24 2015 +0100
# Node ID eabe44ec5af51b6a892eceea00ea6e4af40c4635
# Parent  dcfdfd63bde469310b74746d376d095a7dec4ea5
pull: print "pulling from foo" before accessing the other repo

1. This is consistent with pushing.
2. This allows to see the URL of the other repo in case accessing the repo
   fails, e.g. wrong ssh path or issues with the https certificate, without
   using --debug or showconfig paths.



You just broke (1) and (2) seems reasonably valid?

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5083,20 +5083,14 @@  def push(ui, repo, dest=None, **opts):
                 # if we try to push a deleted bookmark, translate it to null
                 # this lets simultaneous -r, -b options continue working
                 opts.setdefault('rev', []).append("null")
 
+    path = ui.paths.getpath(dest, default='push', require=True)
     dest = ui.expandpath(dest or 'default-push', dest or 'default')
     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'))
-    try:
-        other = hg.peer(repo, opts, dest)
-    except error.RepoError:
-        if dest == "default-push":
-            raise util.Abort(_("default repository not configured!"),
-                    hint=_('see the "path" section in "hg help config"'))
-        else:
-            raise
+    other = hg.peer(repo, opts, dest)
 
     if revs:
         revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
 
diff --git a/tests/test-default-push.t b/tests/test-default-push.t
--- a/tests/test-default-push.t
+++ b/tests/test-default-push.t
@@ -17,9 +17,8 @@ 
 
 Push should provide a hint when both 'default' and 'default-push' not set:
   $ cd c
   $ hg push --config paths.default=
-  pushing to default-push
   abort: default repository not configured!
   (see the "path" section in "hg help config")
   [255]