D12402: streamclone: avoid some obscure error in a corner case

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Thu Mar 24 16:37:09 UTC 2022


valentin.gatienbaron created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12402

AFFECTED FILES
  mercurial/bundle2.py
  tests/test-clone-stream.t

CHANGE DETAILS

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 @@
   $ 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
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -2528,6 +2528,8 @@
 def handlestreamv2bundle(op, part):
 
     requirements = urlreq.unquote(part.params[b'requirements']).split(b',')
+    if requirements == [b'']:
+        requirements = []
     filecount = int(part.params[b'filecount'])
     bytecount = int(part.params[b'bytecount'])
 



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list