equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from i18n import _ |
8 from i18n import _ |
9 import mdiff, parsers, error, revlog |
9 import mdiff, parsers, error, revlog, util |
10 import array, struct |
10 import array, struct |
11 |
11 |
12 class manifestdict(dict): |
12 class manifestdict(dict): |
13 def __init__(self, mapping=None, flags=None): |
13 def __init__(self, mapping=None, flags=None): |
14 if mapping is None: |
14 if mapping is None: |
162 dstart = None |
162 dstart = None |
163 dend = None |
163 dend = None |
164 dline = [""] |
164 dline = [""] |
165 start = 0 |
165 start = 0 |
166 # zero copy representation of addlist as a buffer |
166 # zero copy representation of addlist as a buffer |
167 addbuf = buffer(addlist) |
167 addbuf = util.buffer(addlist) |
168 |
168 |
169 # start with a readonly loop that finds the offset of |
169 # start with a readonly loop that finds the offset of |
170 # each line and creates the deltas |
170 # each line and creates the deltas |
171 for f, todelete in work: |
171 for f, todelete in work: |
172 # bs will either be the index of the item or the insert point |
172 # bs will either be the index of the item or the insert point |
194 if dstart is not None: |
194 if dstart is not None: |
195 delta.append([dstart, dend, "".join(dline)]) |
195 delta.append([dstart, dend, "".join(dline)]) |
196 # apply the delta to the addlist, and get a delta for addrevision |
196 # apply the delta to the addlist, and get a delta for addrevision |
197 cachedelta = (self.rev(p1), addlistdelta(addlist, delta)) |
197 cachedelta = (self.rev(p1), addlistdelta(addlist, delta)) |
198 arraytext = addlist |
198 arraytext = addlist |
199 text = buffer(arraytext) |
199 text = util.buffer(arraytext) |
200 |
200 |
201 n = self.addrevision(text, transaction, link, p1, p2, cachedelta) |
201 n = self.addrevision(text, transaction, link, p1, p2, cachedelta) |
202 self._mancache = (n, map, arraytext) |
202 self._mancache = (n, map, arraytext) |
203 |
203 |
204 return n |
204 return n |