Show More
@@ -2016,7 +2016,7 b' class revlog(object):' | |||||
2016 |
|
2016 | |||
2017 | if existing_handles: |
|
2017 | if existing_handles: | |
2018 | # switched from inline to conventional reopen the index |
|
2018 | # switched from inline to conventional reopen the index | |
2019 |
ifh = self._indexfp(b" |
|
2019 | ifh = self._indexfp(b"r+") | |
2020 | self._writinghandles = (ifh, new_dfh) |
|
2020 | self._writinghandles = (ifh, new_dfh) | |
2021 | new_dfh = None |
|
2021 | new_dfh = None | |
2022 | finally: |
|
2022 | finally: | |
@@ -2037,11 +2037,23 b' class revlog(object):' | |||||
2037 | dsize = self.end(r - 1) |
|
2037 | dsize = self.end(r - 1) | |
2038 | dfh = None |
|
2038 | dfh = None | |
2039 | if not self._inline: |
|
2039 | if not self._inline: | |
2040 | dfh = self._datafp(b"a+") |
|
2040 | try: | |
|
2041 | dfh = self._datafp(b"r+") | |||
|
2042 | dfh.seek(0, os.SEEK_END) | |||
|
2043 | except IOError as inst: | |||
|
2044 | if inst.errno != errno.ENOENT: | |||
|
2045 | raise | |||
|
2046 | dfh = self._datafp(b"w+") | |||
2041 | transaction.add(self._datafile, dsize) |
|
2047 | transaction.add(self._datafile, dsize) | |
2042 | try: |
|
2048 | try: | |
2043 | isize = r * self.index.entry_size |
|
2049 | isize = r * self.index.entry_size | |
2044 | ifh = self._indexfp(b"a+") |
|
2050 | try: | |
|
2051 | ifh = self._indexfp(b"r+") | |||
|
2052 | ifh.seek(0, os.SEEK_END) | |||
|
2053 | except IOError as inst: | |||
|
2054 | if inst.errno != errno.ENOENT: | |||
|
2055 | raise | |||
|
2056 | ifh = self._indexfp(b"w+") | |||
2045 | if self._inline: |
|
2057 | if self._inline: | |
2046 | transaction.add(self._indexfile, dsize + isize) |
|
2058 | transaction.add(self._indexfile, dsize + isize) | |
2047 | else: |
|
2059 | else: | |
@@ -3174,6 +3186,8 b' class revlog(object):' | |||||
3174 | entry = (new_offset_flags,) + entry[1:8] |
|
3186 | entry = (new_offset_flags,) + entry[1:8] | |
3175 | entry += (current_offset, len(serialized_sidedata)) |
|
3187 | entry += (current_offset, len(serialized_sidedata)) | |
3176 |
|
3188 | |||
|
3189 | # the sidedata computation might have move the file cursors around | |||
|
3190 | dfh.seek(current_offset, os.SEEK_SET) | |||
3177 | dfh.write(serialized_sidedata) |
|
3191 | dfh.write(serialized_sidedata) | |
3178 | new_entries.append(entry) |
|
3192 | new_entries.append(entry) | |
3179 | current_offset += len(serialized_sidedata) |
|
3193 | current_offset += len(serialized_sidedata) |
@@ -706,7 +706,7 b' class _fncachevfs(vfsmod.proxyvfs):' | |||||
706 | # do not trigger a fncache load when adding a file that already is |
|
706 | # do not trigger a fncache load when adding a file that already is | |
707 | # known to exist. |
|
707 | # known to exist. | |
708 | notload = self.fncache.entries is None and self.vfs.exists(encoded) |
|
708 | notload = self.fncache.entries is None and self.vfs.exists(encoded) | |
709 |
if notload and b' |
|
709 | if notload and b'r+' in mode and not self.vfs.stat(encoded).st_size: | |
710 | # when appending to an existing file, if the file has size zero, |
|
710 | # when appending to an existing file, if the file has size zero, | |
711 | # it should be considered as missing. Such zero-size files are |
|
711 | # it should be considered as missing. Such zero-size files are | |
712 | # the result of truncation when a transaction is aborted. |
|
712 | # the result of truncation when a transaction is aborted. |
General Comments 0
You need to be logged in to leave comments.
Login now