diff tests/test-bundle-type.t @ 31473:ffed3bf5cd4c stable

exchange: reject new compression engines for v1 bundles (issue5506) Version 1 bundles only support a fixed set of compression engines. Before this change, we would accept any compression engine for v1 bundles, even those that may not work on v1. This could lead to an error. We define a fixed set of compression engines known to work with v1 bundles and we add checking to ensure a newer engine (like zstd) won't work with v1 bundles. I also took the liberty of adding test coverage for unknown compression names because I noticed we didn't have coverage of it before.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 16 Mar 2017 12:23:56 -0700
parents 76104a4899ad
children 10c0ee338535
line wrap: on
line diff
--- a/tests/test-bundle-type.t	Tue Mar 07 13:24:24 2017 -0500
+++ b/tests/test-bundle-type.t	Thu Mar 16 12:23:56 2017 -0700
@@ -33,6 +33,23 @@
   summary:     a
   $ cd ..
 
+Unknown compression type is rejected
+
+  $ hg init t3
+  $ cd t3
+  $ hg -q pull ../b1
+  $ hg bundle -a -t unknown out.hg
+  abort: unknown is not a recognized bundle specification
+  (see 'hg help bundle' for supported values for --type)
+  [255]
+
+  $ hg bundle -a -t unknown-v2 out.hg
+  abort: unknown compression is not supported
+  (see 'hg help bundle' for supported values for --type)
+  [255]
+
+  $ cd ..
+
 test bundle types
 
   $ testbundle() {
@@ -164,6 +181,23 @@
       c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
   zstd-v2
   
+
+Explicit request for zstd on non-generaldelta repos
+
+  $ hg --config format.usegeneraldelta=false init nogd
+  $ hg -q -R nogd pull t1
+  $ hg -R nogd bundle -a -t zstd nogd-zstd
+  abort: compression engine zstd is not supported on v1 bundles
+  (see 'hg help bundle' for supported values for --type)
+  [255]
+
+zstd-v1 always fails
+
+  $ hg -R tzstd bundle -a -t zstd-v1 zstd-v1
+  abort: compression engine zstd is not supported on v1 bundles
+  (see 'hg help bundle' for supported values for --type)
+  [255]
+
 #else
 
 zstd is a valid engine but isn't available