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