Comments
Patch
@@ -608,7 +608,10 @@
return hexnode
if not node:
return hexnode
- return scmutil.shortesthexnodeidprefix(repo, node, minlength)
+ try:
+ return scmutil.shortesthexnodeidprefix(repo, node, minlength)
+ except error.RepoLookupError:
+ return hexnode
@templatefunc('strip(text[, chars])')
def strip(context, mapping, args):
@@ -448,7 +448,10 @@
# _partialmatch() of filtered changelog could take O(len(repo)) time,
# which would be unacceptably slow. so we look for hash collision in
# unfiltered space, which means some hashes may be slightly longer.
- return repo.unfiltered().changelog.shortest(node, minlength)
+ try:
+ return repo.unfiltered().changelog.shortest(node, minlength)
+ except error.LookupError:
+ raise error.RepoLookupError()
def isrevsymbol(repo, symbol):
"""Checks if a symbol exists in the repo.
@@ -1516,13 +1516,14 @@
def isvalid(prefix):
try:
- if self._partialmatch(prefix) is None:
- return False
+ node = self._partialmatch(prefix)
except error.RevlogError:
return False
except error.WdirUnsupported:
# single 'ff...' match
return True
+ if node is None:
+ raise LookupError(node, self.indexfile, _('no node'))
return not isrev(prefix)
hexnode = hex(node)