changeset 49332:d89bfc075289

bundlespec: do not check for `-` in the params portion of the bundlespec Otherwise bundle parameter with `-` in their names result in a crash.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 May 2022 11:27:16 +0200
parents 1b04d5213d0f
children 1fd7520e4961
files mercurial/bundlecaches.py tests/test-obsolete-bundle-strip.t
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlecaches.py	Wed May 18 10:38:11 2022 +0100
+++ b/mercurial/bundlecaches.py	Wed May 25 11:27:16 2022 +0200
@@ -192,7 +192,8 @@
             % spec
         )
 
-    if b'-' in spec:
+    pre_args = spec.split(b';', 1)[0]
+    if b'-' in pre_args:
         compression, version = spec.split(b'-', 1)
 
         if compression not in util.compengines.supportedbundlenames:
--- a/tests/test-obsolete-bundle-strip.t	Wed May 18 10:38:11 2022 +0100
+++ b/tests/test-obsolete-bundle-strip.t	Wed May 25 11:27:16 2022 +0200
@@ -1494,6 +1494,14 @@
   obsmarkers -- {} (mandatory: True)
       version: 1 (50 bytes)
       1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+
+  $ hg bundle -R repo-with-obs --type 'v2;obsolescence=yes;obsolescence-mandatory=no' --all --hidden bundle-type-with-obs-adv
+  1 changesets found
+  $ hg debugbundle bundle-type-with-obs-adv --part-type obsmarkers
+  Stream params: {Compression: BZ}
+  obsmarkers -- {} (mandatory: False)
+      version: 1 (50 bytes)
+      1ea73414a91b0920940797d8fc6a11e447f8ea1e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   $ hg bundle -R repo-with-obs --type 'v2;obsolescence=no' --all --hidden bundle-type-without-obs
   1 changesets found
   $ hg debugbundle bundle-type-without-obs --part-type obsmarkers