diff mercurial/hg.py @ 31167:696e321b304d

update: add experimental config for default way of handling dirty wdir This allows the user to set e.g. experimental.updatecheck=abort to abort update if the working directory is dirty, but still be able to override the behavior with e.g. --merge when needed. I considered adding a --mergelinear option to get back the old behavior even when experimental.updatecheck=abort is set, but I couldn't see why anyone would prefer that over --merge. The default is read in hg.updatetotally(), which means it also applies to "hg pull -u" and "hg unbundle -u".
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 13 Feb 2017 16:03:05 -0800
parents fad5e299cfc7
children 41a9edc5d00f
line wrap: on
line diff
--- a/mercurial/hg.py	Mon Feb 13 12:58:37 2017 -0800
+++ b/mercurial/hg.py	Mon Feb 13 16:03:05 2017 -0800
@@ -747,7 +747,10 @@
     This returns whether conflict is detected at updating or not.
     """
     if updatecheck is None:
-        updatecheck = 'linear'
+        updatecheck = ui.config('experimental', 'updatecheck')
+        if updatecheck not in ('abort', 'none', 'linear'):
+            # If not configured, or invalid value configured
+            updatecheck = 'linear'
     with repo.wlock():
         movemarkfrom = None
         warndest = False