LEFT | RIGHT |
(no file at all) | |
1 # coding=utf-8 | 1 # coding=utf-8 |
2 # (The line above is necessary so that I can use 世界 in the | 2 # (The line above is necessary so that I can use 世界 in the |
3 # *comment* below without Python getting all bent out of shape.) | 3 # *comment* below without Python getting all bent out of shape.) |
4 | 4 |
5 # Copyright 2007-2009 Google Inc. | 5 # Copyright 2007-2009 Google Inc. |
6 # | 6 # |
7 # Licensed under the Apache License, Version 2.0 (the "License"); | 7 # Licensed under the Apache License, Version 2.0 (the "License"); |
8 # you may not use this file except in compliance with the License. | 8 # you may not use this file except in compliance with the License. |
9 # You may obtain a copy of the License at | 9 # You may obtain a copy of the License at |
10 # | 10 # |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 commit_okay = True | 2017 commit_okay = True |
2018 ret = hg_commit(ui, repo, *files, message=message, user=userline) | 2018 ret = hg_commit(ui, repo, *files, message=message, user=userline) |
2019 commit_okay = False | 2019 commit_okay = False |
2020 if ret: | 2020 if ret: |
2021 raise hg_util.Abort("nothing changed") | 2021 raise hg_util.Abort("nothing changed") |
2022 | 2022 |
2023 node = repo["-1"].node() | 2023 node = repo["-1"].node() |
2024 # push to remote; if it fails for any reason, roll back | 2024 # push to remote; if it fails for any reason, roll back |
2025 try: | 2025 try: |
2026 new_heads = len(hg_heads(ui, repo).split()) | 2026 new_heads = len(hg_heads(ui, repo).split()) |
2027 » » if old_heads != new_heads and not (old_heads == 0 and new_heads
== 1): | 2027 » » if cl.desc.find("create new branch") < 0 and old_heads != new_he
ads and not (old_heads == 0 and new_heads == 1): |
2028 # Created new head, so we weren't up to date. | 2028 # Created new head, so we weren't up to date. |
2029 need_sync() | 2029 need_sync() |
2030 | 2030 |
2031 # Push changes to remote. If it works, we're committed. If not
, roll back. | 2031 # Push changes to remote. If it works, we're committed. If not
, roll back. |
2032 try: | 2032 try: |
2033 » » » if hg_push(ui, repo): | 2033 » » » if hg_push(ui, repo, new_branch=cl.desc.find("create new
branch")>=0): |
2034 raise hg_util.Abort("push error") | 2034 raise hg_util.Abort("push error") |
2035 except hg_error.Abort, e: | 2035 except hg_error.Abort, e: |
2036 if e.message.find("push creates new heads") >= 0: | 2036 if e.message.find("push creates new heads") >= 0: |
2037 # Remote repository had changes we missed. | 2037 # Remote repository had changes we missed. |
2038 need_sync() | 2038 need_sync() |
2039 raise | 2039 raise |
2040 except urllib2.HTTPError, e: | 2040 except urllib2.HTTPError, e: |
2041 print >>sys.stderr, "pushing to remote server failed; do
you have commit permissions?" | 2041 print >>sys.stderr, "pushing to remote server failed; do
you have commit permissions?" |
2042 raise | 2042 raise |
2043 except: | 2043 except: |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3685 ctype, body = EncodeMultipartFormData(form_fields, files) | 3685 ctype, body = EncodeMultipartFormData(form_fields, files) |
3686 url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) | 3686 url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) |
3687 print "Uploading patch for " + patch[0] | 3687 print "Uploading patch for " + patch[0] |
3688 response_body = rpc_server.Send(url, body, content_type=ctype) | 3688 response_body = rpc_server.Send(url, body, content_type=ctype) |
3689 lines = response_body.splitlines() | 3689 lines = response_body.splitlines() |
3690 if not lines or lines[0] != "OK": | 3690 if not lines or lines[0] != "OK": |
3691 StatusUpdate(" --> %s" % response_body) | 3691 StatusUpdate(" --> %s" % response_body) |
3692 sys.exit(1) | 3692 sys.exit(1) |
3693 rv.append([lines[1], patch[0]]) | 3693 rv.append([lines[1], patch[0]]) |
3694 return rv | 3694 return rv |
LEFT | RIGHT |