Skip to content

Commit 9930ec3

Browse files
committed
cc_maintainers: use mailmap
Make the address matching take into account mailmap. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0ccdafc commit 9930ec3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/patch/cc_maintainers/test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
]
2929
}
3030

31+
local_map = ["Vladimir Oltean <[email protected]> <[email protected]>"]
32+
3133

3234
def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]:
3335
patch = thing
@@ -77,6 +79,28 @@ def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]:
7779
found = expected.intersection(included)
7880
missing = expected.difference(included)
7981
missing_blamed = blamed.difference(included)
82+
83+
# Last resort, sift thru aliases
84+
if len(missing):
85+
with open('.mailmap', 'r') as f:
86+
mmap_lines = f.readlines()
87+
mmap_lines += local_map
88+
89+
mapped = set()
90+
for m in missing:
91+
for line in mmap_lines:
92+
if m in line:
93+
mmap_emails = emailpat.findall(line)
94+
if m not in mmap_emails: # re-check the match with the real regex
95+
continue
96+
for have in included:
97+
if have in mmap_emails:
98+
mapped.add(m)
99+
100+
found.update(mapped)
101+
missing.difference_update(mapped)
102+
missing_blamed.difference_update(mapped)
103+
80104
if len(missing_blamed):
81105
return 1, f"{len(missing_blamed)} blamed authors not CCed: {' '.join(missing_blamed)}; " + \
82106
f"{len(missing)} maintainers not CCed: {' '.join(missing)}"

0 commit comments

Comments
 (0)