comparison mercurial/debugcommands.py @ 47683:284a20269a97

dirstate-v2: Separate iterators for dirfoldmap and debugdirstate `dirstatemap.dirfoldmap` was recently changed to re-use a Rust iterator that was added for the `hg debugdirstate` command. That iterator was based on all nodes in the tree dirstate without an entry only existing to hold child nodes, and therefore being directories. However to optimize status further we may want to store additional nodes for unknown or ignored files and directories. At that point the two users of this iterator will want different things, so let?s make two iterators instead. See doc-comments in `dispatch.rs`. Differential Revision: https://phab.mercurial-scm.org/D11099
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 16 Jul 2021 14:08:26 +0200
parents 78f7f0d490ee
children b30a53ffbf9b
comparison
equal deleted inserted replaced
47682:78f7f0d490ee 47683:284a20269a97
940 None, 940 None,
941 _(b'do not display the saved mtime (DEPRECATED)'), 941 _(b'do not display the saved mtime (DEPRECATED)'),
942 ), 942 ),
943 (b'', b'dates', True, _(b'display the saved mtime')), 943 (b'', b'dates', True, _(b'display the saved mtime')),
944 (b'', b'datesort', None, _(b'sort by saved mtime')), 944 (b'', b'datesort', None, _(b'sort by saved mtime')),
945 (b'', b'dirs', False, _(b'display directories')), 945 (
946 b'',
947 b'all',
948 False,
949 _(b'display dirstate-v2 tree nodes that would not exist in v1'),
950 ),
946 ], 951 ],
947 _(b'[OPTION]...'), 952 _(b'[OPTION]...'),
948 ) 953 )
949 def debugstate(ui, repo, **opts): 954 def debugstate(ui, repo, **opts):
950 """show the contents of the current dirstate""" 955 """show the contents of the current dirstate"""
959 x[1].v1_mtime(), 964 x[1].v1_mtime(),
960 x[0], 965 x[0],
961 ) # sort by mtime, then by filename 966 ) # sort by mtime, then by filename
962 else: 967 else:
963 keyfunc = None # sort by filename 968 keyfunc = None # sort by filename
964 entries = list(pycompat.iteritems(repo.dirstate)) 969 if opts['all']:
965 if opts['dirs']: 970 entries = list(repo.dirstate._map.debug_iter())
966 entries.extend(repo.dirstate.directories()) 971 else:
972 entries = list(pycompat.iteritems(repo.dirstate))
967 entries.sort(key=keyfunc) 973 entries.sort(key=keyfunc)
968 for file_, ent in entries: 974 for file_, ent in entries:
969 if ent.v1_mtime() == -1: 975 if ent.v1_mtime() == -1:
970 timestr = b'unset ' 976 timestr = b'unset '
971 elif nodates: 977 elif nodates: