Show More
@@ -408,7 +408,6 b' coreconfigitem(' | |||
|
408 | 408 | # TODO before getting `persistent-nodemap` out of experimental |
|
409 | 409 | # |
|
410 | 410 | # * code/tests around aborted transaction |
|
411 | # * code/tests around pending data for hooks | |
|
412 | 411 | # * regenerate a new nodemap when the unused/total ration is to high |
|
413 | 412 | # * decide for a "status" of the persistent nodemap and associated location |
|
414 | 413 | # - part of the store next the revlog itself (new requirements) |
@@ -436,7 +436,14 b' class revlog(object):' | |||
|
436 | 436 | self.datafile = datafile or (indexfile[:-2] + b".d") |
|
437 | 437 | self.nodemap_file = None |
|
438 | 438 | if persistentnodemap: |
|
439 | self.nodemap_file = indexfile[:-2] + b".n" | |
|
439 | if indexfile.endswith(b'.a'): | |
|
440 | pending_path = indexfile[:-4] + b".n.a" | |
|
441 | if opener.exists(pending_path): | |
|
442 | self.nodemap_file = pending_path | |
|
443 | else: | |
|
444 | self.nodemap_file = indexfile[:-4] + b".n" | |
|
445 | else: | |
|
446 | self.nodemap_file = indexfile[:-2] + b".n" | |
|
440 | 447 | |
|
441 | 448 | self.opener = opener |
|
442 | 449 | # When True, indexfile is opened with checkambig=True at writing, to |
@@ -75,6 +75,9 b' def setup_persistent_nodemap(tr, revlog)' | |||
|
75 | 75 | callback_id = b"revlog-persistent-nodemap-%s" % revlog.nodemap_file |
|
76 | 76 | if tr.hasfinalize(callback_id): |
|
77 | 77 | return # no need to register again |
|
78 | tr.addpending( | |
|
79 | callback_id, lambda tr: _persist_nodemap(tr, revlog, pending=True) | |
|
80 | ) | |
|
78 | 81 | tr.addfinalize(callback_id, lambda tr: _persist_nodemap(tr, revlog)) |
|
79 | 82 | |
|
80 | 83 | |
@@ -101,7 +104,7 b' def update_persistent_nodemap(revlog):' | |||
|
101 | 104 | notr._postclose[k](None) |
|
102 | 105 | |
|
103 | 106 | |
|
104 | def _persist_nodemap(tr, revlog): | |
|
107 | def _persist_nodemap(tr, revlog, pending=False): | |
|
105 | 108 | """Write nodemap data on disk for a given revlog |
|
106 | 109 | """ |
|
107 | 110 | if getattr(revlog, 'filteredrevs', ()): |
@@ -169,7 +172,10 b' def _persist_nodemap(tr, revlog):' | |||
|
169 | 172 | target_docket.tip_node = revlog.node(target_docket.tip_rev) |
|
170 | 173 | # EXP-TODO: if this is a cache, this should use a cache vfs, not a |
|
171 | 174 | # store vfs |
|
172 | with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: | |
|
175 | file_path = revlog.nodemap_file | |
|
176 | if pending: | |
|
177 | file_path += b'.a' | |
|
178 | with revlog.opener(file_path, b'w', atomictemp=True) as fp: | |
|
173 | 179 | fp.write(target_docket.serialize()) |
|
174 | 180 | revlog._nodemap_docket = target_docket |
|
175 | 181 | if feed_data: |
@@ -304,7 +310,10 b' class NodeMapDocket(object):' | |||
|
304 | 310 | |
|
305 | 311 | def _rawdata_filepath(revlog, docket): |
|
306 | 312 | """The (vfs relative) nodemap's rawdata file for a given uid""" |
|
307 |
|
|
|
313 | if revlog.nodemap_file.endswith(b'.n.a'): | |
|
314 | prefix = revlog.nodemap_file[:-4] | |
|
315 | else: | |
|
316 | prefix = revlog.nodemap_file[:-2] | |
|
308 | 317 | return b"%s-%s.nd" % (prefix, docket.uid) |
|
309 | 318 | |
|
310 | 319 |
@@ -281,3 +281,39 b' the nodemap should detect the changelog ' | |||
|
281 | 281 | data-unused: 0 |
|
282 | 282 | $ hg log -r "$OTHERNODE" -T '{rev}\n' |
|
283 | 283 | 5002 |
|
284 | ||
|
285 | Check transaction related property | |
|
286 | ================================== | |
|
287 | ||
|
288 | An up to date nodemap should be available to shell hooks, | |
|
289 | ||
|
290 | $ echo dsljfl > a | |
|
291 | $ hg add a | |
|
292 | $ hg ci -m a | |
|
293 | $ hg debugnodemap --metadata | |
|
294 | uid: ???????????????? (glob) | |
|
295 | tip-rev: 5003 | |
|
296 | tip-node: c91af76d172f1053cca41b83f7c2e4e514fe2bcf | |
|
297 | data-length: 123008 | |
|
298 | data-unused: 0 | |
|
299 | $ echo babar2 > babar | |
|
300 | $ hg ci -m 'babar2' --config "hooks.pretxnclose.nodemap-test=hg debugnodemap --metadata" | |
|
301 | uid: ???????????????? (glob) | |
|
302 | tip-rev: 5004 | |
|
303 | tip-node: ba87cd9559559e4b91b28cb140d003985315e031 | |
|
304 | data-length: 123328 (pure !) | |
|
305 | data-length: 123328 (rust !) | |
|
306 | data-length: 123136 (no-pure no-rust !) | |
|
307 | data-unused: 192 (pure !) | |
|
308 | data-unused: 192 (rust !) | |
|
309 | data-unused: 0 (no-pure no-rust !) | |
|
310 | $ hg debugnodemap --metadata | |
|
311 | uid: ???????????????? (glob) | |
|
312 | tip-rev: 5004 | |
|
313 | tip-node: ba87cd9559559e4b91b28cb140d003985315e031 | |
|
314 | data-length: 123328 (pure !) | |
|
315 | data-length: 123328 (rust !) | |
|
316 | data-length: 123136 (no-pure no-rust !) | |
|
317 | data-unused: 192 (pure !) | |
|
318 | data-unused: 192 (rust !) | |
|
319 | data-unused: 0 (no-pure no-rust !) |
General Comments 0
You need to be logged in to leave comments.
Login now