Mercurial > hg
changeset 27738:a0e783d26e81
exchange: make clone bundles non-experimental and enabled by default
The clone bundles feature was introduced in Mercurial 3.6 behind an
experimental and disabled by default flag. The feature has been enabled
on hg.mozilla.org for a few months and has served many terabytes of
clones. Users have been encouraged to use the feature and reception
has been very positive (mainly due to faster clones as a result of
connecting to a CDN). I have heard no feedback about changing the
feature other than inquiries about when it will be enabled by default.
So, I think the feature is ready to be enabled by default.
This patch renames experimental.clonebundles to ui.clonebundles,
documents the option, and enables it by default. References to the
experimental state of clone bundles have been removed. The remaining
config option docs in clonebundles.py have been removed because they
are redudant with `hg help config`.
There are some oddities with behavior of clone bundles. Because clones
with clone bundles are effectively 2 `hg pull` operations, there may be
2 transactions. This could result in hooks running twice. If the
subsequent pull is aborted, it could result in partial rollback and an
incomplete clone. This behavior is a bit wonky and should probably
be documented. If this patch is accepted, I'll send a follow-up to
document it. I don't think this behavior should prevent the feature
being enabled by default. Reworking the clone mechanism to support
interrupted or multi-part clones feels like a major new feature and
something that when implemented can change the hook and rollback
semantics of clone bundles. Besides, partial clone is better than
full rollback and hooks running on initial clone are likely rare, so I
think the impact is minimal.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 08 Jan 2016 10:58:04 -0800 |
parents | 482eb357fe98 |
children | d6d3cf5fda6f |
files | hgext/clonebundles.py mercurial/exchange.py mercurial/help/config.txt tests/test-clonebundles.t tests/test-help.t |
diffstat | 5 files changed, 18 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/clonebundles.py Fri Jan 08 10:57:01 2016 -0800 +++ b/hgext/clonebundles.py Fri Jan 08 10:58:04 2016 -0800 @@ -1,7 +1,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -"""advertise pre-generated bundles to seed clones (experimental) +"""advertise pre-generated bundles to seed clones "clonebundles" is a server-side extension used to advertise the existence of pre-generated, externally hosted bundle files to clients that are @@ -160,16 +160,6 @@ occurs. So server operators should prepare for some people to follow these instructions when a failure occurs, thus driving more load to the original Mercurial server when the bundle hosting service fails. - -The following config options influence the behavior of the clone bundles -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. """ from mercurial import (
--- a/mercurial/exchange.py Fri Jan 08 10:57:01 2016 -0800 +++ b/mercurial/exchange.py Fri Jan 08 10:58:04 2016 -0800 @@ -1677,7 +1677,7 @@ repo = pullop.repo remote = pullop.remote - if not repo.ui.configbool('experimental', 'clonebundles', False): + if not repo.ui.configbool('ui', 'clonebundles', True): return # Only run if local repo is empty. @@ -1733,7 +1733,7 @@ hint=_('if this error persists, consider contacting ' 'the server operator or disable clone ' 'bundles via ' - '"--config experimental.clonebundles=false"')) + '"--config ui.clonebundles=false"')) def parseclonebundlesmanifest(repo, s): """Parses the raw text of a clone bundles manifest.
--- a/mercurial/help/config.txt Fri Jan 08 10:57:01 2016 -0800 +++ b/mercurial/help/config.txt Fri Jan 08 10:58:04 2016 -0800 @@ -1487,6 +1487,16 @@ default ``USER@HOST`` is used instead. (default: False) +``clonebundles`` + Whether the "clone bundles" feature is enabled. + + When enabled, :hg:`clone` may download and apply a server-advertised + bundle file from a URL instead of using the normal exchange mechanism. + + This can likely result in faster and more reliable clones. + + (default: True) + ``clonebundlefallback`` Whether failure to apply an advertised "clone bundle" from a server should result in fallback to a regular clone.
--- a/tests/test-clonebundles.t Fri Jan 08 10:57:01 2016 -0800 +++ b/tests/test-clonebundles.t Fri Jan 08 10:58:04 2016 -0800 @@ -20,27 +20,6 @@ $ cat hg.pid >> $DAEMON_PIDS $ cd .. -Feature disabled by default -(client should not request manifest) - - $ hg clone -U http://localhost:$HGPORT feature-disabled - requesting all changes - adding changesets - adding manifests - adding file changes - added 2 changesets with 2 changes to 2 files - - $ cat server/access.log - * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) - * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) - * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob) - * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob) - - $ cat >> $HGRCPATH << EOF - > [experimental] - > clonebundles = true - > EOF - Missing manifest should not result in server lookup $ hg --verbose clone -U http://localhost:$HGPORT no-manifest @@ -50,7 +29,7 @@ adding file changes added 2 changesets with 2 changes to 2 files - $ tail -4 server/access.log + $ cat server/access.log * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob) @@ -75,7 +54,7 @@ applying clone bundle from http://does.not.exist/bundle.hg error fetching bundle: (.* not known|getaddrinfo failed) (re) abort: error applying bundle - (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") + (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") [255] Server is not running aborts @@ -85,7 +64,7 @@ applying clone bundle from http://localhost:$HGPORT1/bundle.hg error fetching bundle: * refused* (glob) abort: error applying bundle - (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") + (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") [255] Server returns 404 @@ -96,7 +75,7 @@ applying clone bundle from http://localhost:$HGPORT1/bundle.hg HTTP error fetching bundle: HTTP Error 404: File not found abort: error applying bundle - (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") + (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") [255] We can override failure to fall back to regular clone
--- a/tests/test-help.t Fri Jan 08 10:57:01 2016 -0800 +++ b/tests/test-help.t Fri Jan 08 10:58:04 2016 -0800 @@ -252,7 +252,6 @@ censor erase file content at a given revision churn command to display statistics about repository history clonebundles advertise pre-generated bundles to seed clones - (experimental) color colorize output from some commands convert import revisions from foreign VCS repositories into Mercurial @@ -1309,7 +1308,7 @@ Extensions: - clonebundles advertise pre-generated bundles to seed clones (experimental) + clonebundles advertise pre-generated bundles to seed clones prefixedname matched against word "clone" relink recreates hardlinks between repository clones