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

login
register
mail settings
Submitter phabricator
Date March 24, 2022, 4:37 p.m.
Message ID <differential-rev-PHID-DREV-rjjvkqrmtbonh3qnc3il-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50746/
State New
Headers show

Comments

phabricator - March 24, 2022, 4:37 p.m.
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




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

Patch

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'])