diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5394,11 +5394,13 @@ def push(ui, repo, dest=None, **opts): # this lets simultaneous -r, -b options continue working opts.setdefault('rev', []).append("null") - path = ui.paths.getpath(dest, default='default') + path = ui.paths.getpath(dest, default='default-push') + if not path: + path = ui.paths.getpath(dest, default='default') if not path: raise error.Abort(_('default repository not configured!'), hint=_('see the "path" section in "hg help config"')) - dest, branches = path.pushloc, (path.branch, opts.get('branch') or []) + dest, branches = path.loc, (path.branch, opts.get('branch') or []) 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) 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 @@ -46,6 +46,14 @@ Push should push to 'default-push' when adding file changes added 1 changesets with 1 changes to 1 files +But push should push to 'default' if explicitly specified (issue5000): + + $ hg --cwd b push default + pushing to $TESTTMP/a (glob) + searching for changes + no changes found + [1] + Push should push to 'default-push' when 'default' is not set $ hg -q clone a push-default-only