equal
deleted
inserted
replaced
1064 def __contains__(self, rev): |
1064 def __contains__(self, rev): |
1065 return 0 <= rev < len(self) |
1065 return 0 <= rev < len(self) |
1066 def __len__(self): |
1066 def __len__(self): |
1067 return len(self.index) - 1 |
1067 return len(self.index) - 1 |
1068 def __iter__(self): |
1068 def __iter__(self): |
1069 return iter(xrange(len(self))) |
1069 return iter(pycompat.xrange(len(self))) |
1070 def revs(self, start=0, stop=None): |
1070 def revs(self, start=0, stop=None): |
1071 """iterate over all rev in this revlog (from start to stop)""" |
1071 """iterate over all rev in this revlog (from start to stop)""" |
1072 step = 1 |
1072 step = 1 |
1073 length = len(self) |
1073 length = len(self) |
1074 if stop is not None: |
1074 if stop is not None: |
1077 stop += step |
1077 stop += step |
1078 if stop > length: |
1078 if stop > length: |
1079 stop = length |
1079 stop = length |
1080 else: |
1080 else: |
1081 stop = length |
1081 stop = length |
1082 return xrange(start, stop, step) |
1082 return pycompat.xrange(start, stop, step) |
1083 |
1083 |
1084 @util.propertycache |
1084 @util.propertycache |
1085 def nodemap(self): |
1085 def nodemap(self): |
1086 self.rev(self.node(0)) |
1086 self.rev(self.node(0)) |
1087 return self._nodecache |
1087 return self._nodecache |
1134 p = self._nodepos |
1134 p = self._nodepos |
1135 if p is None: |
1135 if p is None: |
1136 p = len(i) - 2 |
1136 p = len(i) - 2 |
1137 else: |
1137 else: |
1138 assert p < len(i) |
1138 assert p < len(i) |
1139 for r in xrange(p, -1, -1): |
1139 for r in pycompat.xrange(p, -1, -1): |
1140 v = i[r][7] |
1140 v = i[r][7] |
1141 n[v] = r |
1141 n[v] = r |
1142 if v == node: |
1142 if v == node: |
1143 self._nodepos = r - 1 |
1143 self._nodepos = r - 1 |
1144 return r |
1144 return r |
2787 |
2787 |
2788 # then reset internal state in memory to forget those revisions |
2788 # then reset internal state in memory to forget those revisions |
2789 self._cache = None |
2789 self._cache = None |
2790 self._chaininfocache = {} |
2790 self._chaininfocache = {} |
2791 self._chunkclear() |
2791 self._chunkclear() |
2792 for x in xrange(rev, len(self)): |
2792 for x in pycompat.xrange(rev, len(self)): |
2793 del self.nodemap[self.node(x)] |
2793 del self.nodemap[self.node(x)] |
2794 |
2794 |
2795 del self.index[rev:-1] |
2795 del self.index[rev:-1] |
2796 self._nodepos = None |
2796 self._nodepos = None |
2797 |
2797 |