debugdirstate: deprecate --nodates in favor of --no-dates
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 20 Sep 2018 21:35:01 -0700
changeset 39760 7e99b02768ef
parent 39759 aeb2812f304d
child 39761 4675c122157e
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
mercurial/debugcommands.py
tests/test-backout.t
tests/test-completion.t
tests/test-filebranch.t
tests/test-largefiles-update.t
tests/test-largefiles.t
tests/test-merge-remove.t
tests/test-narrow-commit.t
tests/test-rebuildstate.t
tests/test-sparse.t
--- a/mercurial/debugcommands.py	Fri Sep 21 00:37:03 2018 -0400
+++ b/mercurial/debugcommands.py	Thu Sep 20 21:35:01 2018 -0700
@@ -733,13 +733,16 @@
     fm.end()
 
 @command('debugdirstate|debugstate',
-    [('', 'nodates', None, _('do not display the saved mtime')),
-    ('', 'datesort', None, _('sort by saved mtime'))],
+    [('', 'nodates', None, _('do not display the saved mtime (DEPRECATED)')),
+     ('', 'dates', True, _('display the saved mtime')),
+     ('', 'datesort', None, _('sort by saved mtime'))],
     _('[OPTION]...'))
 def debugstate(ui, repo, **opts):
     """show the contents of the current dirstate"""
 
-    nodates = opts.get(r'nodates')
+    nodates = not opts[r'dates']
+    if opts.get(r'nodates') is not None:
+        nodates = True
     datesort = opts.get(r'datesort')
 
     timestr = ""
--- a/tests/test-backout.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-backout.t	Thu Sep 20 21:35:01 2018 -0700
@@ -144,7 +144,7 @@
   $ touch -t 200001010000 c
   $ hg status -A
   C c
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   n 644         12 set                 c
   $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r .
   removing c
@@ -154,7 +154,7 @@
   $ hg status -A
   A b
   R c
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   a   0         -1 unset               b
   r   0          0 set                 c
 
--- a/tests/test-completion.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-completion.t	Thu Sep 20 21:35:01 2018 -0700
@@ -271,7 +271,7 @@
   debugdata: changelog, manifest, dir
   debugdate: extended
   debugdeltachain: changelog, manifest, dir, template
-  debugdirstate: nodates, datesort
+  debugdirstate: nodates, dates, datesort
   debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
   debugdownload: output
   debugextensions: template
--- a/tests/test-filebranch.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-filebranch.t	Thu Sep 20 21:35:01 2018 -0700
@@ -41,7 +41,7 @@
 
 We shouldn't have anything but n state here:
 
-  $ hg debugstate --nodates | grep -v "^n"
+  $ hg debugstate --no-dates | grep -v "^n"
   [1]
 
 Merging:
--- a/tests/test-largefiles-update.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-largefiles-update.t	Thu Sep 20 21:35:01 2018 -0700
@@ -412,7 +412,7 @@
   $ hg update -q 5
   remote turned local largefile large2 into a normal file
   keep (l)argefile or use (n)ormal file? l
-  $ hg debugdirstate --nodates | grep large2
+  $ hg debugdirstate --no-dates | grep large2
   a   0         -1 unset               .hglf/large2
   r   0          0 set                 large2
   $ hg status -A large2
@@ -428,7 +428,7 @@
   $ hg update -q 5
   remote turned local largefile large3 into a normal file
   keep (l)argefile or use (n)ormal file? l
-  $ hg debugdirstate --nodates | grep large3
+  $ hg debugdirstate --no-dates | grep large3
   a   0         -1 unset               .hglf/large3
   r   0          0 set                 large3
   $ hg status -A large3
--- a/tests/test-largefiles.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-largefiles.t	Thu Sep 20 21:35:01 2018 -0700
@@ -43,12 +43,12 @@
   $ touch large1 sub/large2
   $ sleep 1
   $ hg st
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   n 644         41 set                 .hglf/large1
   n 644         41 set                 .hglf/sub/large2
   n 644          8 set                 normal1
   n 644          8 set                 sub/normal2
-  $ hg debugstate --large --nodates
+  $ hg debugstate --large --no-dates
   n 644          7 set                 large1
   n 644          7 set                 sub/large2
   $ echo normal11 > normal1
--- a/tests/test-merge-remove.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-merge-remove.t	Thu Sep 20 21:35:01 2018 -0700
@@ -20,7 +20,7 @@
   1 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   m   0         -2 unset               bar
   m   0         -2 unset               foo1
   copy: foo -> foo1
@@ -36,7 +36,7 @@
   $ cp bar B
   $ hg rm -f foo1 bar
 
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   r   0         -1 set                 bar
   r   0         -1 set                 foo1
   copy: foo -> foo1
@@ -54,7 +54,7 @@
   adding bar
   adding foo1
 
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   n   0         -2 unset               bar
   n   0         -2 unset               foo1
   copy: foo -> foo1
@@ -73,7 +73,7 @@
   reverting bar
   reverting foo1
 
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   n   0         -2 unset               bar
   n   0         -2 unset               foo1
   copy: foo -> foo1
--- a/tests/test-narrow-commit.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-narrow-commit.t	Thu Sep 20 21:35:01 2018 -0700
@@ -103,5 +103,5 @@
 debugdirstate. If we don't do this, the test can be slightly flaky.
   $ sleep 3
   $ hg status
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   n 644         10 set                 inside/f1
--- a/tests/test-rebuildstate.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-rebuildstate.t	Thu Sep 20 21:35:01 2018 -0700
@@ -47,14 +47,14 @@
 
 state dump after
 
-  $ hg debugstate --nodates | sort
+  $ hg debugstate --no-dates | sort
   n   0         -1 unset               bar
   n   0         -1 unset               foo
 
   $ hg debugadddrop --normal-lookup file1 file2
   $ hg debugadddrop --drop bar
   $ hg debugadddrop --drop
-  $ hg debugstate --nodates
+  $ hg debugstate --no-dates
   n   0         -1 unset               file1
   n   0         -1 unset               file2
   n   0         -1 unset               foo
@@ -78,13 +78,13 @@
   ? baz
   C foo
   $ hg debugadddrop --normal-lookup baz
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   r   0          0 * bar (glob)
   n   0         -1 * baz (glob)
   n 644          0 * foo (glob)
   a   0         -1 * qux (glob)
   $ hg debugrebuilddirstate --minimal
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   r   0          0 * bar (glob)
   n 644          0 * foo (glob)
   a   0         -1 * qux (glob)
@@ -104,16 +104,16 @@
   R bar
   ? baz
   C foo
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   r   0          0 * bar (glob)
   n 644          0 * foo (glob)
   a   0         -1 * qux (glob)
   $ hg debugadddrop --drop foo
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   r   0          0 * bar (glob)
   a   0         -1 * qux (glob)
   $ hg debugrebuilddirstate --minimal
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   r   0          0 * bar (glob)
   n   0         -1 * foo (glob)
   a   0         -1 * qux (glob)
--- a/tests/test-sparse.t	Fri Sep 21 00:37:03 2018 -0400
+++ b/tests/test-sparse.t	Thu Sep 20 21:35:01 2018 -0700
@@ -385,10 +385,10 @@
   $ cp ../dirstateallexcluded .hg/dirstate
   $ touch includedadded
   $ hg add includedadded
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   a   0         -1 unset               includedadded
   $ hg debugrebuilddirstate --minimal
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   n   0         -1 unset               included
   a   0         -1 * includedadded (glob)
 
@@ -410,13 +410,13 @@
   included
 We have files in the dirstate that are included and excluded. Some are in the
 manifest and some are not.
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   n 644          0 * excluded (glob)
   a   0         -1 * excludednomanifest (glob)
   n 644          0 * included (glob)
   a   0         -1 * includedadded (glob)
   $ hg debugrebuilddirstate --minimal
-  $ hg debugdirstate --nodates
+  $ hg debugdirstate --no-dates
   n 644          0 * included (glob)
   a   0         -1 * includedadded (glob)