##// END OF EJS Templates
manifest/revlog: do not let the revlog cache mutable objects...
Benoit Boissinot -
r9420:d0db1681 default
parent child Browse files
Show More
@@ -132,9 +132,9 b' class manifest(revlog.revlog):'
132 # if this is changed to support newlines in filenames,
132 # if this is changed to support newlines in filenames,
133 # be sure to check the templates/ dir again (especially *-raw.tmpl)
133 # be sure to check the templates/ dir again (especially *-raw.tmpl)
134 hex, flags = revlog.hex, map.flags
134 hex, flags = revlog.hex, map.flags
135 text = ["%s\000%s%s\n" % (f, hex(map[f]), flags(f))
135 text = ''.join("%s\000%s%s\n" % (f, hex(map[f]), flags(f))
136 for f in files]
136 for f in files)
137 arraytext = array.array('c', "".join(text))
137 arraytext = array.array('c', text)
138 cachedelta = None
138 cachedelta = None
139 else:
139 else:
140 added, removed = changed
140 added, removed = changed
@@ -190,9 +190,9 b' class manifest(revlog.revlog):'
190 if p1 != self.tip():
190 if p1 != self.tip():
191 cachedelta = None
191 cachedelta = None
192 arraytext = addlist
192 arraytext = addlist
193 text = buffer(arraytext)
193
194
194 n = self.addrevision(buffer(arraytext), transaction, link,
195 n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
195 p1, p2, cachedelta)
196 self._mancache = (n, map, arraytext)
196 self._mancache = (n, map, arraytext)
197
197
198 return n
198 return n
@@ -973,7 +973,7 b' class revlog(object):'
973 if node == nullid:
973 if node == nullid:
974 return ""
974 return ""
975 if self._cache and self._cache[0] == node:
975 if self._cache and self._cache[0] == node:
976 return str(self._cache[2])
976 return self._cache[2]
977
977
978 # look up what we need to read
978 # look up what we need to read
979 text = None
979 text = None
@@ -988,7 +988,7 b' class revlog(object):'
988 # do we have useful data cached?
988 # do we have useful data cached?
989 if self._cache and self._cache[1] >= base and self._cache[1] < rev:
989 if self._cache and self._cache[1] >= base and self._cache[1] < rev:
990 base = self._cache[1]
990 base = self._cache[1]
991 text = str(self._cache[2])
991 text = self._cache[2]
992
992
993 self._loadindex(base, rev + 1)
993 self._loadindex(base, rev + 1)
994 self._chunkraw(base, rev)
994 self._chunkraw(base, rev)
@@ -1111,7 +1111,8 b' class revlog(object):'
1111 ifh.write(data[1])
1111 ifh.write(data[1])
1112 self.checkinlinesize(transaction, ifh)
1112 self.checkinlinesize(transaction, ifh)
1113
1113
1114 self._cache = (node, curr, text)
1114 if type(text) == str: # only accept immutable objects
1115 self._cache = (node, curr, text)
1115 return node
1116 return node
1116
1117
1117 def ancestor(self, a, b):
1118 def ancestor(self, a, b):
General Comments 0
You need to be logged in to leave comments. Login now