Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 37307:4d69668a65d8
push: avoid using repo.lookup() for converting to nodeid
repo.lookup(x) currently simply does repo[x].node(), which supports
various types of inputs. As I explained in 0194dac77c93 (scmutil: add
method for looking up a context given a revision symbol, 2018-04-02),
I'd like to split that up so we use the new scmutil.revsymbol() for
string inputs repo[x] for integer revnums and binary nodeids. Since
repo.lookup() seems to exist in order to serve peer.lookup(), I think
it should be calling revsymbol. However, we have several callers that
use repo.lookup() with something that's not a string, so we need to
remove those first. This patch starts doing that. Many more will
follow.
Differential Revision: https://phab.mercurial-scm.org/D3047
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 03 Apr 2018 14:39:21 -0700 |
parents | 6942c73f0733 |
children | 0b4692b9646d |
comparison
equal
deleted
inserted
replaced
37306:6942c73f0733 | 37307:4d69668a65d8 |
---|---|
4146 ui.status(_('pushing to %s\n') % util.hidepassword(dest)) | 4146 ui.status(_('pushing to %s\n') % util.hidepassword(dest)) |
4147 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) | 4147 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
4148 other = hg.peer(repo, opts, dest) | 4148 other = hg.peer(repo, opts, dest) |
4149 | 4149 |
4150 if revs: | 4150 if revs: |
4151 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] | 4151 revs = [repo[r].node() for r in scmutil.revrange(repo, revs)] |
4152 if not revs: | 4152 if not revs: |
4153 raise error.Abort(_("specified revisions evaluate to an empty set"), | 4153 raise error.Abort(_("specified revisions evaluate to an empty set"), |
4154 hint=_("use different revision arguments")) | 4154 hint=_("use different revision arguments")) |
4155 elif path.pushrev: | 4155 elif path.pushrev: |
4156 # It doesn't make any sense to specify ancestor revisions. So limit | 4156 # It doesn't make any sense to specify ancestor revisions. So limit |