mercurial/debugcommands.py
branchstable
changeset 49152 eaaf4f98c9f1
parent 49048 020378f32d57
child 49153 308e45f7b455
equal deleted inserted replaced
49151:1b6e381521c5 49152:eaaf4f98c9f1
    45     cmdutil,
    45     cmdutil,
    46     color,
    46     color,
    47     context,
    47     context,
    48     copies,
    48     copies,
    49     dagparser,
    49     dagparser,
       
    50     dirstateutils,
    50     encoding,
    51     encoding,
    51     error,
    52     error,
    52     exchange,
    53     exchange,
    53     extensions,
    54     extensions,
    54     filemerge,
    55     filemerge,
   938         ),
   939         ),
   939         (b'', b'dates', True, _(b'display the saved mtime')),
   940         (b'', b'dates', True, _(b'display the saved mtime')),
   940         (b'', b'datesort', None, _(b'sort by saved mtime')),
   941         (b'', b'datesort', None, _(b'sort by saved mtime')),
   941         (
   942         (
   942             b'',
   943             b'',
       
   944             b'docket',
       
   945             False,
       
   946             _(b'display the docket (metadata file) instead'),
       
   947         ),
       
   948         (
       
   949             b'',
   943             b'all',
   950             b'all',
   944             False,
   951             False,
   945             _(b'display dirstate-v2 tree nodes that would not exist in v1'),
   952             _(b'display dirstate-v2 tree nodes that would not exist in v1'),
   946         ),
   953         ),
   947     ],
   954     ],
   948     _(b'[OPTION]...'),
   955     _(b'[OPTION]...'),
   949 )
   956 )
   950 def debugstate(ui, repo, **opts):
   957 def debugstate(ui, repo, **opts):
   951     """show the contents of the current dirstate"""
   958     """show the contents of the current dirstate"""
       
   959 
       
   960     if opts.get("docket"):
       
   961         if not repo.dirstate._use_dirstate_v2:
       
   962             raise error.Abort(_(b'dirstate v1 does not have a docket'))
       
   963 
       
   964         docket = repo.dirstate._map.docket
       
   965         (
       
   966             start_offset,
       
   967             root_nodes,
       
   968             nodes_with_entry,
       
   969             nodes_with_copy,
       
   970             unused_bytes,
       
   971             _unused,
       
   972             ignore_pattern,
       
   973         ) = dirstateutils.v2.TREE_METADATA.unpack(docket.tree_metadata)
       
   974 
       
   975         ui.write(_(b"size of dirstate data: %d\n") % docket.data_size)
       
   976         ui.write(_(b"data file uuid: %s\n") % docket.uuid)
       
   977         ui.write(_(b"start offset of root nodes: %d\n") % start_offset)
       
   978         ui.write(_(b"number of root nodes: %d\n") % root_nodes)
       
   979         ui.write(_(b"nodes with entries: %d\n") % nodes_with_entry)
       
   980         ui.write(_(b"nodes with copies: %d\n") % nodes_with_copy)
       
   981         ui.write(_(b"number of unused bytes: %d\n") % unused_bytes)
       
   982         ui.write(
       
   983             _(b"ignore pattern hash: %s\n") % binascii.hexlify(ignore_pattern)
       
   984         )
       
   985         return
   952 
   986 
   953     nodates = not opts['dates']
   987     nodates = not opts['dates']
   954     if opts.get('nodates') is not None:
   988     if opts.get('nodates') is not None:
   955         nodates = True
   989         nodates = True
   956     datesort = opts.get('datesort')
   990     datesort = opts.get('datesort')