[PATCH 6 of 6] check-concurrency: expose the feature as 'server.check-concurrency'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Jun 4 10:49:34 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495923158 -7200
#      Sun May 28 00:12:38 2017 +0200
# Node ID c58a31911d96c8fbb083388e55bf22cc473cc7b5
# Parent  ae88951457de93c7f6286d449672b0b9d20c57f1
# EXP-Topic pushrace
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c58a31911d96
check-concurrency: expose the feature as 'server.check-concurrency'

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)

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1323,7 +1323,7 @@ def getrepocaps(repo, allowpushback=Fals
         caps['obsmarkers'] = supportedformat
     if allowpushback:
         caps['pushback'] = ()
-    if not repo.ui.configbool('experimental', 'checkheads-strict', True):
+    if repo.ui.config('server', 'check-concurrency', 'strict') == 'related':
         caps['checkheads'] = ('related',)
     return caps
 
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1668,6 +1668,16 @@ Controls generic server settings.
     are highly recommended. Partial clones will still be allowed.
     (default: False)
 
+``check-concurrency``
+    Level of allowed race condition between two pushing client.
+    - 'strict': push is abort if another client touched the repository
+      while the push was preparing. (default)
+    - '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
diff --git a/tests/test-push-race.t b/tests/test-push-race.t
--- a/tests/test-push-race.t
+++ b/tests/test-push-race.t
@@ -111,8 +111,8 @@ We tests multiple cases:
 #if unrelated
 
   $ cat >> $HGRCPATH << EOF
-  > [experimental]
-  > checkheads-strict = no
+  > [server]
+  > check-concurrency = related
   > EOF
 
 #endif


More information about the Mercurial-devel mailing list