##// END OF EJS Templates
manifest: rearrange add() method and add comments for clarity...
Augie Fackler -
r22788:160efd22 default
parent child Browse files
Show More
@@ -160,20 +160,11 class manifest(revlog.revlog):
160 return revlog.bin(n[:40]), n[40:-1]
160 return revlog.bin(n[:40]), n[40:-1]
161
161
162 def add(self, map, transaction, link, p1, p2, added, removed):
162 def add(self, map, transaction, link, p1, p2, added, removed):
163 # if we're using the cache, make sure it is valid and
163 if p1 in self._mancache:
164 # parented by the same node we're diffing against
164 # If our first parent is in the manifest cache, we can
165 if not (p1 and (p1 in self._mancache)):
165 # compute a delta here using properties we know about the
166 files = sorted(map)
166 # manifest up-front, which may save time later for the
167 _checkforbidden(files)
167 # revlog layer.
168
169 # if this is changed to support newlines in filenames,
170 # be sure to check the templates/ dir again (especially *-raw.tmpl)
171 hex, flags = revlog.hex, map.flags
172 text = ''.join("%s\0%s%s\n" % (f, hex(map[f]), flags(f))
173 for f in files)
174 arraytext = array.array('c', text)
175 cachedelta = None
176 else:
177 addlist = self._mancache[p1][1]
168 addlist = self._mancache[p1][1]
178
169
179 _checkforbidden(added)
170 _checkforbidden(added)
@@ -224,6 +215,21 class manifest(revlog.revlog):
224 cachedelta = (self.rev(p1), deltatext)
215 cachedelta = (self.rev(p1), deltatext)
225 arraytext = addlist
216 arraytext = addlist
226 text = util.buffer(arraytext)
217 text = util.buffer(arraytext)
218 else:
219 # The first parent manifest isn't already loaded, so we'll
220 # just encode a fulltext of the manifest and pass that
221 # through to the revlog layer, and let it handle the delta
222 # process.
223 files = sorted(map)
224 _checkforbidden(files)
225
226 # if this is changed to support newlines in filenames,
227 # be sure to check the templates/ dir again (especially *-raw.tmpl)
228 hex, flags = revlog.hex, map.flags
229 text = ''.join("%s\0%s%s\n" % (f, hex(map[f]), flags(f))
230 for f in files)
231 arraytext = array.array('c', text)
232 cachedelta = None
227
233
228 n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
234 n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
229 self._mancache[n] = (map, arraytext)
235 self._mancache[n] = (map, arraytext)
General Comments 0
You need to be logged in to leave comments. Login now