Show More
@@ -283,6 +283,7 b' class revlog(object):' | |||
|
283 | 283 | i = self.index |
|
284 | 284 | for r in xrange(len(i) - 1): |
|
285 | 285 | n[i[r][7]] = r |
|
286 | self.rev = self._revmap | |
|
286 | 287 | return n |
|
287 | 288 | |
|
288 | 289 | def tip(self): |
@@ -292,11 +293,20 b' class revlog(object):' | |||
|
292 | 293 | def __iter__(self): |
|
293 | 294 | for i in xrange(len(self)): |
|
294 | 295 | yield i |
|
295 | def rev(self, node): | |
|
296 | def _revmap(self, node): | |
|
296 | 297 | try: |
|
297 | 298 | return self.nodemap[node] |
|
298 | 299 | except KeyError: |
|
299 | 300 | raise LookupError(node, self.indexfile, _('no node')) |
|
301 | ||
|
302 | def rev(self, node): | |
|
303 | if node == nullid: | |
|
304 | return nullrev | |
|
305 | i = self.index | |
|
306 | for r in xrange(len(i) - 2, -1, -1): | |
|
307 | if i[r][7] == node: | |
|
308 | return r | |
|
309 | raise LookupError(node, self.indexfile, _('no node')) | |
|
300 | 310 | def node(self, rev): |
|
301 | 311 | return self.index[rev][7] |
|
302 | 312 | def linkrev(self, rev): |
@@ -711,8 +721,8 b' class revlog(object):' | |||
|
711 | 721 | try: |
|
712 | 722 | # hex(node)[:...] |
|
713 | 723 | l = len(id) // 2 # grab an even number of digits |
|
714 |
|
|
|
715 |
nl = [ |
|
|
724 | prefix = bin(id[:l * 2]) | |
|
725 | nl = [e[7] for e in self.index if e[7].startswith(prefix)] | |
|
716 | 726 | nl = [n for n in nl if hex(n).startswith(id)] |
|
717 | 727 | if len(nl) > 0: |
|
718 | 728 | if len(nl) == 1: |
General Comments 0
You need to be logged in to leave comments.
Login now