Show More
@@ -628,7 +628,9 b' class revlog(object):' | |||
|
628 | 628 | # main docket, so disable it for now. |
|
629 | 629 | self._nodemap_file = None |
|
630 | 630 | |
|
631 |
if self. |
|
|
631 | if self._docket is not None: | |
|
632 | self._datafile = self._docket.data_filepath() | |
|
633 | elif self.postfix is None: | |
|
632 | 634 | self._datafile = b'%s.d' % self.radix |
|
633 | 635 | else: |
|
634 | 636 | self._datafile = b'%s.d.%s' % (self.radix, self.postfix) |
@@ -89,12 +89,13 b' if stable_docket_file:' | |||
|
89 | 89 | # | This is mandatory as docket must be compatible with the previous |
|
90 | 90 | # | revlog index header. |
|
91 | 91 | # * 1 bytes: size of index uuid |
|
92 | # * 1 bytes: size of data uuid | |
|
92 | 93 | # * 8 bytes: size of index-data |
|
93 | 94 | # * 8 bytes: pending size of index-data |
|
94 | 95 | # * 8 bytes: size of data |
|
95 | 96 | # * 8 bytes: pending size of data |
|
96 | 97 | # * 1 bytes: default compression header |
|
97 | S_HEADER = struct.Struct(constants.INDEX_HEADER.format + 'BLLLLc') | |
|
98 | S_HEADER = struct.Struct(constants.INDEX_HEADER.format + 'BBLLLLc') | |
|
98 | 99 | |
|
99 | 100 | |
|
100 | 101 | class RevlogDocket(object): |
@@ -106,6 +107,7 b' class RevlogDocket(object):' | |||
|
106 | 107 | use_pending=False, |
|
107 | 108 | version_header=None, |
|
108 | 109 | index_uuid=None, |
|
110 | data_uuid=None, | |
|
109 | 111 | index_end=0, |
|
110 | 112 | pending_index_end=0, |
|
111 | 113 | data_end=0, |
@@ -119,6 +121,7 b' class RevlogDocket(object):' | |||
|
119 | 121 | self._path = revlog._docket_file |
|
120 | 122 | self._opener = revlog.opener |
|
121 | 123 | self._index_uuid = index_uuid |
|
124 | self._data_uuid = data_uuid | |
|
122 | 125 | # thes asserts should be True as long as we have a single index filename |
|
123 | 126 | assert index_end <= pending_index_end |
|
124 | 127 | assert data_end <= pending_data_end |
@@ -141,6 +144,13 b' class RevlogDocket(object):' | |||
|
141 | 144 | self._index_uuid = make_uid() |
|
142 | 145 | return b"%s-%s.idx" % (self._radix, self._index_uuid) |
|
143 | 146 | |
|
147 | def data_filepath(self): | |
|
148 | """file path to the current index file associated to this docket""" | |
|
149 | # very simplistic version at first | |
|
150 | if self._data_uuid is None: | |
|
151 | self._data_uuid = make_uid() | |
|
152 | return b"%s-%s.dat" % (self._radix, self._data_uuid) | |
|
153 | ||
|
144 | 154 | @property |
|
145 | 155 | def index_end(self): |
|
146 | 156 | return self._index_end |
@@ -195,6 +205,7 b' class RevlogDocket(object):' | |||
|
195 | 205 | data = ( |
|
196 | 206 | self._version_header, |
|
197 | 207 | len(self._index_uuid), |
|
208 | len(self._data_uuid), | |
|
198 | 209 | official_index_end, |
|
199 | 210 | self._index_end, |
|
200 | 211 | official_data_end, |
@@ -204,6 +215,7 b' class RevlogDocket(object):' | |||
|
204 | 215 | s = [] |
|
205 | 216 | s.append(S_HEADER.pack(*data)) |
|
206 | 217 | s.append(self._index_uuid) |
|
218 | s.append(self._data_uuid) | |
|
207 | 219 | return b''.join(s) |
|
208 | 220 | |
|
209 | 221 | |
@@ -230,16 +242,20 b' def parse_docket(revlog, data, use_pendi' | |||
|
230 | 242 | index_uuid_size = header[1] |
|
231 | 243 | index_uuid = data[offset : offset + index_uuid_size] |
|
232 | 244 | offset += index_uuid_size |
|
233 |
i |
|
|
234 | pending_index_size = header[3] | |
|
235 | data_size = header[4] | |
|
236 |
|
|
|
237 | default_compression_header = header[6] | |
|
245 | data_uuid_size = header[2] | |
|
246 | data_uuid = data[offset : offset + data_uuid_size] | |
|
247 | offset += data_uuid_size | |
|
248 | index_size = header[3] | |
|
249 | pending_index_size = header[4] | |
|
250 | data_size = header[5] | |
|
251 | pending_data_size = header[6] | |
|
252 | default_compression_header = header[7] | |
|
238 | 253 | docket = RevlogDocket( |
|
239 | 254 | revlog, |
|
240 | 255 | use_pending=use_pending, |
|
241 | 256 | version_header=version_header, |
|
242 | 257 | index_uuid=index_uuid, |
|
258 | data_uuid=data_uuid, | |
|
243 | 259 | index_end=index_size, |
|
244 | 260 | pending_index_end=pending_index_size, |
|
245 | 261 | data_end=data_size, |
@@ -389,7 +389,14 b' def _calcmode(vfs):' | |||
|
389 | 389 | ] |
|
390 | 390 | |
|
391 | 391 | REVLOG_FILES_MAIN_EXT = (b'.i', b'i.tmpcensored') |
|
392 | REVLOG_FILES_OTHER_EXT = (b'.idx', b'.d', b'.n', b'.nd', b'd.tmpcensored') | |
|
392 | REVLOG_FILES_OTHER_EXT = ( | |
|
393 | b'.idx', | |
|
394 | b'.d', | |
|
395 | b'.dat', | |
|
396 | b'.n', | |
|
397 | b'.nd', | |
|
398 | b'd.tmpcensored', | |
|
399 | ) | |
|
393 | 400 | # files that are "volatile" and might change between listing and streaming |
|
394 | 401 | # |
|
395 | 402 | # note: the ".nd" file are nodemap data and won't "change" but they might be |
@@ -414,6 +421,7 b' def revlog_type(f):' | |||
|
414 | 421 | if f.endswith(REVLOG_FILES_VOLATILE_EXT): |
|
415 | 422 | t |= FILEFLAGS_VOLATILE |
|
416 | 423 | return t |
|
424 | return None | |
|
417 | 425 | |
|
418 | 426 | |
|
419 | 427 | # the file is part of changelog data |
@@ -753,6 +761,7 b' class fncachestore(basicstore):' | |||
|
753 | 761 | ef = self.encode(f) |
|
754 | 762 | try: |
|
755 | 763 | t = revlog_type(f) |
|
764 | assert t is not None, f | |
|
756 | 765 | t |= FILEFLAGS_FILELOG |
|
757 | 766 | yield t, f, ef, self.getsize(ef) |
|
758 | 767 | except OSError as err: |
@@ -58,6 +58,7 b' Writing a simple revlog v2 works' | |||
|
58 | 58 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
59 | 59 | summary: initial |
|
60 | 60 | |
|
61 | ||
|
61 | 62 | Header written as expected |
|
62 | 63 | |
|
63 | 64 | $ f --hexdump --bytes 4 .hg/store/00changelog.i |
@@ -77,9 +78,9 b' We should have have:' | |||
|
77 | 78 | - a data file |
|
78 | 79 | |
|
79 | 80 | $ ls .hg/store/00changelog* .hg/store/00manifest* |
|
80 |
.hg/store/00changelog- |
|
|
81 | .hg/store/00changelog.d | |
|
81 | .hg/store/00changelog-6b8ab34b.dat | |
|
82 | .hg/store/00changelog-88698448.idx | |
|
82 | 83 | .hg/store/00changelog.i |
|
83 |
.hg/store/00manifest- |
|
|
84 | .hg/store/00manifest.d | |
|
84 | .hg/store/00manifest-1335303a.dat | |
|
85 | .hg/store/00manifest-b875dfc5.idx | |
|
85 | 86 | .hg/store/00manifest.i |
General Comments 0
You need to be logged in to leave comments.
Login now