Skip to content

Commit a089281

Browse files
Thiago PerrottaLUCI CQ
Thiago Perrotta
authored and
LUCI CQ
committed
roll_dep: support multiple -r/--reviewer arguments
Currently multiple reviewers can only be provided with a comma-separated list, for example: -r foo,bar,baz This CL adds support for multiple -r arguments such as: -r foo -r bar -r baz Or even: -r foo,bar -r baz This makes it consistent (and thus less confusing) with `git cl upload` which does accept multiple -r arguments. Bug: none Change-Id: I27d03601b488c0c5b27568d86dcb4ed66df6b76f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3863675 Commit-Queue: Thiago Perrotta <[email protected]> Reviewed-by: Aravind Vasudevan <[email protected]> Auto-Submit: Thiago Perrotta <[email protected]>
1 parent a3a95d4 commit a089281

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

roll_dep.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import print_function
1313

1414
import argparse
15+
import itertools
1516
import os
1617
import re
1718
import subprocess2
@@ -200,9 +201,13 @@ def main():
200201
'--ignore-dirty-tree', action='store_true',
201202
help='Roll anyways, even if there is a diff.')
202203
parser.add_argument(
203-
'-r', '--reviewer',
204-
help='To specify multiple reviewers, use comma separated list, e.g. '
205-
'-r joe,jane,john. Defaults to @chromium.org')
204+
'-r',
205+
'--reviewer',
206+
action='append',
207+
help=
208+
'To specify multiple reviewers, either use a comma separated list, e.g. '
209+
'-r joe,jane,john or provide the flag multiple times, e.g. '
210+
'-r joe -r jane. Defaults to @chromium.org')
206211
parser.add_argument('-b', '--bug', help='Associate a bug number to the roll')
207212
# It is important that --no-log continues to work, as it is used by
208213
# internal -> external rollers. Please do not remove or break it.
@@ -230,7 +235,7 @@ def main():
230235
'Can\'t use multiple paths to roll simultaneously and --key')
231236
reviewers = None
232237
if args.reviewer:
233-
reviewers = args.reviewer.split(',')
238+
reviewers = list(itertools.chain(*[r.split(',') for r in args.reviewer]))
234239
for i, r in enumerate(reviewers):
235240
if not '@' in r:
236241
reviewers[i] = r + '@chromium.org'

tests/roll_dep_test.py

+16
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ def testRollsDep(self):
114114
self.assertIn(expected_message, stdout)
115115
self.assertIn(expected_message, commit_message)
116116

117+
def testRollsDepReviewers(self):
118+
if not self.enabled:
119+
return
120+
121+
stdout, stderr, returncode = self.call([
122+
ROLL_DEP, 'src/foo', '-r', '[email protected]', '-r',
123+
124+
])
125+
126+
self.assertEqual(stderr, '')
127+
self.assertEqual(returncode, 0)
128+
129+
130+
131+
self.assertIn(expected_message, stdout)
132+
117133
def testRollsDepToSpecificRevision(self):
118134
if not self.enabled:
119135
return

0 commit comments

Comments
 (0)