plain: ignore [commands] config
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 21 Mar 2017 21:26:52 -0700
changeset 31588 37a0ad669051
parent 31586 df82f375fa00
child 31589 7e3b145f8247
plain: ignore [commands] config We only have commands.{update,rebase}.requiredest so far. We should clearly ignore those two if HGPLAIN is in effect, and it seems like we should ignore any future config that will be added in [commands] since that is about changing the behavior of commands. Thanks to Yuya for suggesting to centralize the code in ui.py. While at it, remove the unnecessary False values passed to ui.configbool() for the aforementioned config options.
hgext/rebase.py
mercurial/commands.py
mercurial/ui.py
tests/test-rebase-base.t
tests/test-update-names.t
--- a/hgext/rebase.py	Tue Mar 21 23:30:13 2017 +0100
+++ b/hgext/rebase.py	Tue Mar 21 21:26:52 2017 -0700
@@ -686,7 +686,7 @@
         # Validate input and define rebasing points
         destf = opts.get('dest', None)
 
-        if ui.config('commands', 'rebase.requiredest', False):
+        if ui.config('commands', 'rebase.requiredest'):
             if not destf:
                 raise error.Abort(_('you must specify a destination'),
                                   hint=_('use: hg rebase -d REV'))
--- a/mercurial/commands.py	Tue Mar 21 23:30:13 2017 +0100
+++ b/mercurial/commands.py	Tue Mar 21 21:26:52 2017 -0700
@@ -5349,7 +5349,7 @@
     if rev and node:
         raise error.Abort(_("please specify just one revision"))
 
-    if ui.configbool('commands', 'update.requiredest', False):
+    if ui.configbool('commands', 'update.requiredest'):
         if not node and not rev and not date:
             raise error.Abort(_('you must specify a destination'),
                               hint=_('for example: hg update ".::"'))
--- a/mercurial/ui.py	Tue Mar 21 23:30:13 2017 +0100
+++ b/mercurial/ui.py	Tue Mar 21 21:26:52 2017 -0700
@@ -284,6 +284,8 @@
                     del cfg['ui'][k]
             for k, v in cfg.items('defaults'):
                 del cfg['defaults'][k]
+            for k, v in cfg.items('commands'):
+                del cfg['commands'][k]
         # Don't remove aliases from the configuration if in the exceptionlist
         if self.plain('alias'):
             for k, v in cfg.items('alias'):
--- a/tests/test-rebase-base.t	Tue Mar 21 23:30:13 2017 +0100
+++ b/tests/test-rebase-base.t	Tue Mar 21 21:26:52 2017 -0700
@@ -413,3 +413,7 @@
   $ hg rebase -d 1
   rebasing 2:5db65b93a12b "cc" (tip)
   saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5db65b93a12b-4fb789ec-backup.hg (glob)
+  $ hg rebase -d 0 -r . -q
+  $ HGPLAIN=1 hg rebase
+  rebasing 2:889b0bc6a730 "cc" (tip)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/889b0bc6a730-41ec4f81-backup.hg (glob)
--- a/tests/test-update-names.t	Tue Mar 21 23:30:13 2017 +0100
+++ b/tests/test-update-names.t	Tue Mar 21 21:26:52 2017 -0700
@@ -104,3 +104,5 @@
   [255]
   $ hg up .
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ HGPLAIN=1 hg up
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved