summaryrefslogtreecommitdiffstats
path: root/gerrit_upload.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit_upload.py')
-rwxr-xr-xgerrit_upload.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gerrit_upload.py b/gerrit_upload.py
index f8dccdc5..32451408 100755
--- a/gerrit_upload.py
+++ b/gerrit_upload.py
@@ -75,6 +75,7 @@ def UploadBundle(project,
75 dest_branch, 75 dest_branch,
76 src_branch, 76 src_branch,
77 bases, 77 bases,
78 replace_changes = None,
78 save_cookies=True): 79 save_cookies=True):
79 80
80 srv = _GetRpcServer(email, server, save_cookies) 81 srv = _GetRpcServer(email, server, save_cookies)
@@ -113,6 +114,10 @@ def UploadBundle(project,
113 req.dest_branch = str(dest_branch) 114 req.dest_branch = str(dest_branch)
114 for c in revlist: 115 for c in revlist:
115 req.contained_object.append(c) 116 req.contained_object.append(c)
117 for change_id,commit_id in replace_changes.iteritems():
118 r = req.replace.add()
119 r.change_id = change_id
120 r.object_id = commit_id
116 else: 121 else:
117 req = UploadBundleContinue() 122 req = UploadBundleContinue()
118 req.bundle_id = bundle_id 123 req.bundle_id = bundle_id
@@ -148,6 +153,10 @@ def UploadBundle(project,
148 elif rsp.status_code == UploadBundleResponse.UNAUTHORIZED_USER: 153 elif rsp.status_code == UploadBundleResponse.UNAUTHORIZED_USER:
149 reason = ('Unauthorized user. Visit http://%s/hello to sign up.' 154 reason = ('Unauthorized user. Visit http://%s/hello to sign up.'
150 % server) 155 % server)
156 elif rsp.status_code == UploadBundleResponse.UNKNOWN_CHANGE:
157 reason = 'invalid change id'
158 elif rsp.status_code == UploadBundleResponse.CHANGE_CLOSED:
159 reason = 'one or more changes are closed'
151 else: 160 else:
152 reason = 'unknown error ' + str(rsp.status_code) 161 reason = 'unknown error ' + str(rsp.status_code)
153 raise UploadError(reason) 162 raise UploadError(reason)