Show More
@@ -35,7 +35,7 b' class webproto(object):' | |||||
35 | def redirect(self): |
|
35 | def redirect(self): | |
36 | self.oldio = sys.stdout, sys.stderr |
|
36 | self.oldio = sys.stdout, sys.stderr | |
37 | sys.stderr = sys.stdout = cStringIO.StringIO() |
|
37 | sys.stderr = sys.stdout = cStringIO.StringIO() | |
38 |
def respon |
|
38 | def sendresponse(self, s): | |
39 | self.req.respond(HTTP_OK, HGTYPE, length=len(s)) |
|
39 | self.req.respond(HTTP_OK, HGTYPE, length=len(s)) | |
40 | self.response = s |
|
40 | self.response = s | |
41 | def sendchangegroup(self, cg): |
|
41 | def sendchangegroup(self, cg): | |
@@ -51,7 +51,7 b' class webproto(object):' | |||||
51 | self.req.respond(HTTP_OK, HGTYPE) |
|
51 | self.req.respond(HTTP_OK, HGTYPE) | |
52 | for chunk in source: |
|
52 | for chunk in source: | |
53 | self.req.write(chunk) |
|
53 | self.req.write(chunk) | |
54 |
def respon |
|
54 | def sendpushresponse(self, ret): | |
55 | val = sys.stdout.getvalue() |
|
55 | val = sys.stdout.getvalue() | |
56 | sys.stdout, sys.stderr = self.oldio |
|
56 | sys.stdout, sys.stderr = self.oldio | |
57 | self.req.respond(HTTP_OK, HGTYPE) |
|
57 | self.req.respond(HTTP_OK, HGTYPE) |
@@ -50,7 +50,7 b' class sshserver(object):' | |||||
50 | return self.getargs(name)[0] |
|
50 | return self.getargs(name)[0] | |
51 |
|
51 | |||
52 | def getfile(self, fpout): |
|
52 | def getfile(self, fpout): | |
53 |
self.respon |
|
53 | self.sendresponse('') | |
54 | count = int(self.fin.readline()) |
|
54 | count = int(self.fin.readline()) | |
55 | while count: |
|
55 | while count: | |
56 | fpout.write(self.fin.read(count)) |
|
56 | fpout.write(self.fin.read(count)) | |
@@ -59,7 +59,7 b' class sshserver(object):' | |||||
59 | def redirect(self): |
|
59 | def redirect(self): | |
60 | pass |
|
60 | pass | |
61 |
|
61 | |||
62 |
def respon |
|
62 | def sendresponse(self, v): | |
63 | self.fout.write("%d\n" % len(v)) |
|
63 | self.fout.write("%d\n" % len(v)) | |
64 | self.fout.write(v) |
|
64 | self.fout.write(v) | |
65 | self.fout.flush() |
|
65 | self.fout.flush() | |
@@ -78,9 +78,9 b' class sshserver(object):' | |||||
78 | self.fout.write(chunk) |
|
78 | self.fout.write(chunk) | |
79 | self.fout.flush() |
|
79 | self.fout.flush() | |
80 |
|
80 | |||
81 |
def respon |
|
81 | def sendpushresponse(self, ret): | |
82 |
self.respon |
|
82 | self.sendresponse('') | |
83 |
self.respon |
|
83 | self.sendresponse(str(ret)) | |
84 |
|
84 | |||
85 | def serve_forever(self): |
|
85 | def serve_forever(self): | |
86 | try: |
|
86 | try: | |
@@ -100,8 +100,8 b' class sshserver(object):' | |||||
100 | if impl: |
|
100 | if impl: | |
101 | r = impl() |
|
101 | r = impl() | |
102 | if r is not None: |
|
102 | if r is not None: | |
103 |
self.respon |
|
103 | self.sendresponse(r) | |
104 |
else: self.respon |
|
104 | else: self.sendresponse("") | |
105 | return cmd != '' |
|
105 | return cmd != '' | |
106 |
|
106 | |||
107 | def do_lock(self): |
|
107 | def do_lock(self): | |
@@ -122,10 +122,10 b' class sshserver(object):' | |||||
122 | '''DEPRECATED''' |
|
122 | '''DEPRECATED''' | |
123 |
|
123 | |||
124 | if not self.lock: |
|
124 | if not self.lock: | |
125 |
self.respon |
|
125 | self.sendresponse("not locked") | |
126 | return |
|
126 | return | |
127 |
|
127 | |||
128 |
self.respon |
|
128 | self.sendresponse("") | |
129 | r = self.repo.addchangegroup(self.fin, 'serve', self._client(), |
|
129 | r = self.repo.addchangegroup(self.fin, 'serve', self._client(), | |
130 | lock=self.lock) |
|
130 | lock=self.lock) | |
131 | return str(r) |
|
131 | return str(r) |
@@ -138,7 +138,7 b' def dispatch(repo, proto, command):' | |||||
138 | args = proto.getargs(spec) |
|
138 | args = proto.getargs(spec) | |
139 | r = func(repo, proto, *args) |
|
139 | r = func(repo, proto, *args) | |
140 | if r != None: |
|
140 | if r != None: | |
141 |
proto.respon |
|
141 | proto.sendresponse(r) | |
142 |
|
142 | |||
143 | def between(repo, proto, pairs): |
|
143 | def between(repo, proto, pairs): | |
144 | pairs = [decodelist(p, '-') for p in pairs.split(" ")] |
|
144 | pairs = [decodelist(p, '-') for p in pairs.split(" ")] | |
@@ -262,7 +262,7 b' def unbundle(repo, proto, heads):' | |||||
262 | sys.stderr.write("abort: %s\n" % inst) |
|
262 | sys.stderr.write("abort: %s\n" % inst) | |
263 | finally: |
|
263 | finally: | |
264 | lock.release() |
|
264 | lock.release() | |
265 |
proto.respon |
|
265 | proto.sendpushresponse(r) | |
266 |
|
266 | |||
267 | finally: |
|
267 | finally: | |
268 | fp.close() |
|
268 | fp.close() |
General Comments 0
You need to be logged in to leave comments.
Login now