Show More
@@ -2086,16 +2086,29 b' def debugnamecomplete(ui, repo, *args):' | |||
|
2086 | 2086 | |
|
2087 | 2087 | @command( |
|
2088 | 2088 | b'debugnodemap', |
|
2089 | [(b'', b'dump', False, _(b'write persistent binary nodemap on stdin'))], | |
|
2089 | [ | |
|
2090 | ( | |
|
2091 | b'', | |
|
2092 | b'dump-new', | |
|
2093 | False, | |
|
2094 | _(b'write a (new) persistent binary nodemap on stdin'), | |
|
2095 | ), | |
|
2096 | (b'', b'dump-disk', False, _(b'dump on-disk data on stdin')), | |
|
2097 | ], | |
|
2090 | 2098 | ) |
|
2091 | 2099 | def debugnodemap(ui, repo, **opts): |
|
2092 | 2100 | """write and inspect on disk nodemap |
|
2093 | 2101 | """ |
|
2094 | if opts['dump']: | |
|
2102 | if opts['dump_new']: | |
|
2095 | 2103 | unfi = repo.unfiltered() |
|
2096 | 2104 | cl = unfi.changelog |
|
2097 | 2105 | data = nodemap.persistent_data(cl.index) |
|
2098 | 2106 | ui.write(data) |
|
2107 | elif opts['dump_disk']: | |
|
2108 | unfi = repo.unfiltered() | |
|
2109 | cl = unfi.changelog | |
|
2110 | data = nodemap.persisted_data(cl) | |
|
2111 | ui.write(data) | |
|
2099 | 2112 | |
|
2100 | 2113 | |
|
2101 | 2114 | @command( |
@@ -22,6 +22,13 b' class NodeMap(dict):' | |||
|
22 | 22 | raise error.RevlogError(b'unknown node: %s' % x) |
|
23 | 23 | |
|
24 | 24 | |
|
25 | def persisted_data(revlog): | |
|
26 | """read the nodemap for a revlog from disk""" | |
|
27 | if revlog.nodemap_file is None: | |
|
28 | return None | |
|
29 | return revlog.opener.tryread(revlog.nodemap_file) | |
|
30 | ||
|
31 | ||
|
25 | 32 | def setup_persistent_nodemap(tr, revlog): |
|
26 | 33 | """Install whatever is needed transaction side to persist a nodemap on disk |
|
27 | 34 |
@@ -291,7 +291,7 b' Show all commands + options' | |||
|
291 | 291 | debugmanifestfulltextcache: clear, add |
|
292 | 292 | debugmergestate: |
|
293 | 293 | debugnamecomplete: |
|
294 | debugnodemap: dump | |
|
294 | debugnodemap: dump-new, dump-disk | |
|
295 | 295 | debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template |
|
296 | 296 | debugp1copies: rev |
|
297 | 297 | debugp2copies: rev |
@@ -10,9 +10,9 b' Test the persistent on-disk nodemap' | |||
|
10 | 10 | > exp-persistent-nodemap=yes |
|
11 | 11 | > EOF |
|
12 | 12 | $ hg debugbuilddag .+5000 |
|
13 | $ hg debugnodemap --dump | f --sha256 --size | |
|
13 | $ hg debugnodemap --dump-new | f --sha256 --size | |
|
14 | 14 | size=122880, sha256=b961925120e1c9bc345c199b2cc442abc477029fdece37ef9d99cbe59c0558b7 |
|
15 |
$ f --sha256 --bytes=256 --hexdump --size |
|
|
15 | $ hg debugnodemap --dump-disk | f --sha256 --bytes=256 --hexdump --size | |
|
16 | 16 | size=122880, sha256=b961925120e1c9bc345c199b2cc442abc477029fdece37ef9d99cbe59c0558b7 |
|
17 | 17 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
18 | 18 | 0010: ff ff ff ff ff ff ff ff ff ff fa c2 ff ff ff ff |................| |
General Comments 0
You need to be logged in to leave comments.
Login now