changeset 10377:04e1e6743809

streamclone: allow uncompressed clones by default
author Matt Mackall <mpm@selenic.com>
date Sun, 07 Feb 2010 15:31:53 +0100
parents a2950e053614
children e1401c74572f a78bfaf988e1
files mercurial/hgweb/protocol.py mercurial/sshserver.py mercurial/streamclone.py
diffstat 3 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 = []