equal
deleted
inserted
replaced
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 |