Show More
@@ -124,7 +124,7 b' class appender(object):' | |||||
124 |
|
124 | |||
125 | def _divertopener(opener, target): |
|
125 | def _divertopener(opener, target): | |
126 | """build an opener that writes in 'target.a' instead of 'target'""" |
|
126 | """build an opener that writes in 'target.a' instead of 'target'""" | |
127 | def _divert(name, mode='r'): |
|
127 | def _divert(name, mode='r', checkambig=False): | |
128 | if name != target: |
|
128 | if name != target: | |
129 | return opener(name, mode) |
|
129 | return opener(name, mode) | |
130 | return opener(name + ".a", mode) |
|
130 | return opener(name + ".a", mode) | |
@@ -132,7 +132,7 b' def _divertopener(opener, target):' | |||||
132 |
|
132 | |||
133 | def _delayopener(opener, target, buf): |
|
133 | def _delayopener(opener, target, buf): | |
134 | """build an opener that stores chunks in 'buf' instead of 'target'""" |
|
134 | """build an opener that stores chunks in 'buf' instead of 'target'""" | |
135 | def _delay(name, mode='r'): |
|
135 | def _delay(name, mode='r', checkambig=False): | |
136 | if name != target: |
|
136 | if name != target: | |
137 | return opener(name, mode) |
|
137 | return opener(name, mode) | |
138 | return appender(opener, name, mode, buf) |
|
138 | return appender(opener, name, mode, buf) |
@@ -212,8 +212,11 b' class revlog(object):' | |||||
212 | fashion, which means we never need to rewrite a file to insert or |
|
212 | fashion, which means we never need to rewrite a file to insert or | |
213 | remove data, and can use some simple techniques to avoid the need |
|
213 | remove data, and can use some simple techniques to avoid the need | |
214 | for locking while reading. |
|
214 | for locking while reading. | |
|
215 | ||||
|
216 | If checkambig, indexfile is opened with checkambig=True at | |||
|
217 | writing, to avoid file stat ambiguity. | |||
215 | """ |
|
218 | """ | |
216 | def __init__(self, opener, indexfile): |
|
219 | def __init__(self, opener, indexfile, checkambig=False): | |
217 | """ |
|
220 | """ | |
218 | create a revlog object |
|
221 | create a revlog object | |
219 |
|
222 | |||
@@ -223,6 +226,9 b' class revlog(object):' | |||||
223 | self.indexfile = indexfile |
|
226 | self.indexfile = indexfile | |
224 | self.datafile = indexfile[:-2] + ".d" |
|
227 | self.datafile = indexfile[:-2] + ".d" | |
225 | self.opener = opener |
|
228 | self.opener = opener | |
|
229 | # When True, indexfile is opened with checkambig=True at writing, to | |||
|
230 | # avoid file stat ambiguity. | |||
|
231 | self._checkambig = checkambig | |||
226 | # 3-tuple of (node, rev, text) for a raw revision. |
|
232 | # 3-tuple of (node, rev, text) for a raw revision. | |
227 | self._cache = None |
|
233 | self._cache = None | |
228 | # Maps rev to chain base rev. |
|
234 | # Maps rev to chain base rev. | |
@@ -1276,7 +1282,8 b' class revlog(object):' | |||||
1276 | finally: |
|
1282 | finally: | |
1277 | df.close() |
|
1283 | df.close() | |
1278 |
|
1284 | |||
1279 |
fp = self.opener(self.indexfile, 'w', atomictemp=True |
|
1285 | fp = self.opener(self.indexfile, 'w', atomictemp=True, | |
|
1286 | checkambig=self._checkambig) | |||
1280 | self.version &= ~(REVLOGNGINLINEDATA) |
|
1287 | self.version &= ~(REVLOGNGINLINEDATA) | |
1281 | self._inline = False |
|
1288 | self._inline = False | |
1282 | for i in self: |
|
1289 | for i in self: | |
@@ -1319,7 +1326,7 b' class revlog(object):' | |||||
1319 | dfh = None |
|
1326 | dfh = None | |
1320 | if not self._inline: |
|
1327 | if not self._inline: | |
1321 | dfh = self.opener(self.datafile, "a+") |
|
1328 | dfh = self.opener(self.datafile, "a+") | |
1322 | ifh = self.opener(self.indexfile, "a+") |
|
1329 | ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig) | |
1323 | try: |
|
1330 | try: | |
1324 | return self._addrevision(node, text, transaction, link, p1, p2, |
|
1331 | return self._addrevision(node, text, transaction, link, p1, p2, | |
1325 | REVIDX_DEFAULT_FLAGS, cachedelta, ifh, dfh) |
|
1332 | REVIDX_DEFAULT_FLAGS, cachedelta, ifh, dfh) | |
@@ -1567,7 +1574,7 b' class revlog(object):' | |||||
1567 | end = 0 |
|
1574 | end = 0 | |
1568 | if r: |
|
1575 | if r: | |
1569 | end = self.end(r - 1) |
|
1576 | end = self.end(r - 1) | |
1570 | ifh = self.opener(self.indexfile, "a+") |
|
1577 | ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig) | |
1571 | isize = r * self._io.size |
|
1578 | isize = r * self._io.size | |
1572 | if self._inline: |
|
1579 | if self._inline: | |
1573 | transaction.add(self.indexfile, end + isize, r) |
|
1580 | transaction.add(self.indexfile, end + isize, r) | |
@@ -1641,7 +1648,8 b' class revlog(object):' | |||||
1641 | # reopen the index |
|
1648 | # reopen the index | |
1642 | ifh.close() |
|
1649 | ifh.close() | |
1643 | dfh = self.opener(self.datafile, "a+") |
|
1650 | dfh = self.opener(self.datafile, "a+") | |
1644 |
ifh = self.opener(self.indexfile, "a+" |
|
1651 | ifh = self.opener(self.indexfile, "a+", | |
|
1652 | checkambig=self._checkambig) | |||
1645 | finally: |
|
1653 | finally: | |
1646 | if dfh: |
|
1654 | if dfh: | |
1647 | dfh.close() |
|
1655 | dfh.close() |
General Comments 0
You need to be logged in to leave comments.
Login now