config: graduate experimental.updatecheck to commands.update.check
authorAugie Fackler <augie@google.com>
Sat, 14 Oct 2017 03:13:50 -0400
changeset 34705 23ed47a895d5
parent 34704 c51380879054
child 34706 8782076874f5
config: graduate experimental.updatecheck to commands.update.check .. feature:: New `commands.update.check` feature to adjust constraints on when `hg update` will allow updates with a dirty working copy. also .. bc:: The `experimental.updatecheck` name for the new `commands.update.check` feature is now deprecated, and will be removed after this release. Differential Revision: https://phab.mercurial-scm.org/D1070
mercurial/configitems.py
mercurial/help/config.txt
mercurial/hg.py
tests/test-pull-update.t
tests/test-update-branches.t
--- a/mercurial/configitems.py	Sat Oct 14 15:42:38 2017 -0400
+++ b/mercurial/configitems.py	Sat Oct 14 03:13:50 2017 -0400
@@ -179,6 +179,9 @@
 coreconfigitem('commands', 'status.verbose',
     default=False,
 )
+coreconfigitem('commands', 'update.check',
+    default=None,
+)
 coreconfigitem('commands', 'update.requiredest',
     default=False,
 )
@@ -409,6 +412,7 @@
 coreconfigitem('experimental', 'treemanifest',
     default=False,
 )
+# Deprecated, remove after 4.4 release
 coreconfigitem('experimental', 'updatecheck',
     default=None,
 )
--- a/mercurial/help/config.txt	Sat Oct 14 15:42:38 2017 -0400
+++ b/mercurial/help/config.txt	Sat Oct 14 03:13:50 2017 -0400
@@ -442,6 +442,18 @@
     Make paths in :hg:`status` output relative to the current directory.
     (default: False)
 
+``update.check``
+    Determines what level of checking :hg:`update` will perform before moving
+    to a destination revision. Valid values are ``abort``, ``none``,
+    ``linear``, and ``noconflict``. ``abort`` always fails if the working
+    directory has uncommitted changes. ``none`` performs no checking, and may
+    result in a merge with uncommitted changes. ``linear`` allows any update
+    as long as it follows a straight line in the revision history, and may
+    trigger a merge with uncommitted changes. ``noconflict`` will allow any
+    update which would not trigger a merge with uncommitted changes, if any
+    are present.
+    (default: ``linear``)
+
 ``update.requiredest``
     Require that the user pass a destination when running :hg:`update`.
     For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
--- a/mercurial/hg.py	Sat Oct 14 15:42:38 2017 -0400
+++ b/mercurial/hg.py	Sat Oct 14 03:13:50 2017 -0400
@@ -757,7 +757,10 @@
     This returns whether conflict is detected at updating or not.
     """
     if updatecheck is None:
-        updatecheck = ui.config('experimental', 'updatecheck')
+        updatecheck = ui.config('commands', 'update.check')
+        if updatecheck is None:
+            # pre-4.4 compat on the old spelling of this config item
+            updatecheck = ui.config('experimental', 'updatecheck')
         if updatecheck not in ('abort', 'none', 'linear', 'noconflict'):
             # If not configured, or invalid value configured
             updatecheck = 'linear'
--- a/tests/test-pull-update.t	Sat Oct 14 15:42:38 2017 -0400
+++ b/tests/test-pull-update.t	Sat Oct 14 03:13:50 2017 -0400
@@ -19,7 +19,7 @@
 Should respect config to disable dirty update
   $ hg co -qC 0
   $ echo 2 > foo
-  $ hg --config experimental.updatecheck=abort pull -u ../tt
+  $ hg --config commands.update.check=abort pull -u ../tt
   pulling from ../tt
   searching for changes
   adding changesets
--- a/tests/test-update-branches.t	Sat Oct 14 15:42:38 2017 -0400
+++ b/tests/test-update-branches.t	Sat Oct 14 03:13:50 2017 -0400
@@ -198,8 +198,8 @@
   parent=1
   M foo
 
-  $ echo '[experimental]' >> .hg/hgrc
-  $ echo 'updatecheck = abort' >> .hg/hgrc
+  $ echo '[commands]' >> .hg/hgrc
+  $ echo 'update.check = abort' >> .hg/hgrc
 
   $ revtest 'none dirty linear' dirty 1 2
   abort: uncommitted changes
@@ -215,7 +215,7 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   parent=2
 
-  $ echo 'updatecheck = none' >> .hg/hgrc
+  $ echo 'update.check = none' >> .hg/hgrc
 
   $ revtest 'none dirty cross'  dirty 3 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -258,7 +258,7 @@
   >>>>>>> destination:  d047485b3896 b1 - test: 4
   $ rm a.orig
 
-  $ echo 'updatecheck = noconflict' >> .hg/hgrc
+  $ echo 'update.check = noconflict' >> .hg/hgrc
 
   $ revtest 'none dirty cross'  dirty 3 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -315,7 +315,7 @@
   $ hg up -q 4
 
 Uses default value of "linear" when value is misspelled
-  $ echo 'updatecheck = linyar' >> .hg/hgrc
+  $ echo 'update.check = linyar' >> .hg/hgrc
 
   $ revtest 'dirty cross'  dirty 3 4
   abort: uncommitted changes