diff options
-rw-r--r-- | subcmds/upload.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 4fa5b432..ba532461 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -13,6 +13,7 @@ | |||
13 | # See the License for the specific language governing permissions and | 13 | # See the License for the specific language governing permissions and |
14 | # limitations under the License. | 14 | # limitations under the License. |
15 | 15 | ||
16 | import copy | ||
16 | import re | 17 | import re |
17 | import sys | 18 | import sys |
18 | 19 | ||
@@ -83,6 +84,14 @@ to "true" then repo will assume you always answer "y" at the prompt, | |||
83 | and will not prompt you further. If it is set to "false" then repo | 84 | and will not prompt you further. If it is set to "false" then repo |
84 | will assume you always answer "n", and will abort. | 85 | will assume you always answer "n", and will abort. |
85 | 86 | ||
87 | review.URL.autocopy: | ||
88 | |||
89 | To automatically copy a user or mailing list to all uploaded reviews, | ||
90 | you can set a per-project or global Git option to do so. Specifically, | ||
91 | review.URL.autocopy can be set to a comma separated list of reviewers | ||
92 | who you always want copied on all uploads with a non-empty --re | ||
93 | argument. | ||
94 | |||
86 | The URL must match the review URL listed in the manifest XML file, | 95 | The URL must match the review URL listed in the manifest XML file, |
87 | or in the .git/config within the project. For example: | 96 | or in the .git/config within the project. For example: |
88 | 97 | ||
@@ -92,6 +101,7 @@ or in the .git/config within the project. For example: | |||
92 | 101 | ||
93 | [review "http://review.example.com/"] | 102 | [review "http://review.example.com/"] |
94 | autoupload = true | 103 | autoupload = true |
104 | autocopy = johndoe@company.com,my-team-alias@company.com | ||
95 | 105 | ||
96 | References | 106 | References |
97 | ---------- | 107 | ---------- |
@@ -219,6 +229,19 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
219 | 229 | ||
220 | self._UploadAndReport(todo, people) | 230 | self._UploadAndReport(todo, people) |
221 | 231 | ||
232 | def _AppendAutoCcList(self, branch, people): | ||
233 | """ | ||
234 | Appends the list of users in the CC list in the git project's config if a | ||
235 | non-empty reviewer list was found. | ||
236 | """ | ||
237 | |||
238 | name = branch.name | ||
239 | project = branch.project | ||
240 | key = 'review.%s.autocopy' % project.GetBranch(name).remote.review | ||
241 | raw_list = project.config.GetString(key) | ||
242 | if not raw_list is None and len(people[0]) > 0: | ||
243 | people[1].extend([entry.strip() for entry in raw_list.split(',')]) | ||
244 | |||
222 | def _FindGerritChange(self, branch): | 245 | def _FindGerritChange(self, branch): |
223 | last_pub = branch.project.WasPublished(branch.name) | 246 | last_pub = branch.project.WasPublished(branch.name) |
224 | if last_pub is None: | 247 | if last_pub is None: |
@@ -290,10 +313,13 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
290 | branch.replace_changes = to_replace | 313 | branch.replace_changes = to_replace |
291 | self._UploadAndReport([branch], people) | 314 | self._UploadAndReport([branch], people) |
292 | 315 | ||
293 | def _UploadAndReport(self, todo, people): | 316 | def _UploadAndReport(self, todo, original_people): |
294 | have_errors = False | 317 | have_errors = False |
295 | for branch in todo: | 318 | for branch in todo: |
296 | try: | 319 | try: |
320 | people = copy.deepcopy(original_people) | ||
321 | self._AppendAutoCcList(branch, people) | ||
322 | |||
297 | branch.UploadForReview(people) | 323 | branch.UploadForReview(people) |
298 | branch.uploaded = True | 324 | branch.uploaded = True |
299 | except UploadError, e: | 325 | except UploadError, e: |