##// END OF EJS Templates
manifest: move addlistdelta to module-level...
Augie Fackler -
r22409:8f09b785 default
parent child Browse files
Show More
@@ -49,6 +49,28 def checkforbidden(l):
49 49 _("'\\n' and '\\r' disallowed in filenames: %r") % f)
50 50
51 51
52 # apply the changes collected during the bisect loop to our addlist
53 # return a delta suitable for addrevision
54 def addlistdelta(addlist, x):
55 # for large addlist arrays, building a new array is cheaper
56 # than repeatedly modifying the existing one
57 currentposition = 0
58 newaddlist = array.array('c')
59
60 for start, end, content in x:
61 newaddlist += addlist[currentposition:start]
62 if content:
63 newaddlist += array.array('c', content)
64
65 currentposition = end
66
67 newaddlist += addlist[currentposition:]
68
69 deltatext = "".join(struct.pack(">lll", start, end, len(content))
70 + content for start, end, content in x)
71 return deltatext, newaddlist
72
73
52 74 class manifest(revlog.revlog):
53 75 def __init__(self, opener):
54 76 # we expect to deal with not more than four revs at a time,
@@ -140,27 +162,6 class manifest(revlog.revlog):
140 162
141 163 def add(self, map, transaction, link, p1=None, p2=None,
142 164 changed=None):
143 # apply the changes collected during the bisect loop to our addlist
144 # return a delta suitable for addrevision
145 def addlistdelta(addlist, x):
146 # for large addlist arrays, building a new array is cheaper
147 # than repeatedly modifying the existing one
148 currentposition = 0
149 newaddlist = array.array('c')
150
151 for start, end, content in x:
152 newaddlist += addlist[currentposition:start]
153 if content:
154 newaddlist += array.array('c', content)
155
156 currentposition = end
157
158 newaddlist += addlist[currentposition:]
159
160 deltatext = "".join(struct.pack(">lll", start, end, len(content))
161 + content for start, end, content in x)
162 return deltatext, newaddlist
163
164 165 # if we're using the cache, make sure it is valid and
165 166 # parented by the same node we're diffing against
166 167 if not (changed and p1 and (p1 in self._mancache)):
General Comments 0
You need to be logged in to leave comments. Login now