Skip to content

Commit

Permalink
cc_maintainers: use mailmap
Browse files Browse the repository at this point in the history
Make the address matching take into account mailmap.

Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Jul 20, 2022
1 parent 0ccdafc commit 9930ec3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/patch/cc_maintainers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
]
}

local_map = ["Vladimir Oltean <[email protected]> <[email protected]>"]


def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]:
patch = thing
Expand Down Expand Up @@ -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)}"
Expand Down

0 comments on commit 9930ec3

Please sign in to comment.