Show More
@@ -329,6 +329,11 b' class revlogoldio(object):' | |||||
329 |
|
329 | |||
330 | return index, nodemap, None |
|
330 | return index, nodemap, None | |
331 |
|
331 | |||
|
332 | def packentry(self, entry, node, version): | |||
|
333 | e2 = (getoffset(entry[0]), entry[1], entry[3], entry[4], | |||
|
334 | node(entry[5]), node(entry[6]), entry[7]) | |||
|
335 | return struct.pack(indexformatv0, *e2) | |||
|
336 | ||||
332 | class revlogio(object): |
|
337 | class revlogio(object): | |
333 | def __init__(self): |
|
338 | def __init__(self): | |
334 | self.size = struct.calcsize(indexformatng) |
|
339 | self.size = struct.calcsize(indexformatng) | |
@@ -378,6 +383,12 b' class revlogio(object):' | |||||
378 |
|
383 | |||
379 | return index, nodemap, cache |
|
384 | return index, nodemap, cache | |
380 |
|
385 | |||
|
386 | def packentry(self, entry, node, version): | |||
|
387 | p = struct.pack(indexformatng, *entry) | |||
|
388 | if not entry[3] and not getoffset(entry[0]) and entry[5] == nullrev: | |||
|
389 | p = struct.pack(versionformat, version) + p[4:] | |||
|
390 | return p | |||
|
391 | ||||
381 | class revlog(object): |
|
392 | class revlog(object): | |
382 | """ |
|
393 | """ | |
383 | the underlying revision storage object |
|
394 | the underlying revision storage object | |
@@ -946,16 +957,8 b' class revlog(object):' | |||||
946 | fp = self.opener(self.indexfile, 'w', atomictemp=True) |
|
957 | fp = self.opener(self.indexfile, 'w', atomictemp=True) | |
947 | self.version &= ~(REVLOGNGINLINEDATA) |
|
958 | self.version &= ~(REVLOGNGINLINEDATA) | |
948 | self._inline = False |
|
959 | self._inline = False | |
949 |
|
|
960 | for i in xrange(self.count()): | |
950 | x = self.index[0] |
|
961 | e = self._io.packentry(self.index[i], self.node, self.version) | |
951 | e = struct.pack(indexformatng, *x)[4:] |
|
|||
952 | l = struct.pack(versionformat, self.version) |
|
|||
953 | fp.write(l) |
|
|||
954 | fp.write(e) |
|
|||
955 |
|
||||
956 | for i in xrange(1, self.count()): |
|
|||
957 | x = self.index[i] |
|
|||
958 | e = struct.pack(indexformatng, *x) |
|
|||
959 | fp.write(e) |
|
962 | fp.write(e) | |
960 |
|
963 | |||
961 | # if we don't call rename, the temp file will never replace the |
|
964 | # if we don't call rename, the temp file will never replace the | |
@@ -1010,14 +1013,7 b' class revlog(object):' | |||||
1010 | self.index.insert(-1, e) |
|
1013 | self.index.insert(-1, e) | |
1011 | self.nodemap[node] = curr |
|
1014 | self.nodemap[node] = curr | |
1012 |
|
1015 | |||
1013 | if self.version == REVLOGV0: |
|
1016 | entry = self._io.packentry(e, self.node, self.version) | |
1014 | e = (offset, l, base, link, p1, p2, node) |
|
|||
1015 | entry = struct.pack(indexformatv0, *e) |
|
|||
1016 | else: |
|
|||
1017 | entry = struct.pack(indexformatng, *e) |
|
|||
1018 | if not curr: |
|
|||
1019 | entry = struct.pack(versionformat, self.version) + entry[4:] |
|
|||
1020 |
|
||||
1021 | if not self._inline: |
|
1017 | if not self._inline: | |
1022 | transaction.add(self.datafile, offset) |
|
1018 | transaction.add(self.datafile, offset) | |
1023 | transaction.add(self.indexfile, curr * len(entry)) |
|
1019 | transaction.add(self.indexfile, curr * len(entry)) | |
@@ -1168,19 +1164,15 b' class revlog(object):' | |||||
1168 | link, self.rev(p1), self.rev(p2), node) |
|
1164 | link, self.rev(p1), self.rev(p2), node) | |
1169 | self.index.insert(-1, e) |
|
1165 | self.index.insert(-1, e) | |
1170 | self.nodemap[node] = r |
|
1166 | self.nodemap[node] = r | |
|
1167 | entry = self._io.packentry(e, self.node, self.version) | |||
1171 | if self._inline: |
|
1168 | if self._inline: | |
1172 |
ifh.write( |
|
1169 | ifh.write(entry) | |
1173 | ifh.write(cdelta) |
|
1170 | ifh.write(cdelta) | |
1174 | self.checkinlinesize(transaction, ifh) |
|
1171 | self.checkinlinesize(transaction, ifh) | |
1175 | if not self._inline: |
|
1172 | if not self._inline: | |
1176 | dfh = self.opener(self.datafile, "a") |
|
1173 | dfh = self.opener(self.datafile, "a") | |
1177 | ifh = self.opener(self.indexfile, "a") |
|
1174 | ifh = self.opener(self.indexfile, "a") | |
1178 | else: |
|
1175 | else: | |
1179 | if self.version == REVLOGV0: |
|
|||
1180 | e = (end, len(cdelta), base, link, p1, p2, node) |
|
|||
1181 | entry = struct.pack(indexformatv0, *e) |
|
|||
1182 | else: |
|
|||
1183 | entry = struct.pack(indexformatng, *e) |
|
|||
1184 | dfh.write(cdelta) |
|
1176 | dfh.write(cdelta) | |
1185 | ifh.write(entry) |
|
1177 | ifh.write(entry) | |
1186 |
|
1178 |
General Comments 0
You need to be logged in to leave comments.
Login now