changeset 32892:a7851519ea02

check-concurrency: expose the feature as 'concurrent-push-mode' We move the feature to a proper configuration and document it. The config goes in the 'server' section because it feels like something the server owner would want to decide. We pick and open field because it seems likely that other checking levels will emerge in the future. (eg: server like the mozilla-try server will likely wants a "none" value) The option name contains 'push' since this affects 'push' only. The option value 'check-related' is preferred over one explicitly containing 'allow' or 'deny' because the client still have a strong decision power here. Here, the server is just advising the client on the check mode to use.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 28 May 2017 00:12:38 +0200
parents 7e2eb964a561
children a8dfa35a4130
files mercurial/bundle2.py mercurial/help/config.txt tests/test-push-race.t
diffstat 3 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Fri Jun 16 22:57:31 2017 -0700
+++ b/mercurial/bundle2.py	Sun May 28 00:12:38 2017 +0200
@@ -1323,7 +1323,8 @@
         caps['obsmarkers'] = supportedformat
     if allowpushback:
         caps['pushback'] = ()
-    if not repo.ui.configbool('experimental', 'checkheads-strict', True):
+    cpmode = repo.ui.config('server', 'concurrent-push-mode', 'strict')
+    if cpmode == 'check-related':
         caps['checkheads'] = ('related',)
     return caps
 
--- a/mercurial/help/config.txt	Fri Jun 16 22:57:31 2017 -0700
+++ b/mercurial/help/config.txt	Sun May 28 00:12:38 2017 +0200
@@ -1694,6 +1694,17 @@
     are highly recommended. Partial clones will still be allowed.
     (default: False)
 
+``concurrent-push-mode``
+    Level of allowed race condition between two pushing clients.
+
+    - 'strict': push is abort if another client touched the repository
+      while the push was preparing. (default)
+    - 'check-related': push is only aborted if it affects head that got also
+      affected while the push was preparing.
+
+    This requires compatible client (version 4.3 and later). Old client will
+    use 'strict'.
+
 ``validate``
     Whether to validate the completeness of pushed changesets by
     checking that all new file revisions specified in manifests are
--- a/tests/test-push-race.t	Fri Jun 16 22:57:31 2017 -0700
+++ b/tests/test-push-race.t	Sun May 28 00:12:38 2017 +0200
@@ -111,8 +111,8 @@
 #if unrelated
 
   $ cat >> $HGRCPATH << EOF
-  > [experimental]
-  > checkheads-strict = no
+  > [server]
+  > concurrent-push-mode = check-related
   > EOF
 
 #endif