Show More
@@ -329,6 +329,11 b' class revlogoldio(object):' | |||
|
329 | 329 | |
|
330 | 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 | 337 | class revlogio(object): |
|
333 | 338 | def __init__(self): |
|
334 | 339 | self.size = struct.calcsize(indexformatng) |
@@ -378,6 +383,12 b' class revlogio(object):' | |||
|
378 | 383 | |
|
379 | 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 | 392 | class revlog(object): |
|
382 | 393 | """ |
|
383 | 394 | the underlying revision storage object |
@@ -946,16 +957,8 b' class revlog(object):' | |||
|
946 | 957 | fp = self.opener(self.indexfile, 'w', atomictemp=True) |
|
947 | 958 | self.version &= ~(REVLOGNGINLINEDATA) |
|
948 | 959 | self._inline = False |
|
949 |
|
|
|
950 | x = self.index[0] | |
|
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) | |
|
960 | for i in xrange(self.count()): | |
|
961 | e = self._io.packentry(self.index[i], self.node, self.version) | |
|
959 | 962 | fp.write(e) |
|
960 | 963 | |
|
961 | 964 | # if we don't call rename, the temp file will never replace the |
@@ -1010,14 +1013,7 b' class revlog(object):' | |||
|
1010 | 1013 | self.index.insert(-1, e) |
|
1011 | 1014 | self.nodemap[node] = curr |
|
1012 | 1015 | |
|
1013 | if self.version == REVLOGV0: | |
|
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 | ||
|
1016 | entry = self._io.packentry(e, self.node, self.version) | |
|
1021 | 1017 | if not self._inline: |
|
1022 | 1018 | transaction.add(self.datafile, offset) |
|
1023 | 1019 | transaction.add(self.indexfile, curr * len(entry)) |
@@ -1168,19 +1164,15 b' class revlog(object):' | |||
|
1168 | 1164 | link, self.rev(p1), self.rev(p2), node) |
|
1169 | 1165 | self.index.insert(-1, e) |
|
1170 | 1166 | self.nodemap[node] = r |
|
1167 | entry = self._io.packentry(e, self.node, self.version) | |
|
1171 | 1168 | if self._inline: |
|
1172 |
ifh.write( |
|
|
1169 | ifh.write(entry) | |
|
1173 | 1170 | ifh.write(cdelta) |
|
1174 | 1171 | self.checkinlinesize(transaction, ifh) |
|
1175 | 1172 | if not self._inline: |
|
1176 | 1173 | dfh = self.opener(self.datafile, "a") |
|
1177 | 1174 | ifh = self.opener(self.indexfile, "a") |
|
1178 | 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 | 1176 | dfh.write(cdelta) |
|
1185 | 1177 | ifh.write(entry) |
|
1186 | 1178 |
General Comments 0
You need to be logged in to leave comments.
Login now