##// END OF EJS Templates
cli: make debugnodemap capable of inspecting an arbitrary nodemap...
Arseniy Alekseyev -
r51402:1b73868d default
parent child Browse files
Show More
@@ -50,6 +50,7 b' from . import ('
50 50 error,
51 51 exchange,
52 52 extensions,
53 filelog,
53 54 filemerge,
54 55 filesetlang,
55 56 formatter,
@@ -58,6 +59,7 b' from . import ('
58 59 localrepo,
59 60 lock as lockmod,
60 61 logcmdutil,
62 manifest,
61 63 mergestate as mergestatemod,
62 64 metadata,
63 65 obsolete,
@@ -2600,56 +2602,62 b' def debugnamecomplete(ui, repo, *args):'
2600 2602
2601 2603 @command(
2602 2604 b'debugnodemap',
2603 [
2604 (
2605 b'',
2606 b'dump-new',
2607 False,
2608 _(b'write a (new) persistent binary nodemap on stdout'),
2609 ),
2610 (b'', b'dump-disk', False, _(b'dump on-disk data on stdout')),
2611 (
2612 b'',
2613 b'check',
2614 False,
2615 _(b'check that the data on disk data are correct.'),
2616 ),
2617 (
2618 b'',
2619 b'metadata',
2620 False,
2621 _(b'display the on disk meta data for the nodemap'),
2622 ),
2623 ],
2605 (
2606 cmdutil.debugrevlogopts
2607 + [
2608 (
2609 b'',
2610 b'dump-new',
2611 False,
2612 _(b'write a (new) persistent binary nodemap on stdout'),
2613 ),
2614 (b'', b'dump-disk', False, _(b'dump on-disk data on stdout')),
2615 (
2616 b'',
2617 b'check',
2618 False,
2619 _(b'check that the data on disk data are correct.'),
2620 ),
2621 (
2622 b'',
2623 b'metadata',
2624 False,
2625 _(b'display the on disk meta data for the nodemap'),
2626 ),
2627 ]
2628 ),
2629 _(b'-c|-m|FILE REV'),
2624 2630 )
2625 def debugnodemap(ui, repo, **opts):
2631 def debugnodemap(ui, repo, file_=None, **opts):
2626 2632 """write and inspect on disk nodemap"""
2633 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
2634 if file_ is not None:
2635 raise error.CommandError(b'debugnodemap', _(b'invalid arguments'))
2636 elif file_ is None:
2637 opts['changelog'] = True
2638 r = cmdutil.openstorage(
2639 repo.unfiltered(), b'debugnodemap', file_, pycompat.byteskwargs(opts)
2640 )
2641 if isinstance(r, manifest.manifestrevlog) or isinstance(r, filelog.filelog):
2642 r = r._revlog
2627 2643 if opts['dump_new']:
2628 unfi = repo.unfiltered()
2629 cl = unfi.changelog
2630 if util.safehasattr(cl.index, "nodemap_data_all"):
2631 data = cl.index.nodemap_data_all()
2644 if util.safehasattr(r.index, "nodemap_data_all"):
2645 data = r.index.nodemap_data_all()
2632 2646 else:
2633 data = nodemap.persistent_data(cl.index)
2647 data = nodemap.persistent_data(r.index)
2634 2648 ui.write(data)
2635 2649 elif opts['dump_disk']:
2636 unfi = repo.unfiltered()
2637 cl = unfi.changelog
2638 nm_data = nodemap.persisted_data(cl)
2650 nm_data = nodemap.persisted_data(r)
2639 2651 if nm_data is not None:
2640 2652 docket, data = nm_data
2641 2653 ui.write(data[:])
2642 2654 elif opts['check']:
2643 unfi = repo.unfiltered()
2644 cl = unfi.changelog
2645 nm_data = nodemap.persisted_data(cl)
2655 nm_data = nodemap.persisted_data(r)
2646 2656 if nm_data is not None:
2647 2657 docket, data = nm_data
2648 return nodemap.check_data(ui, cl.index, data)
2658 return nodemap.check_data(ui, r.index, data)
2649 2659 elif opts['metadata']:
2650 unfi = repo.unfiltered()
2651 cl = unfi.changelog
2652 nm_data = nodemap.persisted_data(cl)
2660 nm_data = nodemap.persisted_data(r)
2653 2661 if nm_data is not None:
2654 2662 docket, data = nm_data
2655 2663 ui.write((b"uid: %s\n") % docket.uid)
@@ -311,7 +311,7 b' Show all commands + options'
311 311 debugmanifestfulltextcache: clear, add
312 312 debugmergestate: style, template
313 313 debugnamecomplete:
314 debugnodemap: dump-new, dump-disk, check, metadata
314 debugnodemap: changelog, manifest, dir, dump-new, dump-disk, check, metadata
315 315 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
316 316 debugp1copies: rev
317 317 debugp2copies: rev
General Comments 0
You need to be logged in to leave comments. Login now