hgext/git/gitlog.py
changeset 44478 6d953b3fc2bd
parent 44477 ad718271a9eb
child 44480 f19491aae641
equal deleted inserted replaced
44477:ad718271a9eb 44478:6d953b3fc2bd
   168         for attempt in pycompat.xrange(minlength, len(nodehex) + 1):
   168         for attempt in pycompat.xrange(minlength, len(nodehex) + 1):
   169             candidate = nodehex[:attempt]
   169             candidate = nodehex[:attempt]
   170             matches = int(
   170             matches = int(
   171                 self._db.execute(
   171                 self._db.execute(
   172                     'SELECT COUNT(*) FROM changelog WHERE node LIKE ?',
   172                     'SELECT COUNT(*) FROM changelog WHERE node LIKE ?',
   173                     (pycompat.sysstr(nodehex + b'%'),),
   173                     (pycompat.sysstr(candidate + b'%'),),
   174                 ).fetchone()[0]
   174                 ).fetchone()[0]
   175             )
   175             )
   176             if matches == 1:
   176             if matches == 1:
   177                 return candidate
   177                 return candidate
   178         return nodehex
   178         return nodehex