Show More
@@ -66,3 +66,8 def call(repo, req, cmd): | |||||
66 | sys.stdout, sys.stderr = p.oldio |
|
66 | sys.stdout, sys.stderr = p.oldio | |
67 | req.respond(HTTP_OK, HGTYPE) |
|
67 | req.respond(HTTP_OK, HGTYPE) | |
68 | return ['%d\n%s' % (rsp.res, val)] |
|
68 | return ['%d\n%s' % (rsp.res, val)] | |
|
69 | elif isinstance(rsp, wireproto.pusherr): | |||
|
70 | sys.stdout, sys.stderr = p.oldio | |||
|
71 | rsp = '0\n%s\n' % rsp.res | |||
|
72 | req.respond(HTTP_OK, HGTYPE, length=len(rsp)) | |||
|
73 | return [rsp] |
@@ -79,6 +79,9 class sshserver(object): | |||||
79 | self.sendresponse('') |
|
79 | self.sendresponse('') | |
80 | self.sendresponse(str(rsp.res)) |
|
80 | self.sendresponse(str(rsp.res)) | |
81 |
|
81 | |||
|
82 | def sendpusherror(self, rsp): | |||
|
83 | self.sendresponse(rsp.res) | |||
|
84 | ||||
82 | def serve_forever(self): |
|
85 | def serve_forever(self): | |
83 | try: |
|
86 | try: | |
84 | while self.serve_one(): |
|
87 | while self.serve_one(): | |
@@ -92,6 +95,7 class sshserver(object): | |||||
92 | str: sendresponse, |
|
95 | str: sendresponse, | |
93 | wireproto.streamres: sendstream, |
|
96 | wireproto.streamres: sendstream, | |
94 | wireproto.pushres: sendpushresponse, |
|
97 | wireproto.pushres: sendpushresponse, | |
|
98 | wireproto.pusherr: sendpusherror, | |||
95 | } |
|
99 | } | |
96 |
|
100 | |||
97 | def serve_one(self): |
|
101 | def serve_one(self): |
@@ -142,6 +142,10 class pushres(object): | |||||
142 | def __init__(self, res): |
|
142 | def __init__(self, res): | |
143 | self.res = res |
|
143 | self.res = res | |
144 |
|
144 | |||
|
145 | class pusherr(object): | |||
|
146 | def __init__(self, res): | |||
|
147 | self.res = res | |||
|
148 | ||||
145 | def dispatch(repo, proto, command): |
|
149 | def dispatch(repo, proto, command): | |
146 | func, spec = commands[command] |
|
150 | func, spec = commands[command] | |
147 | args = proto.getargs(spec) |
|
151 | args = proto.getargs(spec) | |
@@ -285,7 +289,7 def unbundle(repo, proto, heads): | |||||
285 |
|
289 | |||
286 | # fail early if possible |
|
290 | # fail early if possible | |
287 | if not check_heads(): |
|
291 | if not check_heads(): | |
288 | return 'unsynced changes' |
|
292 | return pusherr('unsynced changes') | |
289 |
|
293 | |||
290 | # write bundle data to temporary file because it can be big |
|
294 | # write bundle data to temporary file because it can be big | |
291 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') |
|
295 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') | |
@@ -298,7 +302,7 def unbundle(repo, proto, heads): | |||||
298 | if not check_heads(): |
|
302 | if not check_heads(): | |
299 | # someone else committed/pushed/unbundled while we |
|
303 | # someone else committed/pushed/unbundled while we | |
300 | # were transferring data |
|
304 | # were transferring data | |
301 | return 'unsynced changes' |
|
305 | return pusherr('unsynced changes') | |
302 |
|
306 | |||
303 | # push can proceed |
|
307 | # push can proceed | |
304 | fp.seek(0) |
|
308 | fp.seek(0) |
General Comments 0
You need to be logged in to leave comments.
Login now