Show More
@@ -955,6 +955,14 b' class revlog(object):' | |||
|
955 | 955 | p1, p2 - the parent nodeids of the revision |
|
956 | 956 | d - an optional precomputed delta |
|
957 | 957 | """ |
|
958 | if not self.inlinedata(): | |
|
959 | dfh = self.opener(self.datafile, "a") | |
|
960 | else: | |
|
961 | dfh = None | |
|
962 | ifh = self.opener(self.indexfile, "a+") | |
|
963 | return self._addrevision(text, transaction, link, p1, p2, d, ifh, dfh) | |
|
964 | ||
|
965 | def _addrevision(self, text, transaction, link, p1, p2, d, ifh, dfh): | |
|
958 | 966 | if text is None: text = "" |
|
959 | 967 | if p1 is None: p1 = self.tip() |
|
960 | 968 | if p2 is None: p2 = nullid |
@@ -1004,28 +1012,25 b' class revlog(object):' | |||
|
1004 | 1012 | if not self.inlinedata(): |
|
1005 | 1013 | transaction.add(self.datafile, offset) |
|
1006 | 1014 | transaction.add(self.indexfile, n * len(entry)) |
|
1007 | f = self.opener(self.datafile, "a") | |
|
1008 | 1015 | if data[0]: |
|
1009 | f.write(data[0]) | |
|
1010 | f.write(data[1]) | |
|
1011 |
f. |
|
|
1012 | f = self.opener(self.indexfile, "a") | |
|
1016 | dfh.write(data[0]) | |
|
1017 | dfh.write(data[1]) | |
|
1018 | dfh.flush() | |
|
1013 | 1019 | else: |
|
1014 | f = self.opener(self.indexfile, "a+") | |
|
1015 | f.seek(0, 2) | |
|
1016 | transaction.add(self.indexfile, f.tell(), self.count() - 1) | |
|
1020 | ifh.seek(0, 2) | |
|
1021 | transaction.add(self.indexfile, ifh.tell(), self.count() - 1) | |
|
1017 | 1022 | |
|
1018 | 1023 | if len(self.index) == 1 and self.version != REVLOGV0: |
|
1019 | 1024 | l = struct.pack(versionformat, self.version) |
|
1020 | f.write(l) | |
|
1025 | ifh.write(l) | |
|
1021 | 1026 | entry = entry[4:] |
|
1022 | 1027 | |
|
1023 | f.write(entry) | |
|
1028 | ifh.write(entry) | |
|
1024 | 1029 | |
|
1025 | 1030 | if self.inlinedata(): |
|
1026 | f.write(data[0]) | |
|
1027 | f.write(data[1]) | |
|
1028 | self.checkinlinesize(transaction, f) | |
|
1031 | ifh.write(data[0]) | |
|
1032 | ifh.write(data[1]) | |
|
1033 | self.checkinlinesize(transaction, ifh) | |
|
1029 | 1034 | |
|
1030 | 1035 | self.cache = (node, n, text) |
|
1031 | 1036 | return node |
@@ -1146,7 +1151,13 b' class revlog(object):' | |||
|
1146 | 1151 | ifh.flush() |
|
1147 | 1152 | text = self.revision(chain) |
|
1148 | 1153 | text = self.patches(text, [delta]) |
|
1149 |
chk = self.addrevision(text, transaction, link, p1, p2 |
|
|
1154 | chk = self._addrevision(text, transaction, link, p1, p2, None, | |
|
1155 | ifh, dfh) | |
|
1156 | if not dfh and not self.inlinedata(): | |
|
1157 | # addrevision switched from inline to conventional | |
|
1158 | # reopen the index | |
|
1159 | dfh = self.opener(self.datafile, "a") | |
|
1160 | ifh = self.opener(self.indexfile, "a") | |
|
1150 | 1161 | if chk != node: |
|
1151 | 1162 | raise RevlogError(_("consistency error adding group")) |
|
1152 | 1163 | textlen = len(text) |
@@ -1166,11 +1177,6 b' class revlog(object):' | |||
|
1166 | 1177 | dfh = self.opener(self.datafile, "a") |
|
1167 | 1178 | ifh = self.opener(self.indexfile, "a") |
|
1168 | 1179 | else: |
|
1169 | if not dfh: | |
|
1170 | # addrevision switched from inline to conventional | |
|
1171 | # reopen the index | |
|
1172 | dfh = self.opener(self.datafile, "a") | |
|
1173 | ifh = self.opener(self.indexfile, "a") | |
|
1174 | 1180 | dfh.write(cdelta) |
|
1175 | 1181 | ifh.write(struct.pack(self.indexformat, *e)) |
|
1176 | 1182 |
General Comments 0
You need to be logged in to leave comments.
Login now