comparison mercurial/commands.py @ 26057:10917b062adf

commands.push: use paths API ui.path instances now collect most of the data used by commands.push(). Move away from ui.expandpath() and call ui.paths.getpath() to get a path instance. Some "pushing to" output was dropped as one test demonstrates. I believe the dropped message was redundant with the error message and the change to be acceptable.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 07 Aug 2015 22:39:47 -0700
parents 5243890224ff
children dceaef70e410
comparison
equal deleted inserted replaced
26056:5f2a4fc3c4fa 26057:10917b062adf
5272 else: 5272 else:
5273 # if we try to push a deleted bookmark, translate it to null 5273 # if we try to push a deleted bookmark, translate it to null
5274 # this lets simultaneous -r, -b options continue working 5274 # this lets simultaneous -r, -b options continue working
5275 opts.setdefault('rev', []).append("null") 5275 opts.setdefault('rev', []).append("null")
5276 5276
5277 dest = ui.expandpath(dest or 'default-push', dest or 'default') 5277 path = ui.paths.getpath(dest or 'default-push', default='default')
5278 dest, branches = hg.parseurl(dest, opts.get('branch')) 5278 if not path:
5279 raise util.Abort(_('default repository not configured!'),
5280 hint=_('see the "path" section in "hg help config"'))
5281 dest, branches = path.loc, (path.branch, opts.get('branch') or [])
5279 ui.status(_('pushing to %s\n') % util.hidepassword(dest)) 5282 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
5280 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) 5283 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
5281 try: 5284 other = hg.peer(repo, opts, dest)
5282 other = hg.peer(repo, opts, dest)
5283 except error.RepoError:
5284 if dest == "default-push":
5285 raise util.Abort(_("default repository not configured!"),
5286 hint=_('see the "path" section in "hg help config"'))
5287 else:
5288 raise
5289 5285
5290 if revs: 5286 if revs:
5291 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] 5287 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
5292 if not revs: 5288 if not revs:
5293 raise util.Abort(_("specified revisions evaluate to an empty set"), 5289 raise util.Abort(_("specified revisions evaluate to an empty set"),