It seems that repo.lookup(), which is what supports the "lookup" wire
protocol command, should not allow the working copy revision
input.
This fixes both the pull test and the convert test I just added.
hg-reviewers |
It seems that repo.lookup(), which is what supports the "lookup" wire
protocol command, should not allow the working copy revision
input.
This fixes both the pull test and the convert test I just added.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/localrepo.py (5 lines) | |||
M | tests/test-convert-hg-source.t (5 lines) | |||
M | tests/test-pull.t (3 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Apr 5 2019, 2:24 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
return self.branchmap().branchtip(branch) | return self.branchmap().branchtip(branch) | ||||
except KeyError: | except KeyError: | ||||
if not ignoremissing: | if not ignoremissing: | ||||
raise error.RepoLookupError(_("unknown branch '%s'") % branch) | raise error.RepoLookupError(_("unknown branch '%s'") % branch) | ||||
else: | else: | ||||
pass | pass | ||||
def lookup(self, key): | def lookup(self, key): | ||||
return scmutil.revsymbol(self, key).node() | node = scmutil.revsymbol(self, key).node() | ||||
if node is None: | |||||
raise error.RepoLookupError(_("unknown revision '%s'") % key) | |||||
return node | |||||
def lookupbranch(self, key): | def lookupbranch(self, key): | ||||
if self.branchmap().hasbranch(key): | if self.branchmap().hasbranch(key): | ||||
return key | return key | ||||
return scmutil.revsymbol(self, key).branch() | return scmutil.revsymbol(self, key).branch() | ||||
def known(self, nodes): | def known(self, nodes): |
$ echo a > a | $ echo a > a | ||||
$ hg ci -Aqm initial | $ hg ci -Aqm initial | ||||
$ echo b > b | $ echo b > b | ||||
$ hg ci -Aqm 'the previous commit was 1451231c8757' | $ hg ci -Aqm 'the previous commit was 1451231c8757' | ||||
$ echo c > c | $ echo c > c | ||||
$ hg ci -Aqm 'the working copy is called ffffffffffff' | $ hg ci -Aqm 'the working copy is called ffffffffffff' | ||||
$ cd .. | $ cd .. | ||||
BROKEN: crashes when the "ffffffffffff" is encountered | |||||
$ hg convert commit-references new-commit-references -q \ | $ hg convert commit-references new-commit-references -q \ | ||||
> --config convert.hg.sourcename=yes 2>&1 | grep TypeError | > --config convert.hg.sourcename=yes | ||||
TypeError: b2a_hex() argument 1 must be string or buffer, not None | |||||
$ cd new-commit-references | $ cd new-commit-references | ||||
$ hg log -T '{node|short} {desc}\n' | $ hg log -T '{node|short} {desc}\n' | ||||
fe295c9e6bc6 the working copy is called ffffffffffff | |||||
642508659503 the previous commit was c2491f685436 | 642508659503 the previous commit was c2491f685436 | ||||
c2491f685436 initial | c2491f685436 initial |
abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'! | abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'! | ||||
[255] | [255] | ||||
$ hg pull -r 'xxxxxxxxxxxxxxxxxx y' | $ hg pull -r 'xxxxxxxxxxxxxxxxxx y' | ||||
pulling from http://foo@localhost:$HGPORT/ | pulling from http://foo@localhost:$HGPORT/ | ||||
abort: unknown revision 'xxxxxxxxxxxxxxxxxx y'! | abort: unknown revision 'xxxxxxxxxxxxxxxxxx y'! | ||||
[255] | [255] | ||||
Test pull of working copy revision | Test pull of working copy revision | ||||
BROKEN: should give a better error message | |||||
$ hg pull -r 'ffffffffffff' | $ hg pull -r 'ffffffffffff' | ||||
pulling from http://foo@localhost:$HGPORT/ | pulling from http://foo@localhost:$HGPORT/ | ||||
abort: b2a_hex() argument 1 must be string or buffer, not None! | abort: unknown revision 'ffffffffffff'! | ||||
[255] | [255] | ||||
Issue622: hg init && hg pull -u URL doesn't checkout default branch | Issue622: hg init && hg pull -u URL doesn't checkout default branch | ||||
$ cd .. | $ cd .. | ||||
$ hg init empty | $ hg init empty | ||||
$ cd empty | $ cd empty | ||||
$ hg pull -u ../test | $ hg pull -u ../test |