[PATCH 2 of 3 V2] exchange: make clonebundleprefers non-experimental

Gregory Szorc gregory.szorc at gmail.com
Fri Jan 8 13:02:20 CST 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1452279421 28800
#      Fri Jan 08 10:57:01 2016 -0800
# Node ID 074fc9366cbb65fd16d449bdc0f372317142b76a
# Parent  215821eeb56f37f0c490e7942b55691e8c335baf
exchange: make clonebundleprefers non-experimental

In preparation for making the feature enabled by default.

diff --git a/hgext/clonebundles.py b/hgext/clonebundles.py
--- a/hgext/clonebundles.py
+++ b/hgext/clonebundles.py
@@ -165,25 +165,16 @@ The following config options influence t
 feature:
 
 ui.clonebundlefallback
    Whether to automatically fall back to a traditional clone in case of
    clone bundles failure. Defaults to false for reasons described above.
 
 experimental.clonebundles
    Whether the clone bundles feature is enabled on clients. Defaults to true.
-
-experimental.clonebundleprefers
-   List of "key=value" properties the client prefers in bundles. Downloaded
-   bundle manifests will be sorted by the preferences in this list. e.g.
-   the value "BUNDLESPEC=gzip-v1, BUNDLESPEC=bzip2-v1" will prefer a gzipped
-   version 1 bundle type then bzip2 version 1 bundle type.
-
-   If not defined, the order in the manifest will be used and the first
-   available bundle will be downloaded.
 """
 
 from mercurial import (
     extensions,
     wireproto,
 )
 
 testedwith = 'internal'
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1798,18 +1798,17 @@ def filterclonebundleentries(repo, entri
                           entry['URL'])
             continue
 
         newentries.append(entry)
 
     return newentries
 
 def sortclonebundleentries(ui, entries):
-    # experimental config: experimental.clonebundleprefers
-    prefers = ui.configlist('experimental', 'clonebundleprefers', default=[])
+    prefers = ui.configlist('ui', 'clonebundleprefers', default=[])
     if not prefers:
         return list(entries)
 
     prefers = [p.split('=', 1) for p in prefers]
 
     # Our sort function.
     def compareentry(a, b):
         for prefkey, prefvalue in prefers:
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1497,16 +1497,40 @@ User interface controls.
     clone, this would add significant and unexpected load to the server
     since the server is expecting clone operations to be offloaded to
     pre-generated bundles. Failing fast (the default behavior) ensures
     clients don't overwhelm the server when "clone bundle" application
     fails.
 
     (default: False)
 
+``clonebundleprefers``
+    Defines preferences for which "clone bundles" to use.
+
+    Servers advertising "clone bundles" may advertise multiple available
+    bundles. Each bundle may have different attributes, such as the bundle
+    type and compression format. This option is used to prefer a particular
+    bundle over another.
+
+    The following keys are defined by Mercurial:
+
+    BUNDLESPEC
+       A bundle type specifier. These are strings passed to :hg:`bundle -t`.
+       e.g. ``gzip-v2`` or ``bzip2-v1``.
+
+    COMPRESSION
+       The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
+
+    Server operators may define custom keys.
+
+    Example values: ``COMPRESSION=bzip2``,
+    ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
+
+    By default, the first bundle advertised by the server is used.
+
 ``commitsubrepos``
     Whether to commit modified subrepositories when committing the
     parent repository. If False and one subrepository has uncommitted
     changes, abort the commit.
     (default: False)
 
 ``debug``
     Print debugging information. (default: False)
diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -372,65 +372,65 @@ important)
   > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2 extra=a
   > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2 extra=a
   > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
   > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
   > EOF
 
 Preferring an undefined attribute will take first entry
 
-  $ hg --config experimental.clonebundleprefers=foo=bar clone -U http://localhost:$HGPORT prefer-foo
+  $ hg --config ui.clonebundleprefers=foo=bar clone -U http://localhost:$HGPORT prefer-foo
   applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found
 
 Preferring bz2 type will download first entry of that type
 
-  $ hg --config experimental.clonebundleprefers=COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-bz
+  $ hg --config ui.clonebundleprefers=COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-bz
   applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found
 
 Preferring multiple values of an option works
 
-  $ hg --config experimental.clonebundleprefers=COMPRESSION=unknown,COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-multiple-bz
+  $ hg --config ui.clonebundleprefers=COMPRESSION=unknown,COMPRESSION=bzip2 clone -U http://localhost:$HGPORT prefer-multiple-bz
   applying clone bundle from http://localhost:$HGPORT1/bz2-a.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found
 
 Sorting multiple values should get us back to original first entry
 
-  $ hg --config experimental.clonebundleprefers=BUNDLESPEC=unknown,BUNDLESPEC=gzip-v2,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-multiple-gz
+  $ hg --config ui.clonebundleprefers=BUNDLESPEC=unknown,BUNDLESPEC=gzip-v2,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-multiple-gz
   applying clone bundle from http://localhost:$HGPORT1/gz-a.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found
 
 Preferring multiple attributes has correct order
 
-  $ hg --config experimental.clonebundleprefers=extra=b,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-separate-attributes
+  $ hg --config ui.clonebundleprefers=extra=b,BUNDLESPEC=bzip2-v2 clone -U http://localhost:$HGPORT prefer-separate-attributes
   applying clone bundle from http://localhost:$HGPORT1/bz2-b.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found
@@ -439,17 +439,17 @@ Test where attribute is missing from som
 
   $ cat > server/.hg/clonebundles.manifest << EOF
   > http://localhost:$HGPORT1/gz-a.hg BUNDLESPEC=gzip-v2
   > http://localhost:$HGPORT1/bz2-a.hg BUNDLESPEC=bzip2-v2
   > http://localhost:$HGPORT1/gz-b.hg BUNDLESPEC=gzip-v2 extra=b
   > http://localhost:$HGPORT1/bz2-b.hg BUNDLESPEC=bzip2-v2 extra=b
   > EOF
 
-  $ hg --config experimental.clonebundleprefers=extra=b clone -U http://localhost:$HGPORT prefer-partially-defined-attribute
+  $ hg --config ui.clonebundleprefers=extra=b clone -U http://localhost:$HGPORT prefer-partially-defined-attribute
   applying clone bundle from http://localhost:$HGPORT1/gz-b.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
   finished applying clone bundle
   searching for changes
   no changes found


More information about the Mercurial-devel mailing list