1204 base, link, p1r, p2r, node) |
1204 base, link, p1r, p2r, node) |
1205 self.index.insert(-1, e) |
1205 self.index.insert(-1, e) |
1206 self.nodemap[node] = curr |
1206 self.nodemap[node] = curr |
1207 |
1207 |
1208 entry = self._io.packentry(e, self.node, self.version, curr) |
1208 entry = self._io.packentry(e, self.node, self.version, curr) |
|
1209 self._writeentry(transaction, ifh, dfh, entry, data, link, offset) |
|
1210 |
|
1211 if type(text) == str: # only accept immutable objects |
|
1212 self._cache = (node, curr, text) |
|
1213 self._basecache = (curr, chainbase) |
|
1214 return node |
|
1215 |
|
1216 def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset): |
|
1217 curr = len(self) - 1 |
1209 if not self._inline: |
1218 if not self._inline: |
1210 transaction.add(self.datafile, offset) |
1219 transaction.add(self.datafile, offset) |
1211 transaction.add(self.indexfile, curr * len(entry)) |
1220 transaction.add(self.indexfile, curr * len(entry)) |
1212 if data[0]: |
1221 if data[0]: |
1213 dfh.write(data[0]) |
1222 dfh.write(data[0]) |
1219 transaction.add(self.indexfile, offset, curr) |
1228 transaction.add(self.indexfile, offset, curr) |
1220 ifh.write(entry) |
1229 ifh.write(entry) |
1221 ifh.write(data[0]) |
1230 ifh.write(data[0]) |
1222 ifh.write(data[1]) |
1231 ifh.write(data[1]) |
1223 self.checkinlinesize(transaction, ifh) |
1232 self.checkinlinesize(transaction, ifh) |
1224 |
|
1225 if type(text) == str: # only accept immutable objects |
|
1226 self._cache = (node, curr, text) |
|
1227 self._basecache = (curr, chainbase) |
|
1228 return node |
|
1229 |
1233 |
1230 def addgroup(self, bundle, linkmapper, transaction): |
1234 def addgroup(self, bundle, linkmapper, transaction): |
1231 """ |
1235 """ |
1232 add a delta group |
1236 add a delta group |
1233 |
1237 |