comparison mercurial/debugcommands.py @ 39776:7e99b02768ef

debugdirstate: deprecate --nodates in favor of --no-dates We have supported 'no-' prefixes for boolean flag for a few years now, so I was expecting it to be --no-dates. I noticed that we have --nodates options for a few more commands (e.g. `hg diff`), but I'll leave that for another day. Differential Revision: https://phab.mercurial-scm.org/D4693
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 20 Sep 2018 21:35:01 -0700
parents d06834e0f48e
children 24e493ec2229
comparison
equal deleted inserted replaced
39775:aeb2812f304d 39776:7e99b02768ef
731 fm.plain('\n') 731 fm.plain('\n')
732 732
733 fm.end() 733 fm.end()
734 734
735 @command('debugdirstate|debugstate', 735 @command('debugdirstate|debugstate',
736 [('', 'nodates', None, _('do not display the saved mtime')), 736 [('', 'nodates', None, _('do not display the saved mtime (DEPRECATED)')),
737 ('', 'datesort', None, _('sort by saved mtime'))], 737 ('', 'dates', True, _('display the saved mtime')),
738 ('', 'datesort', None, _('sort by saved mtime'))],
738 _('[OPTION]...')) 739 _('[OPTION]...'))
739 def debugstate(ui, repo, **opts): 740 def debugstate(ui, repo, **opts):
740 """show the contents of the current dirstate""" 741 """show the contents of the current dirstate"""
741 742
742 nodates = opts.get(r'nodates') 743 nodates = not opts[r'dates']
744 if opts.get(r'nodates') is not None:
745 nodates = True
743 datesort = opts.get(r'datesort') 746 datesort = opts.get(r'datesort')
744 747
745 timestr = "" 748 timestr = ""
746 if datesort: 749 if datesort:
747 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename 750 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename