# HG changeset patch # User Valentin Gatien-Baron # Date 2022-03-24 16:27:21 # Node ID d9ed7c5e915d0958b9e33c0f2368dd32db336576 # Parent d4b66dc500c5bceaf49439feb7d5d34cd975d7d4 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 diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2528,7 +2528,8 @@ def bundle2getvars(op, part): @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']) diff --git a/tests/test-clone-stream.t b/tests/test-clone-stream.t --- a/tests/test-clone-stream.t +++ b/tests/test-clone-stream.t @@ -817,3 +817,9 @@ Clone non-publishing with obsolescence $ 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