##// END OF EJS Templates
revlog: optimize deltachain
Matt Mackall -
r11935:927ada25 default
parent child Browse files
Show More
@@ -23,6 +23,8 b' import struct, zlib, errno'
23 _decompress = zlib.decompress
23 _decompress = zlib.decompress
24 _sha = util.sha1
24 _sha = util.sha1
25
25
26 _cached, _uncached = 0, 0
27
26 # revlog header flags
28 # revlog header flags
27 REVLOGV0 = 0
29 REVLOGV0 = 0
28 REVLOGNG = 1
30 REVLOGNG = 1
@@ -1030,9 +1032,15 b' class revlog(object):'
1030 """return chain of revisions to construct a given revision"""
1032 """return chain of revisions to construct a given revision"""
1031 chain = []
1033 chain = []
1032 check = False
1034 check = False
1033 while self.base(rev) != rev and rev != cache:
1035 index = self.index
1036 e = index[rev]
1037 while rev != e[3] and rev != cache:
1034 chain.append(rev)
1038 chain.append(rev)
1035 rev = self.deltaparent(rev)
1039 if e[0] & REVIDX_PARENTDELTA:
1040 rev = e[5]
1041 else:
1042 rev -= 1
1043 e = index[rev]
1036 chain.reverse()
1044 chain.reverse()
1037 if rev == cache:
1045 if rev == cache:
1038 check = True
1046 check = True
@@ -1068,7 +1076,13 b' class revlog(object):'
1068
1076
1069 # do we have useful data cached?
1077 # do we have useful data cached?
1070 if cache and self._cache:
1078 if cache and self._cache:
1079 global _cached
1080 _cached += 1
1071 text = self._cache[2]
1081 text = self._cache[2]
1082 else:
1083 global _uncached
1084 _uncached += 1
1085
1072
1086
1073 # drop cache to save memory
1087 # drop cache to save memory
1074 self._cache = None
1088 self._cache = None
General Comments 0
You need to be logged in to leave comments. Login now