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 3ccbd4cbba95' | $ hg ci -Aqm 'the previous commit was 3ccbd4cbba95' | ||||
$ 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.startrev=1 2>&1 | grep TypeError | > --config convert.hg.startrev=1 2>&1 | ||||
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' | ||||
0becf8e61603 the working copy is called ffffffffffff | |||||
38a97fe212e7 the previous commit was 3cf70f7c1f3b | 38a97fe212e7 the previous commit was 3cf70f7c1f3b | ||||
3cf70f7c1f3b initial | 3cf70f7c1f3b 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 |