streamclone: allow uncompressed clones by default
authorMatt Mackall <mpm@selenic.com>
Sun, 07 Feb 2010 15:31:53 +0100
changeset 10377 04e1e6743809
parent 10376 a2950e053614
child 10378 e1401c74572f
child 10379 a78bfaf988e1
streamclone: allow uncompressed clones by default
mercurial/hgweb/protocol.py
mercurial/sshserver.py
mercurial/streamclone.py
--- a/mercurial/hgweb/protocol.py	Sun Feb 07 15:08:26 2010 +0100
+++ b/mercurial/hgweb/protocol.py	Sun Feb 07 15:31:53 2010 +0100
@@ -111,7 +111,7 @@
 
 def capabilities(repo, req):
     caps = copy.copy(basecaps)
-    if repo.ui.configbool('server', 'uncompressed', untrusted=True):
+    if streamclone.allowed(repo.ui):
         caps.append('stream=%d' % repo.changelog.version)
     if changegroupmod.bundlepriority:
         caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
@@ -202,7 +202,7 @@
 def stream_out(repo, req):
     req.respond(HTTP_OK, HGTYPE)
     try:
-        for chunk in streamclone.stream_out(repo, untrusted=True):
+        for chunk in streamclone.stream_out(repo):
             yield chunk
     except streamclone.StreamException, inst:
         yield str(inst)
--- a/mercurial/sshserver.py	Sun Feb 07 15:08:26 2010 +0100
+++ b/mercurial/sshserver.py	Sun Feb 07 15:31:53 2010 +0100
@@ -91,7 +91,7 @@
         capabilities: space separated list of tokens
         '''
         caps = copy.copy(self.caps)
-        if self.ui.configbool('server', 'uncompressed'):
+        if streamclone.allowed(self.repo.ui):
             caps.append('stream=%d' % self.repo.changelog.version)
         self.respond("capabilities: %s\n" % (' '.join(caps),))
 
--- a/mercurial/streamclone.py	Sun Feb 07 15:08:26 2010 +0100
+++ b/mercurial/streamclone.py	Sun Feb 07 15:31:53 2010 +0100
@@ -33,11 +33,14 @@
 #
 #   server writes out raw file data.
 
-def stream_out(repo, untrusted=False):
+def allowed(ui):
+    return ui.configbool('server', 'uncompressed', untrusted=True)
+
+def stream_out(repo):
     '''stream out all metadata files in repository.
     writes to file-like object, must support write() and optional flush().'''
 
-    if not repo.ui.configbool('server', 'uncompressed', untrusted=untrusted):
+    if not allowed(repo.ui):
         raise StreamException(1)
 
     entries = []