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