[PATCH 1 of 3] exchange: make clonebundleprefers non-experimental
Gregory Szorc
gregory.szorc at gmail.com
Fri Jan 8 04:35:00 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1452223404 28800
# Thu Jan 07 19:23:24 2016 -0800
# Node ID 76100ec432a13c79004ec859ca197e3eff186bc3
# Parent bd706395351bf4dc80a09f687e938fe4d36ad723
exchange: make clonebundleprefers non-experimental
In preparation for making the feature enabled by default.
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
@@ -383,65 +383,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
@@ -450,17 +450,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