# HG changeset patch # User Martin von Zweigbergk # Date 2018-04-17 06:29:09 # Node ID 44d1959acb3b580687723a67fdfc96ab273e040c # Parent 925707ac2855944b0607bec68986a273fb5321ae revlog: make shortest() take a full binary nodeid (API) Follow-up to 7b2955624777 (scmutil: make shortesthexnodeidprefix() take a full binary nodeid, 2018-04-14). Differential Revision: https://phab.mercurial-scm.org/D3403 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1500,8 +1500,8 @@ class revlog(object): raise LookupError(id, self.indexfile, _('no match found')) - def shortest(self, hexnode, minlength=1): - """Find the shortest unambiguous prefix that matches hexnode.""" + def shortest(self, node, minlength=1): + """Find the shortest unambiguous prefix that matches node.""" def isvalid(test): try: if self._partialmatch(test) is None: @@ -1523,6 +1523,7 @@ class revlog(object): # single 'ff...' match return True + hexnode = hex(node) shortest = hexnode startlength = max(6, minlength) length = startlength diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -448,7 +448,7 @@ def shortesthexnodeidprefix(repo, node, # _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(hex(node), minlength) + return repo.unfiltered().changelog.shortest(node, minlength) def isrevsymbol(repo, symbol): """Checks if a symbol exists in the repo.