Add a --max-depth option to git cl split
For some types of changes, git cl split generates too many small CLs.
--max-depth provides one way of generating larger CLs when the author
judges that the larger CLs do not adversely affect reviewability (e.g.
20x 1 line CLs packed into 1x 20 line CL is generally fine).
Fixed: 777781
Change-Id: I64426ff4723fbc412fbc47f3cc12767433aeb8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3933974
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index d69a1cc..869bbe3 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4509,6 +4509,14 @@
help='Sends your change to the CQ after an approval. Only '
'works on repos that have the Auto-Submit label '
'enabled')
+ parser.add_option('--max-depth',
+ type='int',
+ default=0,
+ help='The max depth to look for OWNERS files. Useful for '
+ 'controlling the granularity of the split CLs, e.g. '
+ '--max-depth=1 will only split by top-level '
+ 'directory. Specifying a value less than 1 means no '
+ 'limit on max depth.')
options, _ = parser.parse_args(args)
if not options.description_file:
@@ -4517,10 +4525,10 @@
def WrappedCMDupload(args):
return CMDupload(OptionParser(), args)
- return split_cl.SplitCl(
- options.description_file, options.comment_file, Changelist,
- WrappedCMDupload, options.dry_run, options.cq_dry_run,
- options.enable_auto_submit, settings.GetRoot())
+ return split_cl.SplitCl(options.description_file, options.comment_file,
+ Changelist, WrappedCMDupload, options.dry_run,
+ options.cq_dry_run, options.enable_auto_submit,
+ options.max_depth, settings.GetRoot())
@subcommand.usage('DEPRECATED')