937 ), |
938 ), |
938 (b'', b'dates', True, _(b'display the saved mtime')), |
939 (b'', b'dates', True, _(b'display the saved mtime')), |
939 (b'', b'datesort', None, _(b'sort by saved mtime')), |
940 (b'', b'datesort', None, _(b'sort by saved mtime')), |
940 ( |
941 ( |
941 b'', |
942 b'', |
|
943 b'docket', |
|
944 False, |
|
945 _(b'display the docket (metadata file) instead'), |
|
946 ), |
|
947 ( |
|
948 b'', |
942 b'all', |
949 b'all', |
943 False, |
950 False, |
944 _(b'display dirstate-v2 tree nodes that would not exist in v1'), |
951 _(b'display dirstate-v2 tree nodes that would not exist in v1'), |
945 ), |
952 ), |
946 ], |
953 ], |
947 _(b'[OPTION]...'), |
954 _(b'[OPTION]...'), |
948 ) |
955 ) |
949 def debugstate(ui, repo, **opts): |
956 def debugstate(ui, repo, **opts): |
950 """show the contents of the current dirstate""" |
957 """show the contents of the current dirstate""" |
|
958 |
|
959 if opts.get("docket"): |
|
960 if not repo.dirstate._use_dirstate_v2: |
|
961 raise error.Abort(_(b'dirstate v1 does not have a docket')) |
|
962 |
|
963 docket = repo.dirstate._map.docket |
|
964 ( |
|
965 start_offset, |
|
966 root_nodes, |
|
967 nodes_with_entry, |
|
968 nodes_with_copy, |
|
969 unused_bytes, |
|
970 _unused, |
|
971 ignore_pattern, |
|
972 ) = dirstateutils.v2.TREE_METADATA.unpack(docket.tree_metadata) |
|
973 |
|
974 ui.write(_(b"size of dirstate data: %d\n") % docket.data_size) |
|
975 ui.write(_(b"data file uuid: %s\n") % docket.uuid) |
|
976 ui.write(_(b"start offset of root nodes: %d\n") % start_offset) |
|
977 ui.write(_(b"number of root nodes: %d\n") % root_nodes) |
|
978 ui.write(_(b"nodes with entries: %d\n") % nodes_with_entry) |
|
979 ui.write(_(b"nodes with copies: %d\n") % nodes_with_copy) |
|
980 ui.write(_(b"number of unused bytes: %d\n") % unused_bytes) |
|
981 ui.write( |
|
982 _(b"ignore pattern hash: %s\n") % binascii.hexlify(ignore_pattern) |
|
983 ) |
|
984 return |
951 |
985 |
952 nodates = not opts['dates'] |
986 nodates = not opts['dates'] |
953 if opts.get('nodates') is not None: |
987 if opts.get('nodates') is not None: |
954 nodates = True |
988 nodates = True |
955 datesort = opts.get('datesort') |
989 datesort = opts.get('datesort') |
978 else: |
1012 else: |
979 mode = b'%3o' % (mode & 0o777 & ~util.umask) |
1013 mode = b'%3o' % (mode & 0o777 & ~util.umask) |
980 ui.write(b"%c %s %10d %s%s\n" % (state, mode, size, timestr, filename)) |
1014 ui.write(b"%c %s %10d %s%s\n" % (state, mode, size, timestr, filename)) |
981 for f in repo.dirstate.copies(): |
1015 for f in repo.dirstate.copies(): |
982 ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
1016 ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
983 |
|
984 |
|
985 @command( |
|
986 b'debugdirstateignorepatternshash', |
|
987 [], |
|
988 _(b''), |
|
989 ) |
|
990 def debugdirstateignorepatternshash(ui, repo, **opts): |
|
991 """show the hash of ignore patterns stored in dirstate if v2, |
|
992 or nothing for dirstate-v2 |
|
993 """ |
|
994 if repo.dirstate._use_dirstate_v2: |
|
995 docket = repo.dirstate._map.docket |
|
996 hash_len = 20 # 160 bits for SHA-1 |
|
997 hash_bytes = docket.tree_metadata[-hash_len:] |
|
998 ui.write(binascii.hexlify(hash_bytes) + b'\n') |
|
999 |
1017 |
1000 |
1018 |
1001 @command( |
1019 @command( |
1002 b'debugdiscovery', |
1020 b'debugdiscovery', |
1003 [ |
1021 [ |