Mercurial > hg
changeset 50736:b852c34dc2b8 stable
clonebundles: add warning if auto-generate is enabled without formats
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Tue, 27 Jun 2023 16:19:42 +0200 |
parents | 2b0598121a71 |
children | 429880fd984c |
files | hgext/clonebundles.py tests/test-clonebundles-autogen.t |
diffstat | 2 files changed, 37 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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