D1070: config: graduate experimental.updatecheck to commands.update.check

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sat Oct 14 16:34:08 EDT 2017


durin42 updated this revision to Diff 2745.
durin42 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1070?vs=2727&id=2745

REVISION DETAIL
  https://phab.mercurial-scm.org/D1070

AFFECTED FILES
  mercurial/configitems.py
  mercurial/help/config.txt
  mercurial/hg.py
  tests/test-pull-update.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -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
diff --git a/tests/test-pull-update.t b/tests/test-pull-update.t
--- a/tests/test-pull-update.t
+++ b/tests/test-pull-update.t
@@ -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
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -757,10 +757,13 @@
     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 not in ('abort', 'none', 'linear', 'noconflict'):
-            # If not configured, or invalid value configured
-            updatecheck = 'linear'
+            # 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'
     with repo.wlock():
         movemarkfrom = None
         warndest = False
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -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`
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -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,
 )



To: durin42, #hg-reviewers, lothiraldan
Cc: lothiraldan, morisgi, mercurial-devel


More information about the Mercurial-devel mailing list