Patchwork D1922: wireproto: don't compress errors from getbundle()

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2018, 12:45 a.m.
Message ID <differential-rev-PHID-DREV-tje6m5dtewae7t6ujrgx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27009/
State Superseded
Headers show

Comments

phabricator - Jan. 21, 2018, 12:45 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Errors should be small. There's no real need to compress them.
  Truth be told, there's no good reason to not compress them either.
  But leaving them uncompressed makes it easier to test failures
  by looking at the raw HTTP response. This makes it easier for us
  to write tests. It may make it easier for people writing their
  own clients.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -862,6 +862,8 @@ 
             raise error.Abort(bundle2requiredmain,
                               hint=bundle2requiredhint)
 
+    preferuncompressed = False
+
     try:
         if repo.ui.configbool('server', 'disablefullbundle'):
             # Check to see if this is a full clone.
@@ -891,8 +893,10 @@ 
             advargs.append(('hint', exc.hint))
         bundler.addpart(bundle2.bundlepart('error:abort',
                                            manargs, advargs))
-        return streamres(gen=bundler.getchunks())
-    return streamres(gen=chunks)
+        chunks = bundler.getchunks()
+        preferuncompressed = True
+
+    return streamres(gen=chunks, prefer_uncompressed=preferuncompressed)
 
 @wireprotocommand('heads')
 def heads(repo, proto):