[PATCH 8 of 9 paths v2] commands.push: begin transition to path API
Gregory Szorc
gregory.szorc at gmail.com
Sun Mar 1 15:50:47 CST 2015
# HG changeset patch
# User Gregory Szorc <gregory.szorc at 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.
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]
More information about the Mercurial-devel
mailing list