Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 47357:3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
`hg debugdirstate --dirs` also shows information stored in the dirstate
(for `read_dir` caching) about directories.
Differential Revision: https://phab.mercurial-scm.org/D10828
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 31 May 2021 19:54:41 +0200 |
parents | e96f75857361 |
children | 7a430116f639 |
comparison
equal
deleted
inserted
replaced
47356:04d1f17f49e7 | 47357:3b9914b28133 |
---|---|
939 None, | 939 None, |
940 _(b'do not display the saved mtime (DEPRECATED)'), | 940 _(b'do not display the saved mtime (DEPRECATED)'), |
941 ), | 941 ), |
942 (b'', b'dates', True, _(b'display the saved mtime')), | 942 (b'', b'dates', True, _(b'display the saved mtime')), |
943 (b'', b'datesort', None, _(b'sort by saved mtime')), | 943 (b'', b'datesort', None, _(b'sort by saved mtime')), |
944 (b'', b'dirs', False, _(b'display directories')), | |
944 ], | 945 ], |
945 _(b'[OPTION]...'), | 946 _(b'[OPTION]...'), |
946 ) | 947 ) |
947 def debugstate(ui, repo, **opts): | 948 def debugstate(ui, repo, **opts): |
948 """show the contents of the current dirstate""" | 949 """show the contents of the current dirstate""" |
954 | 955 |
955 if datesort: | 956 if datesort: |
956 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | 957 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
957 else: | 958 else: |
958 keyfunc = None # sort by filename | 959 keyfunc = None # sort by filename |
959 for file_, ent in sorted(pycompat.iteritems(repo.dirstate), key=keyfunc): | 960 entries = list(pycompat.iteritems(repo.dirstate)) |
961 if opts['dirs']: | |
962 entries.extend(repo.dirstate.directories()) | |
963 entries.sort(key=keyfunc) | |
964 for file_, ent in entries: | |
960 if ent[3] == -1: | 965 if ent[3] == -1: |
961 timestr = b'unset ' | 966 timestr = b'unset ' |
962 elif nodates: | 967 elif nodates: |
963 timestr = b'set ' | 968 timestr = b'set ' |
964 else: | 969 else: |