# HG changeset patch # User Mathias De Mare # Date 1687875582 -7200 # Node ID b852c34dc2b897190da141be8663269669a9231b # Parent 2b0598121a71fa19c2174e4eee3400ec3a3b1c26 clonebundles: add warning if auto-generate is enabled without formats diff -r 2b0598121a71 -r b852c34dc2b8 hgext/clonebundles.py --- a/hgext/clonebundles.py Tue Jun 27 15:34:24 2023 +0200 +++ b/hgext/clonebundles.py Tue Jun 27 16:19:42 2023 +0200 @@ -972,8 +972,16 @@ targets = repo.ui.configlist( b'clone-bundles', b'auto-generate.formats' ) - if enabled and targets: - tr.addpostclose(CAT_POSTCLOSE, make_auto_bundler(self)) + if enabled: + if not targets: + repo.ui.warn( + _( + b'clone-bundle auto-generate enabled, ' + b'but no formats specified: disabling generation\n' + ) + ) + else: + tr.addpostclose(CAT_POSTCLOSE, make_auto_bundler(self)) return tr @localrepo.unfilteredmethod diff -r 2b0598121a71 -r b852c34dc2b8 tests/test-clonebundles-autogen.t --- a/tests/test-clonebundles-autogen.t Tue Jun 27 15:34:24 2023 +0200 +++ b/tests/test-clonebundles-autogen.t Tue Jun 27 16:19:42 2023 +0200 @@ -10,7 +10,6 @@ > > [clone-bundles] > auto-generate.on-change = yes - > auto-generate.formats = v2 > upload-command = cp "\$HGCB_BUNDLE_PATH" "$TESTTMP"/final-upload/ > delete-command = rm -f "$TESTTMP/final-upload/\$HGCB_BASENAME" > url-template = file://$TESTTMP/final-upload/{basename} @@ -25,9 +24,36 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd client +Test bundles are not generated if formats are not given +======================================================= + + $ touch noformats + $ hg -q commit -A -m 'add noformats' + $ hg push + pushing to $TESTTMP/server + searching for changes + clone-bundle auto-generate enabled, but no formats specified: disabling generation + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + $ test -f ../server/.hg/clonebundles.manifest + [1] + $ hg debugstrip -r tip + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + saved backup bundle to $TESTTMP/client/.hg/strip-backup/4823cdad4f38-4b2c3b65-backup.hg + $ hg --cwd ../server debugstrip -r tip + saved backup bundle to $TESTTMP/server/.hg/strip-backup/4823cdad4f38-4b2c3b65-backup.hg + clone-bundle auto-generate enabled, but no formats specified: disabling generation + clone-bundle auto-generate enabled, but no formats specified: disabling generation + Test bundles are generated on push ================================== + $ cat >> ../server/.hg/hgrc << EOF + > [clone-bundles] + > auto-generate.formats = v2 + > EOF $ touch foo $ hg -q commit -A -m 'add foo' $ touch bar