mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
upload: Automatically --cc folks in review.URL.autocopy
The upload command will read review.URL.autocopy from the project's configuration and append the list of e-mails specified to the --cc argument of the upload command if a non-empty --re argument was provided. Change-Id: I2424517d17dd3444b20f0e6a003be6e70b8904f6 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
feb39d61ef
commit
08a3f68d38
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import copy
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -83,6 +84,14 @@ to "true" then repo will assume you always answer "y" at the prompt,
|
|||||||
and will not prompt you further. If it is set to "false" then repo
|
and will not prompt you further. If it is set to "false" then repo
|
||||||
will assume you always answer "n", and will abort.
|
will assume you always answer "n", and will abort.
|
||||||
|
|
||||||
|
review.URL.autocopy:
|
||||||
|
|
||||||
|
To automatically copy a user or mailing list to all uploaded reviews,
|
||||||
|
you can set a per-project or global Git option to do so. Specifically,
|
||||||
|
review.URL.autocopy can be set to a comma separated list of reviewers
|
||||||
|
who you always want copied on all uploads with a non-empty --re
|
||||||
|
argument.
|
||||||
|
|
||||||
The URL must match the review URL listed in the manifest XML file,
|
The URL must match the review URL listed in the manifest XML file,
|
||||||
or in the .git/config within the project. For example:
|
or in the .git/config within the project. For example:
|
||||||
|
|
||||||
@ -92,6 +101,7 @@ or in the .git/config within the project. For example:
|
|||||||
|
|
||||||
[review "http://review.example.com/"]
|
[review "http://review.example.com/"]
|
||||||
autoupload = true
|
autoupload = true
|
||||||
|
autocopy = johndoe@company.com,my-team-alias@company.com
|
||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
@ -219,6 +229,19 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
|
|
||||||
self._UploadAndReport(todo, people)
|
self._UploadAndReport(todo, people)
|
||||||
|
|
||||||
|
def _AppendAutoCcList(self, branch, people):
|
||||||
|
"""
|
||||||
|
Appends the list of users in the CC list in the git project's config if a
|
||||||
|
non-empty reviewer list was found.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name = branch.name
|
||||||
|
project = branch.project
|
||||||
|
key = 'review.%s.autocopy' % project.GetBranch(name).remote.review
|
||||||
|
raw_list = project.config.GetString(key)
|
||||||
|
if not raw_list is None and len(people[0]) > 0:
|
||||||
|
people[1].extend([entry.strip() for entry in raw_list.split(',')])
|
||||||
|
|
||||||
def _FindGerritChange(self, branch):
|
def _FindGerritChange(self, branch):
|
||||||
last_pub = branch.project.WasPublished(branch.name)
|
last_pub = branch.project.WasPublished(branch.name)
|
||||||
if last_pub is None:
|
if last_pub is None:
|
||||||
@ -290,10 +313,13 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
branch.replace_changes = to_replace
|
branch.replace_changes = to_replace
|
||||||
self._UploadAndReport([branch], people)
|
self._UploadAndReport([branch], people)
|
||||||
|
|
||||||
def _UploadAndReport(self, todo, people):
|
def _UploadAndReport(self, todo, original_people):
|
||||||
have_errors = False
|
have_errors = False
|
||||||
for branch in todo:
|
for branch in todo:
|
||||||
try:
|
try:
|
||||||
|
people = copy.deepcopy(original_people)
|
||||||
|
self._AppendAutoCcList(branch, people)
|
||||||
|
|
||||||
branch.UploadForReview(people)
|
branch.UploadForReview(people)
|
||||||
branch.uploaded = True
|
branch.uploaded = True
|
||||||
except UploadError, e:
|
except UploadError, e:
|
||||||
|
Loading…
Reference in New Issue
Block a user