Patchwork [4,of,9] bundlerepo: also read the 'devel.legacy.exchange' config

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 3, 2016, 2:54 p.m.
Message ID <3b73d07b2179cfe49823.1470236089@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16057/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 3, 2016, 2:54 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1470235330 -7200
#      Wed Aug 03 16:42:10 2016 +0200
# Node ID 3b73d07b2179cfe49823b2a770dd2bad769e9401
# Parent  2a9b825514377c8486b8dbd3dfbdd865efeba1fc
# EXP-Topic bundle2.devel
bundlerepo: also read the 'devel.legacy.exchange' config

Bundlerepo does its own bundle2 related logic.
Yuya Nishihara - Aug. 4, 2016, 2:24 p.m.
On Wed, 03 Aug 2016 16:54:49 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1470235330 -7200
> #      Wed Aug 03 16:42:10 2016 +0200
> # Node ID 3b73d07b2179cfe49823b2a770dd2bad769e9401
> # Parent  2a9b825514377c8486b8dbd3dfbdd865efeba1fc
> # EXP-Topic bundle2.devel
> bundlerepo: also read the 'devel.legacy.exchange' config
> 
> Bundlerepo does its own bundle2 related logic.
> 
> diff -r 2a9b82551437 -r 3b73d07b2179 mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py	Tue Aug 02 14:48:21 2016 +0200
> +++ b/mercurial/bundlerepo.py	Wed Aug 03 16:42:10 2016 +0200
> @@ -480,7 +480,14 @@ def getremotechanges(ui, repo, other, on
>      if bundlename or not localrepo:
>          # create a bundle (uncompressed if other repo is not local)
>  
> -        canbundle2 = (ui.configbool('experimental', 'bundle2-exp', True)
> +        forcebundle1 = False

Dropped unused initialization.

> +        # developer config: devel.legacy.exchange
> +        legexc = ui.configlist('devel', 'legacy.exchange')
> +        if not legexc:
> +            forcebundle1 = not ui.configbool('experimental', 'bundle2-exp', True)

and fixed temporary check-code failure, "line too long."

> +        else:
> +            forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc
> +        canbundle2 = (not forcebundle1

Patch

diff -r 2a9b82551437 -r 3b73d07b2179 mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py	Tue Aug 02 14:48:21 2016 +0200
+++ b/mercurial/bundlerepo.py	Wed Aug 03 16:42:10 2016 +0200
@@ -480,7 +480,14 @@  def getremotechanges(ui, repo, other, on
     if bundlename or not localrepo:
         # create a bundle (uncompressed if other repo is not local)
 
-        canbundle2 = (ui.configbool('experimental', 'bundle2-exp', True)
+        forcebundle1 = False
+        # developer config: devel.legacy.exchange
+        legexc = ui.configlist('devel', 'legacy.exchange')
+        if not legexc:
+            forcebundle1 = not ui.configbool('experimental', 'bundle2-exp', True)
+        else:
+            forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc
+        canbundle2 = (not forcebundle1
                       and other.capable('getbundle')
                       and other.capable('bundle2'))
         if canbundle2: