Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG8ca92bcb3083: tests: byteify a few more things in simplestorerepo.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/simplestorerepo.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
8c3636609959 | 2fb410453749 | Matt Harbison | Nov 21 2019, 3:46 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 |
storageutil, | storageutil, | ||||
) | ) | ||||
from mercurial.revlogutils import flagutil | from mercurial.revlogutils import flagutil | ||||
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | ||||
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | ||||
# be specifying the version(s) of Mercurial they are tested with, or | # be specifying the version(s) of Mercurial they are tested with, or | ||||
# leave the attribute unspecified. | # leave the attribute unspecified. | ||||
testedwith = 'ships-with-hg-core' | testedwith = b'ships-with-hg-core' | ||||
REQUIREMENT = 'testonly-simplestore' | REQUIREMENT = b'testonly-simplestore' | ||||
def validatenode(node): | def validatenode(node): | ||||
if isinstance(node, int): | if isinstance(node, int): | ||||
raise ValueError('expected node; got int') | raise ValueError('expected node; got int') | ||||
if len(node) != 20: | if len(node) != 20: | ||||
raise ValueError('expected 20 byte node') | raise ValueError('expected 20 byte node') | ||||
self._indexbynode[node] | self._indexbynode[node] | ||||
except KeyError: | except KeyError: | ||||
raise error.LookupError(node, self._indexpath, _('no node')) | raise error.LookupError(node, self._indexpath, _('no node')) | ||||
for rev, entry in self._indexbyrev.items(): | for rev, entry in self._indexbyrev.items(): | ||||
if entry[b'node'] == node: | if entry[b'node'] == node: | ||||
return rev | return rev | ||||
raise error.ProgrammingError('this should not occur') | raise error.ProgrammingError(b'this should not occur') | ||||
def node(self, rev): | def node(self, rev): | ||||
validaterev(rev) | validaterev(rev) | ||||
return self._indexbyrev[rev][b'node'] | return self._indexbyrev[rev][b'node'] | ||||
def hasnode(self, node): | def hasnode(self, node): | ||||
validatenode(node) | validatenode(node) |