Commit 1af7968d authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by LUCI CQ

Reduce git cl split oversplitting.

Without this change, git cl split will create a separate CL for every
file that has per-file owners rules. This is almost always the wrong
thing to do. With this change, it will at least aggregate all such files
to their parent directory. This may under-split, but is perhaps nearer
the mark.

Change-Id: Iea7997b36d053713fa00f1261ea032e09d9c2818
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2555729
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
parent f819411f
......@@ -152,6 +152,10 @@ def GetFilesSplitByOwners(owners_database, files):
files_split_by_owners = collections.defaultdict(list)
for action, path in files:
enclosing_dir = owners_database.enclosing_dir_with_owners(path)
# Anything matching a per-file rule will return its own path.
# Aggregate up to the parent directory so as not to over-split.
if enclosing_dir == path:
enclosing_dir = os.path.dirname(path)
files_split_by_owners[enclosing_dir].append((action, path))
return files_split_by_owners
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment