mercurial/revlog.py
changeset 39224 5517d62c1bcc
parent 39190 a98e926b2f5b
child 39225 dbc5ead9f40f
equal deleted inserted replaced
39223:68b6383a840a 39224:5517d62c1bcc
    25 
    25 
    26 # import stuff from node for others to import from revlog
    26 # import stuff from node for others to import from revlog
    27 from .node import (
    27 from .node import (
    28     bin,
    28     bin,
    29     hex,
    29     hex,
       
    30     nullhex,
    30     nullid,
    31     nullid,
    31     nullrev,
    32     nullrev,
    32     wdirfilenodeids,
    33     wdirfilenodeids,
    33     wdirhex,
    34     wdirhex,
    34     wdirid,
    35     wdirid,
  1851                 l = len(id) // 2  # grab an even number of digits
  1852                 l = len(id) // 2  # grab an even number of digits
  1852                 prefix = bin(id[:l * 2])
  1853                 prefix = bin(id[:l * 2])
  1853                 nl = [e[7] for e in self.index if e[7].startswith(prefix)]
  1854                 nl = [e[7] for e in self.index if e[7].startswith(prefix)]
  1854                 nl = [n for n in nl if hex(n).startswith(id) and
  1855                 nl = [n for n in nl if hex(n).startswith(id) and
  1855                       self.hasnode(n)]
  1856                       self.hasnode(n)]
       
  1857                 if nullhex.startswith(id):
       
  1858                     nl.append(nullid)
  1856                 if len(nl) > 0:
  1859                 if len(nl) > 0:
  1857                     if len(nl) == 1 and not maybewdir:
  1860                     if len(nl) == 1 and not maybewdir:
  1858                         self._pcache[id] = nl[0]
  1861                         self._pcache[id] = nl[0]
  1859                         return nl[0]
  1862                         return nl[0]
  1860                     raise AmbiguousPrefixLookupError(id, self.indexfile,
  1863                     raise AmbiguousPrefixLookupError(id, self.indexfile,