Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hgweb/hgweb_mod.py @ 2612:ffb895f16925
add support for streaming clone.
existing clone code uses pull to get changes from remote repo. is very
slow, uses lots of memory and cpu.
new clone code has server write file data straight to client, client
writes file data straight to disk. memory and cpu used are very low,
clone is much faster over lan.
new client can still clone with pull, can still clone from older servers.
new server can still serve older clients.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 14 Jul 2006 11:17:22 -0700 |
parents | a20a1bb0c396 |
children | 5a5852a417b1 |
comparison
equal
deleted
inserted
replaced
2611:1b4eb1f92433 | 2612:ffb895f16925 |
---|---|
9 import os | 9 import os |
10 import os.path | 10 import os.path |
11 import mimetypes | 11 import mimetypes |
12 from mercurial.demandload import demandload | 12 from mercurial.demandload import demandload |
13 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile") | 13 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile") |
14 demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,templater") | 14 demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone") |
15 demandload(globals(), "mercurial:templater") | |
15 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile") | 16 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile") |
16 from mercurial.node import * | 17 from mercurial.node import * |
17 from mercurial.i18n import gettext as _ | 18 from mercurial.i18n import gettext as _ |
18 | 19 |
19 def _up(p): | 20 def _up(p): |
857 "static")) | 858 "static")) |
858 req.write(staticfile(static, fname, req) | 859 req.write(staticfile(static, fname, req) |
859 or self.t("error", error="%r not found" % fname)) | 860 or self.t("error", error="%r not found" % fname)) |
860 | 861 |
861 def do_capabilities(self, req): | 862 def do_capabilities(self, req): |
862 resp = 'unbundle' | 863 resp = 'unbundle stream=%d' % (self.repo.revlogversion,) |
863 req.httphdr("application/mercurial-0.1", length=len(resp)) | 864 req.httphdr("application/mercurial-0.1", length=len(resp)) |
864 req.write(resp) | 865 req.write(resp) |
865 | 866 |
866 def check_perm(self, req, op, default): | 867 def check_perm(self, req, op, default): |
867 '''check permission for operation based on user auth. | 868 '''check permission for operation based on user auth. |
948 finally: | 949 finally: |
949 lock.release() | 950 lock.release() |
950 finally: | 951 finally: |
951 fp.close() | 952 fp.close() |
952 os.unlink(tempname) | 953 os.unlink(tempname) |
954 | |
955 def do_stream_out(self, req): | |
956 req.httphdr("application/mercurial-0.1") | |
957 streamclone.stream_out(self.repo, req) |