diff mercurial/debugcommands.py @ 47351: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
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Mon May 31 18:35:44 2021 +0200
+++ b/mercurial/debugcommands.py	Mon May 31 19:54:41 2021 +0200
@@ -941,6 +941,7 @@
         ),
         (b'', b'dates', True, _(b'display the saved mtime')),
         (b'', b'datesort', None, _(b'sort by saved mtime')),
+        (b'', b'dirs', False, _(b'display directories')),
     ],
     _(b'[OPTION]...'),
 )
@@ -956,7 +957,11 @@
         keyfunc = lambda x: (x[1][3], x[0])  # sort by mtime, then by filename
     else:
         keyfunc = None  # sort by filename
-    for file_, ent in sorted(pycompat.iteritems(repo.dirstate), key=keyfunc):
+    entries = list(pycompat.iteritems(repo.dirstate))
+    if opts['dirs']:
+        entries.extend(repo.dirstate.directories())
+    entries.sort(key=keyfunc)
+    for file_, ent in entries:
         if ent[3] == -1:
             timestr = b'unset               '
         elif nodates: