forked from kuba-moo/nipa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the address matching take into account mailmap. Signed-off-by: Jakub Kicinski <[email protected]>
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ | |
] | ||
} | ||
|
||
local_map = ["Vladimir Oltean <[email protected]> <[email protected]>"] | ||
|
||
|
||
def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]: | ||
patch = thing | ||
|
@@ -77,6 +79,28 @@ def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]: | |
found = expected.intersection(included) | ||
missing = expected.difference(included) | ||
missing_blamed = blamed.difference(included) | ||
|
||
# Last resort, sift thru aliases | ||
if len(missing): | ||
with open('.mailmap', 'r') as f: | ||
mmap_lines = f.readlines() | ||
mmap_lines += local_map | ||
|
||
mapped = set() | ||
for m in missing: | ||
for line in mmap_lines: | ||
if m in line: | ||
mmap_emails = emailpat.findall(line) | ||
if m not in mmap_emails: # re-check the match with the real regex | ||
continue | ||
for have in included: | ||
if have in mmap_emails: | ||
mapped.add(m) | ||
|
||
found.update(mapped) | ||
missing.difference_update(mapped) | ||
missing_blamed.difference_update(mapped) | ||
|
||
if len(missing_blamed): | ||
return 1, f"{len(missing_blamed)} blamed authors not CCed: {' '.join(missing_blamed)}; " + \ | ||
f"{len(missing)} maintainers not CCed: {' '.join(missing)}" | ||
|