diff options
author | Shawn O. Pearce <sop@google.com> | 2008-11-11 17:12:43 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2008-11-12 09:12:19 -0800 |
commit | c99883fee990a1baa7e0bf5f854c7485b7d0f0d9 (patch) | |
tree | 870cfd73b1fc2faf53da6d613ae820984695b305 /gerrit_upload.py | |
parent | ec18b4bac4f3c0760c26e83b8ade01ad1c815a9b (diff) | |
download | git-repo-c99883fee990a1baa7e0bf5f854c7485b7d0f0d9.tar.gz |
Teach 'repo upload --replace' how to add replacement patch setsv1.3
Users are prompted with the list of known changes we are about
to upload, and they can fill out the current change numbers for
any changes which already exist in the data store. For each of
those changes the change number and commit id is sent as part of
the upload request, so Gerrit can insert the new commit as a new
patch set of the existing change, rather than make a new change.
This facility permits developers to replace a patch so they can
address comments made on a prior version of the same change.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'gerrit_upload.py')
-rwxr-xr-x | gerrit_upload.py | 9 |
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) |