OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2007 Google Inc. | 3 # Copyright 2007 Google Inc. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 else: | 1339 else: |
1340 uploaded_diff_file = [("data", "data.diff", data)] | 1340 uploaded_diff_file = [("data", "data.diff", data)] |
1341 ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) | 1341 ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) |
1342 response_body = rpc_server.Send("/upload", body, content_type=ctype) | 1342 response_body = rpc_server.Send("/upload", body, content_type=ctype) |
1343 if not options.download_base or not uploaded_diff_file: | 1343 if not options.download_base or not uploaded_diff_file: |
1344 lines = response_body.splitlines() | 1344 lines = response_body.splitlines() |
1345 if len(lines) >= 2: | 1345 if len(lines) >= 2: |
1346 msg = lines[0] | 1346 msg = lines[0] |
1347 patchset = lines[1].strip() | 1347 patchset = lines[1].strip() |
1348 patches = [x.split(" ", 1) for x in lines[2:]] | 1348 patches = [x.split(" ", 1) for x in lines[2:]] |
| 1349 for patch_pair in patches: |
| 1350 # On Windows if a file has property changes its filename uses '\' |
| 1351 # instead of '/'. Perhaps this change should be made (also) on the |
| 1352 # server when it is decoding the patch file sent by the client, but |
| 1353 # we do it here as well to be safe. |
| 1354 patch_pair[1] = patch_pair[1].replace('\\', '/') |
1349 else: | 1355 else: |
1350 msg = response_body | 1356 msg = response_body |
1351 else: | 1357 else: |
1352 msg = response_body | 1358 msg = response_body |
1353 StatusUpdate(msg) | 1359 StatusUpdate(msg) |
1354 if not response_body.startswith("Issue created.") and \ | 1360 if not response_body.startswith("Issue created.") and \ |
1355 not response_body.startswith("Issue updated."): | 1361 not response_body.startswith("Issue updated."): |
1356 sys.exit(0) | 1362 sys.exit(0) |
1357 issue = msg[msg.rfind("/")+1:] | 1363 issue = msg[msg.rfind("/")+1:] |
1358 | 1364 |
(...skipping 13 matching lines...) Expand all Loading... |
1372 try: | 1378 try: |
1373 RealMain(sys.argv) | 1379 RealMain(sys.argv) |
1374 except KeyboardInterrupt: | 1380 except KeyboardInterrupt: |
1375 print | 1381 print |
1376 StatusUpdate("Interrupted.") | 1382 StatusUpdate("Interrupted.") |
1377 sys.exit(1) | 1383 sys.exit(1) |
1378 | 1384 |
1379 | 1385 |
1380 if __name__ == "__main__": | 1386 if __name__ == "__main__": |
1381 main() | 1387 main() |
OLD | NEW |