Show More
@@ -455,6 +455,7 b' class changelog(revlog.revlog):' | |||
|
455 | 455 | self._realopener, self._indexfile, self._delaybuf |
|
456 | 456 | ) |
|
457 | 457 | self._segmentfile.opener = self.opener |
|
458 | self._segmentfile_sidedata.opener = self.opener | |
|
458 | 459 | self._delayed = True |
|
459 | 460 | tr.addpending(b'cl-%i' % id(self), self._writepending) |
|
460 | 461 | tr.addfinalize(b'cl-%i' % id(self), self._finalize) |
@@ -464,6 +465,7 b' class changelog(revlog.revlog):' | |||
|
464 | 465 | self._delayed = False |
|
465 | 466 | self.opener = self._realopener |
|
466 | 467 | self._segmentfile.opener = self.opener |
|
468 | self._segmentfile_sidedata.opener = self.opener | |
|
467 | 469 | # move redirected index data back into place |
|
468 | 470 | if self._docket is not None: |
|
469 | 471 | self._write_docket(tr) |
@@ -504,6 +506,7 b' class changelog(revlog.revlog):' | |||
|
504 | 506 | self._divert = True |
|
505 | 507 | self.opener = _divertopener(self._realopener, self._indexfile) |
|
506 | 508 | self._segmentfile.opener = self.opener |
|
509 | self._segmentfile_sidedata.opener = self.opener | |
|
507 | 510 | |
|
508 | 511 | if self._divert: |
|
509 | 512 | return True |
@@ -629,6 +629,11 b' class revlog(object):' | |||
|
629 | 629 | self._chunkcachesize, |
|
630 | 630 | chunkcache, |
|
631 | 631 | ) |
|
632 | self._segmentfile_sidedata = randomaccessfile.randomaccessfile( | |
|
633 | self.opener, | |
|
634 | self._sidedatafile, | |
|
635 | self._chunkcachesize, | |
|
636 | ) | |
|
632 | 637 | # revnum -> (chain-length, sum-delta-length) |
|
633 | 638 | self._chaininfocache = util.lrucachedict(500) |
|
634 | 639 | # revlog header -> revlog compressor |
@@ -782,6 +787,7 b' class revlog(object):' | |||
|
782 | 787 | self._revisioncache = None |
|
783 | 788 | self._chainbasecache.clear() |
|
784 | 789 | self._segmentfile.clear_cache() |
|
790 | self._segmentfile_sidedata.clear_cache() | |
|
785 | 791 | self._pcache = {} |
|
786 | 792 | self._nodemap_docket = None |
|
787 | 793 | self.index.clearcaches() |
@@ -1916,31 +1922,17 b' class revlog(object):' | |||
|
1916 | 1922 | if sidedata_size == 0: |
|
1917 | 1923 | return {} |
|
1918 | 1924 | |
|
1919 | # XXX this need caching, as we do for data | |
|
1920 | with self._sidedatareadfp() as sdf: | |
|
1921 |
|
|
|
1922 |
|
|
|
1923 |
|
|
|
1924 | offset = sidedata_offset | |
|
1925 | length = sidedata_size | |
|
1926 | m = FILE_TOO_SHORT_MSG % (filename, length, offset, end) | |
|
1927 | raise error.RevlogError(m) | |
|
1928 | ||
|
1929 | sdf.seek(sidedata_offset, os.SEEK_SET) | |
|
1930 | comp_segment = sdf.read(sidedata_size) | |
|
1931 | ||
|
1932 | if len(comp_segment) < sidedata_size: | |
|
1933 | filename = self._sidedatafile | |
|
1934 | length = sidedata_size | |
|
1935 | offset = sidedata_offset | |
|
1936 | got = len(comp_segment) | |
|
1937 | m = randomaccessfile.PARTIAL_READ_MSG % ( | |
|
1938 | filename, | |
|
1939 | length, | |
|
1940 | offset, | |
|
1941 | got, | |
|
1942 | ) | |
|
1943 | raise error.RevlogError(m) | |
|
1925 | if self._docket.sidedata_end < sidedata_offset + sidedata_size: | |
|
1926 | filename = self._sidedatafile | |
|
1927 | end = self._docket.sidedata_end | |
|
1928 | offset = sidedata_offset | |
|
1929 | length = sidedata_size | |
|
1930 | m = FILE_TOO_SHORT_MSG % (filename, length, offset, end) | |
|
1931 | raise error.RevlogError(m) | |
|
1932 | ||
|
1933 | comp_segment = self._segmentfile_sidedata.read_chunk( | |
|
1934 | sidedata_offset, sidedata_size | |
|
1935 | ) | |
|
1944 | 1936 | |
|
1945 | 1937 | comp = self.index[rev][11] |
|
1946 | 1938 | if comp == COMP_MODE_PLAIN: |
@@ -2033,6 +2025,9 b' class revlog(object):' | |||
|
2033 | 2025 | # its usage. |
|
2034 | 2026 | self._writinghandles = None |
|
2035 | 2027 | self._segmentfile.writing_handle = None |
|
2028 | # No need to deal with sidedata writing handle as it is only | |
|
2029 | # relevant with revlog-v2 which is never inline, not reaching | |
|
2030 | # this code | |
|
2036 | 2031 | |
|
2037 | 2032 | new_dfh = self._datafp(b'w+') |
|
2038 | 2033 | new_dfh.truncate(0) # drop any potentially existing data |
@@ -2080,6 +2075,9 b' class revlog(object):' | |||
|
2080 | 2075 | self._writinghandles = (ifh, new_dfh, None) |
|
2081 | 2076 | self._segmentfile.writing_handle = new_dfh |
|
2082 | 2077 | new_dfh = None |
|
2078 | # No need to deal with sidedata writing handle as it is only | |
|
2079 | # relevant with revlog-v2 which is never inline, not reaching | |
|
2080 | # this code | |
|
2083 | 2081 | finally: |
|
2084 | 2082 | if new_dfh is not None: |
|
2085 | 2083 | new_dfh.close() |
@@ -2138,12 +2136,14 b' class revlog(object):' | |||
|
2138 | 2136 | # exposing all file handle for writing. |
|
2139 | 2137 | self._writinghandles = (ifh, dfh, sdfh) |
|
2140 | 2138 | self._segmentfile.writing_handle = ifh if self._inline else dfh |
|
2139 | self._segmentfile_sidedata.writing_handle = sdfh | |
|
2141 | 2140 | yield |
|
2142 | 2141 | if self._docket is not None: |
|
2143 | 2142 | self._write_docket(transaction) |
|
2144 | 2143 | finally: |
|
2145 | 2144 | self._writinghandles = None |
|
2146 | 2145 | self._segmentfile.writing_handle = None |
|
2146 | self._segmentfile_sidedata.writing_handle = None | |
|
2147 | 2147 | if dfh is not None: |
|
2148 | 2148 | dfh.close() |
|
2149 | 2149 | if sdfh is not None: |
@@ -2778,6 +2778,7 b' class revlog(object):' | |||
|
2778 | 2778 | self._revisioncache = None |
|
2779 | 2779 | self._chaininfocache = util.lrucachedict(500) |
|
2780 | 2780 | self._segmentfile.clear_cache() |
|
2781 | self._segmentfile_sidedata.clear_cache() | |
|
2781 | 2782 | |
|
2782 | 2783 | del self.index[rev:-1] |
|
2783 | 2784 |
General Comments 0
You need to be logged in to leave comments.
Login now