##// END OF EJS Templates
revlog.revision(): minor cleanup...
Benoit Boissinot -
r11995:ff84cd2b default
parent child Browse files
Show More
@@ -1056,26 +1056,30 class revlog(object):
1056 1056
1057 1057 def revision(self, node):
1058 1058 """return an uncompressed revision of a given node"""
1059 cache = nullrev
1059 cachedrev = nullrev
1060 1060 if node == nullid:
1061 1061 return ""
1062 1062 if self._cache:
1063 cache = self._cache[1]
1064 1063 if self._cache[0] == node:
1065 1064 return self._cache[2]
1065 cachedrev = self._cache[1]
1066 1066
1067 1067 # look up what we need to read
1068 1068 text = None
1069 1069 rev = self.rev(node)
1070 cache, base, chain = self.deltachain(rev, cache)
1070 base = self.base(rev)
1071 1071
1072 1072 # check rev flags
1073 1073 if self.flags(rev) & ~REVIDX_KNOWN_FLAGS:
1074 1074 raise RevlogError(_('incompatible revision flag %x') %
1075 1075 (self.flags(rev) & ~REVIDX_KNOWN_FLAGS))
1076 1076
1077 # build delta chain
1078 self._loadindex(base, rev + 1)
1079 cachehit, base, chain = self.deltachain(rev, cachedrev)
1080
1077 1081 # do we have useful data cached?
1078 if cache and self._cache:
1082 if cachehit and self._cache:
1079 1083 global _cached
1080 1084 _cached += 1
1081 1085 text = self._cache[2]
@@ -1087,7 +1091,6 class revlog(object):
1087 1091 # drop cache to save memory
1088 1092 self._cache = None
1089 1093
1090 self._loadindex(base, rev + 1)
1091 1094 self._chunkraw(base, rev)
1092 1095 if text is None:
1093 1096 text = self._chunk(base)
General Comments 0
You need to be logged in to leave comments. Login now