Show More
@@ -515,17 +515,7 b' class revlog(object):' | |||
|
515 | 515 | return iter(pycompat.xrange(len(self))) |
|
516 | 516 | def revs(self, start=0, stop=None): |
|
517 | 517 | """iterate over all rev in this revlog (from start to stop)""" |
|
518 | step = 1 | |
|
519 | length = len(self) | |
|
520 | if stop is not None: | |
|
521 | if start > stop: | |
|
522 | step = -1 | |
|
523 | stop += step | |
|
524 | if stop > length: | |
|
525 | stop = length | |
|
526 | else: | |
|
527 | stop = length | |
|
528 | return pycompat.xrange(start, stop, step) | |
|
518 | return storageutil.iterrevs(len(self), start=start, stop=stop) | |
|
529 | 519 | |
|
530 | 520 | @util.propertycache |
|
531 | 521 | def nodemap(self): |
@@ -13,6 +13,9 b' import re' | |||
|
13 | 13 | from ..node import ( |
|
14 | 14 | nullid, |
|
15 | 15 | ) |
|
16 | from .. import ( | |
|
17 | pycompat, | |
|
18 | ) | |
|
16 | 19 | |
|
17 | 20 | _nullhash = hashlib.sha1(nullid) |
|
18 | 21 | |
@@ -81,3 +84,18 b' def filtermetadata(text):' | |||
|
81 | 84 | |
|
82 | 85 | offset = text.index(b'\x01\n', 2) |
|
83 | 86 | return text[offset + 2:] |
|
87 | ||
|
88 | def iterrevs(storelen, start=0, stop=None): | |
|
89 | """Iterate over revision numbers in a store.""" | |
|
90 | step = 1 | |
|
91 | ||
|
92 | if stop is not None: | |
|
93 | if start > stop: | |
|
94 | step = -1 | |
|
95 | stop += step | |
|
96 | if stop > storelen: | |
|
97 | stop = storelen | |
|
98 | else: | |
|
99 | stop = storelen | |
|
100 | ||
|
101 | return pycompat.xrange(start, stop, step) |
General Comments 0
You need to be logged in to leave comments.
Login now