summaryrefslogtreecommitdiffstats
path: root/subcmds/upload.py
diff options
context:
space:
mode:
authorbijia <bijia@xiaomi.com>2013-11-28 09:19:22 +0800
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2014-03-04 00:51:30 +0000
commit093fdb6587bba081c4d34eb9ea500149b1090280 (patch)
treea8edab76db87f3ff70536e01b11bc5c034a0729e /subcmds/upload.py
parent2fb6466f795eb30c1dfa598501f5b5d2981e6a5f (diff)
downloadgit-repo-093fdb6587bba081c4d34eb9ea500149b1090280.tar.gz
Add reviewers automatically from project's git config
The `review.URL.autocopy` setting sends email notification to the named reviewers, but does not add them as reviewer on the uploaded change. Add a new setting `review.URL.autoreviewer`. The named reviewers will be added as reviewer on the uploaded change. Change-Id: I3fddfb49edf346f8724fe15b84be8c39d43e7e65 Signed-off-by: bijia <bijia@xiaomi.com>
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r--subcmds/upload.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 526dcd57..e2fa261e 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -89,6 +89,11 @@ to "true" then repo will assume you always answer "y" at the prompt,
89and will not prompt you further. If it is set to "false" then repo 89and will not prompt you further. If it is set to "false" then repo
90will assume you always answer "n", and will abort. 90will assume you always answer "n", and will abort.
91 91
92review.URL.autoreviewer:
93
94To automatically append a user or mailing list to reviews, you can set
95a per-project or global Git option to do so.
96
92review.URL.autocopy: 97review.URL.autocopy:
93 98
94To automatically copy a user or mailing list to all uploaded reviews, 99To automatically copy a user or mailing list to all uploaded reviews,
@@ -293,14 +298,20 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
293 298
294 self._UploadAndReport(opt, todo, people) 299 self._UploadAndReport(opt, todo, people)
295 300
296 def _AppendAutoCcList(self, branch, people): 301 def _AppendAutoList(self, branch, people):
297 """ 302 """
303 Appends the list of reviewers in the git project's config.
298 Appends the list of users in the CC list in the git project's config if a 304 Appends the list of users in the CC list in the git project's config if a
299 non-empty reviewer list was found. 305 non-empty reviewer list was found.
300 """ 306 """
301
302 name = branch.name 307 name = branch.name
303 project = branch.project 308 project = branch.project
309
310 key = 'review.%s.autoreviewer' % project.GetBranch(name).remote.review
311 raw_list = project.config.GetString(key)
312 if not raw_list is None:
313 people[0].extend([entry.strip() for entry in raw_list.split(',')])
314
304 key = 'review.%s.autocopy' % project.GetBranch(name).remote.review 315 key = 'review.%s.autocopy' % project.GetBranch(name).remote.review
305 raw_list = project.config.GetString(key) 316 raw_list = project.config.GetString(key)
306 if not raw_list is None and len(people[0]) > 0: 317 if not raw_list is None and len(people[0]) > 0:
@@ -323,7 +334,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
323 for branch in todo: 334 for branch in todo:
324 try: 335 try:
325 people = copy.deepcopy(original_people) 336 people = copy.deepcopy(original_people)
326 self._AppendAutoCcList(branch, people) 337 self._AppendAutoList(branch, people)
327 338
328 # Check if there are local changes that may have been forgotten 339 # Check if there are local changes that may have been forgotten
329 if branch.project.HasChanges(): 340 if branch.project.HasChanges():