Show More
@@ -2137,6 +2137,7 b' def debugnodemap(ui, repo, **opts):' | |||
|
2137 | 2137 | if nm_data is not None: |
|
2138 | 2138 | docket, data = nm_data |
|
2139 | 2139 | ui.write((b"uid: %s\n") % docket.uid) |
|
2140 | ui.write((b"tip-rev: %d\n") % docket.tip_rev) | |
|
2140 | 2141 | |
|
2141 | 2142 | |
|
2142 | 2143 | @command( |
@@ -170,15 +170,15 b' class PersistentNodeMapIndexObject(Index' | |||
|
170 | 170 | self._nm_root = self._nm_max_idx = self._nm_rev = None |
|
171 | 171 | return data |
|
172 | 172 | |
|
173 | def update_nodemap_data(self, nm_data): | |
|
174 |
"""provide full blo |
|
|
173 | def update_nodemap_data(self, docket, nm_data): | |
|
174 | """provide full block of persisted binary data for a nodemap | |
|
175 | 175 | |
|
176 | 176 | The data are expected to come from disk. See `nodemap_data_all` for a |
|
177 | 177 | produceur of such data.""" |
|
178 | 178 | if nm_data is not None: |
|
179 | 179 | self._nm_root, self._nm_max_idx = nodemaputil.parse_data(nm_data) |
|
180 | 180 | if self._nm_root: |
|
181 |
self._nm_rev = |
|
|
181 | self._nm_rev = docket.tip_rev | |
|
182 | 182 | else: |
|
183 | 183 | self._nm_root = self._nm_max_idx = self._nm_rev = None |
|
184 | 184 |
@@ -639,7 +639,7 b' class revlog(object):' | |||
|
639 | 639 | if use_nodemap: |
|
640 | 640 | nodemap_data = nodemaputil.persisted_data(self) |
|
641 | 641 | if nodemap_data is not None: |
|
642 |
index.update_nodemap_data(nodemap_data |
|
|
642 | index.update_nodemap_data(*nodemap_data) | |
|
643 | 643 | except (ValueError, IndexError): |
|
644 | 644 | raise error.RevlogError( |
|
645 | 645 | _(b"index %s is corrupted") % self.indexfile |
@@ -36,9 +36,11 b' def persisted_data(revlog):' | |||
|
36 | 36 | if version != ONDISK_VERSION: |
|
37 | 37 | return None |
|
38 | 38 | offset += S_VERSION.size |
|
39 |
|
|
|
39 | headers = S_HEADER.unpack(pdata[offset : offset + S_HEADER.size]) | |
|
40 | uid_size, tip_rev = headers | |
|
40 | 41 | offset += S_HEADER.size |
|
41 | 42 | docket = NodeMapDocket(pdata[offset : offset + uid_size]) |
|
43 | docket.tip_rev = tip_rev | |
|
42 | 44 | |
|
43 | 45 | filename = _rawdata_filepath(revlog, docket) |
|
44 | 46 | return docket, revlog.opener.tryread(filename) |
@@ -94,6 +96,7 b' def _persist_nodemap(tr, revlog):' | |||
|
94 | 96 | # store vfs |
|
95 | 97 | with revlog.opener(datafile, b'w') as fd: |
|
96 | 98 | fd.write(data) |
|
99 | target_docket.tip_rev = revlog.tiprev() | |
|
97 | 100 | # EXP-TODO: if this is a cache, this should use a cache vfs, not a |
|
98 | 101 | # store vfs |
|
99 | 102 | with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: |
@@ -142,7 +145,7 b' def _persist_nodemap(tr, revlog):' | |||
|
142 | 145 | ONDISK_VERSION = 0 |
|
143 | 146 | |
|
144 | 147 | S_VERSION = struct.Struct(">B") |
|
145 | S_HEADER = struct.Struct(">B") | |
|
148 | S_HEADER = struct.Struct(">BQ") | |
|
146 | 149 | |
|
147 | 150 | ID_SIZE = 8 |
|
148 | 151 | |
@@ -164,15 +167,19 b' class NodeMapDocket(object):' | |||
|
164 | 167 | if uid is None: |
|
165 | 168 | uid = _make_uid() |
|
166 | 169 | self.uid = uid |
|
170 | self.tip_rev = None | |
|
167 | 171 | |
|
168 | 172 | def copy(self): |
|
169 |
|
|
|
173 | new = NodeMapDocket(uid=self.uid) | |
|
174 | new.tip_rev = self.tip_rev | |
|
175 | return new | |
|
170 | 176 | |
|
171 | 177 | def serialize(self): |
|
172 | 178 | """return serialized bytes for a docket using the passed uid""" |
|
173 | 179 | data = [] |
|
174 | 180 | data.append(S_VERSION.pack(ONDISK_VERSION)) |
|
175 | data.append(S_HEADER.pack(len(self.uid))) | |
|
181 | headers = (len(self.uid), self.tip_rev) | |
|
182 | data.append(S_HEADER.pack(*headers)) | |
|
176 | 183 | data.append(self.uid) |
|
177 | 184 | return b''.join(data) |
|
178 | 185 |
@@ -14,8 +14,9 b' Test the persistent on-disk nodemap' | |||
|
14 | 14 | $ hg debugbuilddag .+5000 |
|
15 | 15 | $ hg debugnodemap --metadata |
|
16 | 16 | uid: ???????????????? (glob) |
|
17 | tip-rev: 5000 | |
|
17 | 18 | $ f --size .hg/store/00changelog.n |
|
18 |
.hg/store/00changelog.n: size= |
|
|
19 | .hg/store/00changelog.n: size=26 | |
|
19 | 20 | $ f --sha256 .hg/store/00changelog-*.nd |
|
20 | 21 | .hg/store/00changelog-????????????????.nd: sha256=b961925120e1c9bc345c199b2cc442abc477029fdece37ef9d99cbe59c0558b7 (glob) |
|
21 | 22 | $ hg debugnodemap --dump-new | f --sha256 --size |
@@ -51,8 +52,9 b' add a new commit' | |||
|
51 | 52 | $ hg ci -m 'foo' |
|
52 | 53 | $ hg debugnodemap --metadata |
|
53 | 54 | uid: ???????????????? (glob) |
|
55 | tip-rev: 5001 | |
|
54 | 56 | $ f --size .hg/store/00changelog.n |
|
55 |
.hg/store/00changelog.n: size= |
|
|
57 | .hg/store/00changelog.n: size=26 | |
|
56 | 58 | |
|
57 | 59 | (The pure code use the debug code that perform incremental update, the C code reencode from scratch) |
|
58 | 60 |
General Comments 0
You need to be logged in to leave comments.
Login now