mercurial/debugcommands.py
changeset 47351 3b9914b28133
parent 47298 e96f75857361
child 47437 7a430116f639
equal deleted inserted replaced
47350:04d1f17f49e7 47351: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: