hgext/git/gitlog.py
changeset 52632 d7368933f4b0
parent 52629 7d2fc79a3e5a
child 52633 86920d1f7632
equal deleted inserted replaced
52631:482728ca94c1 52632:d7368933f4b0
   301         nodehex = hex(node)
   301         nodehex = hex(node)
   302         for attempt in range(minlength, len(nodehex) + 1):
   302         for attempt in range(minlength, len(nodehex) + 1):
   303             candidate = nodehex[:attempt]
   303             candidate = nodehex[:attempt]
   304             matches = int(
   304             matches = int(
   305                 self._db.execute(
   305                 self._db.execute(
   306                     'SELECT COUNT(*) FROM changelog WHERE node LIKE ?',
   306                     'SELECT COUNT(*) FROM changelog WHERE node GLOB ?',
   307                     (pycompat.sysstr(candidate + b'%'),),
   307                     (pycompat.sysstr(candidate + b'*'),),
   308                 ).fetchone()[0]
   308                 ).fetchone()[0]
   309             )
   309             )
   310             if matches == 1:
   310             if matches == 1:
   311                 return candidate
   311                 return candidate
   312         return nodehex
   312         return nodehex