pullbundle: fix handling of gzip bundlespecs
authorJoerg Sonnenberger <joerg@bec.de>
Thu, 12 Jul 2018 15:29:03 +0200
changeset 38678 7e4a856a4f05
parent 38677 2a227782e754
child 38679 b3d0c97a0820
pullbundle: fix handling of gzip bundlespecs Differential Revision: https://phab.mercurial-scm.org/D3933
mercurial/wireprotov1server.py
tests/test-pull-bundle.t
--- a/mercurial/wireprotov1server.py	Wed Jul 11 16:44:33 2018 -0700
+++ b/mercurial/wireprotov1server.py	Thu Jul 12 15:29:03 2018 +0200
@@ -353,7 +353,9 @@
     common_anc = cl.ancestors([cl.rev(rev) for rev in common], inclusive=True)
     compformats = clientcompressionsupport(proto)
     for entry in res:
-        if 'COMPRESSION' in entry and entry['COMPRESSION'] not in compformats:
+        comp = entry.get('COMPRESSION')
+        altcomp = util.compengines._bundlenames.get(comp)
+        if comp and comp not in compformats and altcomp not in compformats:
             continue
         # No test yet for VERSION, since V2 is supported by any client
         # that advertises partial pulls
--- a/tests/test-pull-bundle.t	Wed Jul 11 16:44:33 2018 -0700
+++ b/tests/test-pull-bundle.t	Thu Jul 12 15:29:03 2018 +0200
@@ -46,9 +46,9 @@
   $ hg bundle --base 1 -r 2 .hg/2.hg
   1 changesets found
   $ cat <<EOF > .hg/pullbundles.manifest
-  > 2.hg heads=effea6de0384e684f44435651cb7bd70b8735bd4 bases=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
-  > 1.hg heads=ed1b79f46b9a29f5a6efa59cf12fcfca43bead5a bases=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
-  > 0.hg heads=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
+  > 2.hg BUNDLESPEC=none-v2 heads=effea6de0384e684f44435651cb7bd70b8735bd4 bases=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
+  > 1.hg BUNDLESPEC=bzip2-v2 heads=ed1b79f46b9a29f5a6efa59cf12fcfca43bead5a bases=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
+  > 0.hg BUNDLESPEC=gzip-v2 heads=bbd179dfa0a71671c253b3ae0aa1513b60d199fa
   > EOF
   $ hg --config blackbox.track=debug --debug serve -p $HGPORT2 -d --pid-file=../repo.pid
   listening at http://*:$HGPORT2/ (bound to $LOCALIP:$HGPORT2) (glob) (?)