Skip to content
Snippets Groups Projects
Commit ec7b42f6 authored by Georges Racinet's avatar Georges Racinet :squid:
Browse files

Configuration items for clone bundles

We are basically putting almost everything under the `heptapod` section,
because

1. it makes clear to the users that the meaning of the configuration is
   specific to Heptapod
2. it avoids future collisions
3. it can be readily updated from the Rails app (case of the
   `heptapod.clone-bundles` item.

Caveat: the `disabled` value can be used to prevent all auto-generations,
but it will not be possible to disable serving of existing clone bundles at
this point (the only way would be currently to disable the `clonebundles`
extension, which probably cannot be done from `uipopulate`).
parent ba2aa962
No related branches found
No related tags found
1 merge request!117clone-bundles: auto-generation for public projects
......@@ -86,6 +86,12 @@
configitem(b'heptapod', b'allow-multiple-heads')
configitem(b'heptapod', b'allow-bookmarks')
configitem(b'heptapod', b'native', False)
configitem(b'heptapod', b'clone-bundles.s3.tls', True)
configitem(b'heptapod', b'clone-bundles.s3.endpoint', b'')
configitem(b'heptapod', b'clone-bundles.s3.bucket', b'')
configitem(b'heptapod', b'clone-bundles.s3.access_key', b'')
configitem(b'heptapod', b'clone-bundles.s3.secret_key', b'')
configitem(b'heptapod', b'clone-bundles.s3.region', b'')
cmdtable = {}
......@@ -123,6 +129,14 @@
elif auto_publish == b'all':
ui.setconfig(b'phases', b'publish', True)
clone_bundles = ui.config(b'heptapod', b'clone-bundles')
if clone_bundles is not None:
clone_bundles = clone_bundles.lower()
if clone_bundles in (b'disabled', b'explicit'):
ui.setconfig(b'clone-bundles', b'auto-generate.on-change', False)
elif clone_bundles == b'on-change':
ui.setconfig(b'clone-bundles', b'auto-generate.on-change', True)
# here it would be tempting to use pop() but this is called twice
# for each `hg` invocation, and apparently the default is reapplied between
# the two calls.
......
......@@ -60,6 +60,23 @@
assert ui.configbool(b'phases', b'publish')
@parametrize('value', ('disabled', 'explicit'))
def test_clone_bundles_disabled(tmpdir, value):
ui = make_repo(tmpdir,
config=dict(
heptapod={'clone-bundles': value},
))
assert not ui.configbool(b'clone-bundles', b'auto-generate.on-change')
def test_clone_bundles_on_change(tmpdir):
ui = make_repo(tmpdir,
config=dict(
heptapod={'clone-bundles': 'on-change'},
))
assert ui.configbool(b'clone-bundles', b'auto-generate.on-change')
@parametrize('key',
[('experimental', 'single-head-per-branch'),
('experimental', 'hg-git.bookmarks-on-named-branches'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment