changeset 877:cf35f38d6a10

exchange: fix changeset pulling over http http compress its stream. The were building a bogus stream where the first 10 bytes where uncompressed. Confusing the client.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 10 Mar 2014 21:35:54 -0700
parents 8c9601a6c4e0
children 5cb2744a6d36
files hgext/evolve.py hgext/simple4server.py
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Mar 10 22:08:21 2014 -0700
+++ b/hgext/evolve.py	Mon Mar 10 21:35:54 2014 -0700
@@ -2316,12 +2316,12 @@
         if k in ('heads', 'common'):
             opts[k] = wireproto.decodelist(v)
     obsdata = _getobsmarkersstream(repo, **opts)
-    length = '%20i' % len(obsdata.getvalue())
-    def data():
-        yield length
-        for c in proto.groupchunks(obsdata):
-            yield c
-    return wireproto.streamres(data())
+    finaldata = StringIO()
+    obsdata = obsdata.getvalue()
+    finaldata.write('%20i' % len(obsdata))
+    finaldata.write(obsdata)
+    finaldata.seek(0)
+    return wireproto.streamres(proto.groupchunks(finaldata))
 
 def _obsrelsethashtree(repo):
     cache = []
--- a/hgext/simple4server.py	Mon Mar 10 22:08:21 2014 -0700
+++ b/hgext/simple4server.py	Mon Mar 10 21:35:54 2014 -0700
@@ -145,12 +145,12 @@
         if k in ('heads', 'common'):
             opts[k] = wireproto.decodelist(v)
     obsdata = _getobsmarkersstream(repo, **opts)
-    length = '%20i' % len(obsdata.getvalue())
-    def data():
-        yield length
-        for c in proto.groupchunks(obsdata):
-            yield c
-    return wireproto.streamres(data())
+    finaldata = StringIO()
+    obsdata = obsdata.getvalue()
+    finaldata.write('%20i' % len(obsdata))
+    finaldata.write(obsdata)
+    finaldata.seek(0)
+    return wireproto.streamres(proto.groupchunks(finaldata))
 
 
 # from evolve extension: 1a23c7c52a43