Show More
@@ -124,7 +124,7 b' class appender(object):' | |||
|
124 | 124 | |
|
125 | 125 | def _divertopener(opener, target): |
|
126 | 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 | 128 | if name != target: |
|
129 | 129 | return opener(name, mode) |
|
130 | 130 | return opener(name + ".a", mode) |
@@ -132,7 +132,7 b' def _divertopener(opener, target):' | |||
|
132 | 132 | |
|
133 | 133 | def _delayopener(opener, target, buf): |
|
134 | 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 | 136 | if name != target: |
|
137 | 137 | return opener(name, mode) |
|
138 | 138 | return appender(opener, name, mode, buf) |
@@ -212,8 +212,11 b' class revlog(object):' | |||
|
212 | 212 | fashion, which means we never need to rewrite a file to insert or |
|
213 | 213 | remove data, and can use some simple techniques to avoid the need |
|
214 | 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 | 221 | create a revlog object |
|
219 | 222 | |
@@ -223,6 +226,9 b' class revlog(object):' | |||
|
223 | 226 | self.indexfile = indexfile |
|
224 | 227 | self.datafile = indexfile[:-2] + ".d" |
|
225 | 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 | 232 | # 3-tuple of (node, rev, text) for a raw revision. |
|
227 | 233 | self._cache = None |
|
228 | 234 | # Maps rev to chain base rev. |
@@ -1276,7 +1282,8 b' class revlog(object):' | |||
|
1276 | 1282 | finally: |
|
1277 | 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 | 1287 | self.version &= ~(REVLOGNGINLINEDATA) |
|
1281 | 1288 | self._inline = False |
|
1282 | 1289 | for i in self: |
@@ -1319,7 +1326,7 b' class revlog(object):' | |||
|
1319 | 1326 | dfh = None |
|
1320 | 1327 | if not self._inline: |
|
1321 | 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 | 1330 | try: |
|
1324 | 1331 | return self._addrevision(node, text, transaction, link, p1, p2, |
|
1325 | 1332 | REVIDX_DEFAULT_FLAGS, cachedelta, ifh, dfh) |
@@ -1567,7 +1574,7 b' class revlog(object):' | |||
|
1567 | 1574 | end = 0 |
|
1568 | 1575 | if r: |
|
1569 | 1576 | end = self.end(r - 1) |
|
1570 | ifh = self.opener(self.indexfile, "a+") | |
|
1577 | ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig) | |
|
1571 | 1578 | isize = r * self._io.size |
|
1572 | 1579 | if self._inline: |
|
1573 | 1580 | transaction.add(self.indexfile, end + isize, r) |
@@ -1641,7 +1648,8 b' class revlog(object):' | |||
|
1641 | 1648 | # reopen the index |
|
1642 | 1649 | ifh.close() |
|
1643 | 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 | 1653 | finally: |
|
1646 | 1654 | if dfh: |
|
1647 | 1655 | dfh.close() |
General Comments 0
You need to be logged in to leave comments.
Login now