changeset 51562:eac84af0c8cc stable

bundle-spec: properly parse boolean configuration as boolean Before this changesets "v2;revbranchcache=no" would actually request the addition for a revbranchcache part as the non-empty string `"0"` is `True`
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 05 Apr 2024 01:07:46 +0200
parents 7752cf4f64cc
children b861d913e7ec
files mercurial/bundlecaches.py tests/test-bundle-type.t
diffstat 2 files changed, 93 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlecaches.py	Thu Apr 04 16:41:43 2024 +0200
+++ b/mercurial/bundlecaches.py	Fri Apr 05 01:07:46 2024 +0200
@@ -179,6 +179,9 @@
     b"obsolescence": param_bool,
     b"obsolescence-mandatory": param_bool,
     b"phases": param_bool,
+    b"changegroup": param_bool,
+    b"tagsfnodescache": param_bool,
+    b"revbranchcache": param_bool,
 }
 
 
--- a/tests/test-bundle-type.t	Thu Apr 04 16:41:43 2024 +0200
+++ b/tests/test-bundle-type.t	Fri Apr 05 01:07:46 2024 +0200
@@ -620,3 +620,93 @@
       b9f5f740a8cd76700020e3903ee55ecff78bd3e5
   $ hg debugbundle ./v2-cg-03.hg --spec
   bzip2-v2;cg.version=03
+
+tests controlling bundle contents
+=================================
+
+  $ hg debugupdatecache -R t1
+
+default content
+---------------
+
+  $ hg -R t1 bundle --all --quiet --type 'v2' ./v2.hg
+  $ hg debugbundle ./v2.hg --spec
+  bzip2-v2
+  $ hg debugbundle ./v2.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, version: 02} (mandatory: True)
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+
+  $ hg -R t1 bundle --all --quiet --type 'v3' ./v3.hg
+  $ hg debugbundle ./v3.hg --spec
+  bzip2-v2;cg.version=03
+  $ hg debugbundle ./v3.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, targetphase: 2, version: 03} (mandatory: True)
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
+
+adding extra parts
+------------------
+
+We should have a "phase-heads" part here that we did not had in the default content
+
+  $ hg -R t1 bundle --all --quiet --type 'v2;phases=1' ./v2-phases.hg
+  $ hg debugbundle ./v2-phases.hg --spec
+  bzip2-v2
+  $ hg debugbundle ./v2-phases.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, targetphase: 2, version: 02} (mandatory: True)
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)
+
+skipping default inclusion
+--------------------------
+
+  $ hg -R t1 bundle --all --quiet --type 'v2;tagsfnodescache=false' ./v2-no-tfc.hg
+  $ hg debugbundle ./v2-no-tfc.hg --spec
+  bzip2-v2
+  $ hg debugbundle ./v2-no-tfc.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, version: 02} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: False)
+
+  $ hg -R t1 bundle --all --quiet --type 'v3;phases=0' ./v3-no-phases.hg
+  $ hg debugbundle ./v3-no-phases.hg --spec
+  bzip2-v2;cg.version=03
+  $ hg debugbundle ./v3-no-phases.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, version: 03} (mandatory: True)
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+
+  $ hg -R t1 bundle --all --quiet --type 'v3;phases=no;tagsfnodescache=0' ./v3-multi-no.hg
+  $ hg debugbundle ./v3-multi-no.hg --spec
+  bzip2-v2;cg.version=03
+  $ hg debugbundle ./v3-multi-no.hg --quiet
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 7, version: 03} (mandatory: True)
+  cache:rev-branch-cache -- {} (mandatory: False)
+
+skipping changegroup
+--------------------
+
+  $ hg -R t1 bundle --all --quiet --type 'v2;changegroup=no' ./v2-no-cg.hg
+  $ hg debugbundle ./v2-no-cg.hg --spec
+  bzip2-v2;changegroup=no
+  $ hg debugbundle ./v2-no-cg.hg --quiet
+  Stream params: {Compression: BZ}
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+
+  $ hg -R t1 bundle --all --quiet --type 'v3;changegroup=0' ./v3-no-cg.hg
+  $ hg debugbundle ./v3-no-cg.hg --spec
+  bzip2-v2;changegroup=no
+  $ hg debugbundle ./v3-no-cg.hg --quiet
+  Stream params: {Compression: BZ}
+  hgtagsfnodes -- {} (mandatory: False)
+  cache:rev-branch-cache -- {} (mandatory: False)
+  phase-heads -- {} (mandatory: True)