Patchwork check-concurrency: expose the feature as 'check-concurrent-push-mode'

login
register
mail settings
Submitter Pierre-Yves David
Date June 17, 2017, 9:43 a.m.
Message ID <37ac2d3f1c505077f568.1497692639@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21453/
State Accepted
Headers show

Comments

Pierre-Yves David - June 17, 2017, 9:43 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495923158 -7200
#      Sun May 28 00:12:38 2017 +0200
# Node ID 37ac2d3f1c505077f5684635df123a1fc31cf594
# Parent  29558247b00eff8c95c7604032b59cfbab34010d
# 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 37ac2d3f1c50
check-concurrency: expose the feature as 'check-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.
Yuya Nishihara - June 18, 2017, 6:09 a.m.
On Sat, 17 Jun 2017 11:43:59 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1495923158 -7200
> #      Sun May 28 00:12:38 2017 +0200
> # Node ID 37ac2d3f1c505077f5684635df123a1fc31cf594
> # Parent  29558247b00eff8c95c7604032b59cfbab34010d
> # 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 37ac2d3f1c50
> check-concurrency: expose the feature as 'check-concurrent-push-mode'

Queued, thanks.

> +``concurrent-push-mode``
> +    Level of allowed race condition between two pushing client.

s/client/clients/

and inserted empty line here so the following lines are rendered as lists.

> +    - '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'.
Pierre-Yves David - June 18, 2017, 12:39 p.m.
On 06/18/2017 08:09 AM, Yuya Nishihara wrote:
> On Sat, 17 Jun 2017 11:43:59 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>> # Date 1495923158 -7200
>> #      Sun May 28 00:12:38 2017 +0200
>> # Node ID 37ac2d3f1c505077f5684635df123a1fc31cf594
>> # Parent  29558247b00eff8c95c7604032b59cfbab34010d
>> # 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 37ac2d3f1c50
>> check-concurrency: expose the feature as 'check-concurrent-push-mode'
>
> Queued, thanks.

Thanks! this make me spot a typo in the commit summary line (extra 
check-) in the config name. Should be:

check-concurrency: expose the feature as 'concurrent-push-mode'

Can you fix hg-committed?


>> +``concurrent-push-mode``
>> +    Level of allowed race condition between two pushing client.
>
> s/client/clients/
>
> and inserted empty line here so the following lines are rendered as lists.
>
>> +    - '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'.
Yuya Nishihara - June 18, 2017, 1:31 p.m.
On Sun, 18 Jun 2017 14:39:37 +0200, Pierre-Yves David wrote:
> On 06/18/2017 08:09 AM, Yuya Nishihara wrote:
> > On Sat, 17 Jun 2017 11:43:59 +0200, Pierre-Yves David wrote:
> >> # HG changeset patch
> >> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> >> # Date 1495923158 -7200
> >> #      Sun May 28 00:12:38 2017 +0200
> >> # Node ID 37ac2d3f1c505077f5684635df123a1fc31cf594
> >> # Parent  29558247b00eff8c95c7604032b59cfbab34010d
> >> # 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 37ac2d3f1c50
> >> check-concurrency: expose the feature as 'check-concurrent-push-mode'
> >
> > Queued, thanks.
> 
> Thanks! this make me spot a typo in the commit summary line (extra 
> check-) in the config name. Should be:
> 
> check-concurrency: expose the feature as 'concurrent-push-mode'
> 
> Can you fix hg-committed?

Sure, fixed. New hash is a7851519ea02.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1323,7 +1323,8 @@  def getrepocaps(repo, allowpushback=Fals
         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
 
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1672,6 +1672,16 @@  Controls generic server settings.
     are highly recommended. Partial clones will still be allowed.
     (default: False)
 
+``concurrent-push-mode``
+    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)
+    - '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
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]
+  > concurrent-push-mode = check-related
   > EOF
 
 #endif