changeset 48821:d9ed7c5e915d stable

streamclone: avoid some obscure error in a corner case I don't really know how, but I ran into this error: $ hg clone --stream ssh://user@dummy/empty-repo local-empty-repo streaming all changes abort: unable to apply stream clone: unsupported format: [255] I think you need an empty list of requirements for this to happen, which is weird, but an obscure error like this is not exactly helpful either. Since this is the result of an encoding bug anyway, just fix it. Differential Revision: https://phab.mercurial-scm.org/D12402
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Thu, 24 Mar 2022 12:27:21 -0400
parents d4b66dc500c5
children d4752aeb20f1
files mercurial/bundle2.py tests/test-clone-stream.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Mar 29 18:15:49 2022 +0900
+++ b/mercurial/bundle2.py	Thu Mar 24 12:27:21 2022 -0400
@@ -2528,7 +2528,8 @@
 @parthandler(b'stream2', (b'requirements', b'filecount', b'bytecount'))
 def handlestreamv2bundle(op, part):
 
-    requirements = urlreq.unquote(part.params[b'requirements']).split(b',')
+    requirements = urlreq.unquote(part.params[b'requirements'])
+    requirements = requirements.split(b',') if requirements else []
     filecount = int(part.params[b'filecount'])
     bytecount = int(part.params[b'bytecount'])
 
--- a/tests/test-clone-stream.t	Tue Mar 29 18:15:49 2022 +0900
+++ b/tests/test-clone-stream.t	Thu Mar 24 12:27:21 2022 -0400
@@ -817,3 +817,9 @@
   $ killdaemons.py
 
 #endif
+
+Cloning a repo with no requirements doesn't give some obscure error
+
+  $ mkdir -p empty-repo/.hg
+  $ hg clone -q --stream ssh://user@dummy/empty-repo empty-repo2
+  $ hg --cwd empty-repo2 verify -q