Feature or enhancement
Proposal:
Proposal: Add .mailmap Validation with mailmap-checker
Summary
Add automated .mailmap validation to CPython's patchcheck.py and pre-commit configuration using the mailmap-checker tool, ensuring proper formatting, completeness, and preventing duplicate entries.
Background
The .mailmap file was introduced in PR #103696 to map contributor name/email changes in git history. As noted by @zware in that discussion:
"Since we've now started down this road, there may be other contributors who would like to be similarly added here..."
Currently, there's no automated validation, which can lead to:
- Syntax errors going undetected
- Unmapped contributor identities across email changes
- Duplicate or conflicting entries
- Manual maintenance burden
Proposed Solution
Use the existing mailmap-checker tool (https://github.com/cansarigol/mailmap-checker) which:
- Detects unmapped Git identities by scanning commit history
- Groups authors by email and local-part
- Validates
.mailmap syntax and completeness
- Can auto-fix and suggest entries
Implementation
1. Add to Tools/scripts/patchcheck.py:
def mailmap_checked():
"""Check if .mailmap is properly maintained."""
try:
subprocess.check_call(
['mailmap-checker', 'check'],
cwd=SRCDIR,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
return True
except subprocess.CalledProcessError:
print("Mailmap check failed. Run 'mailmap-checker check' to see details.")
return False
except (FileNotFoundError, OSError):
print("mailmap-checker not installed, skipping mailmap check.")
return True
2. Add to .pre-commit-config.yaml:
- repo: https://github.com/cansarigol/mailmap-checker
rev: v1.0.0 # Use latest stable version
hooks:
- id: mailmap-check
3. Update documentation:
Add to Doc/developers/patchcheck.rst or contributing guide:
Mailmap Validation
------------------
CPython uses `.mailmap` to consolidate contributor identities. To validate:
.. code-block:: bash
# Check for unmapped identities
mailmap-checker check
# Auto-fix (preview first)
mailmap-checker fix --dry-run
mailmap-checker fix
Related
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Feature or enhancement
Proposal:
Proposal: Add .mailmap Validation with mailmap-checker
Summary
Add automated
.mailmapvalidation to CPython'spatchcheck.pyand pre-commit configuration using themailmap-checkertool, ensuring proper formatting, completeness, and preventing duplicate entries.Background
The
.mailmapfile was introduced in PR #103696 to map contributor name/email changes in git history. As noted by @zware in that discussion:Currently, there's no automated validation, which can lead to:
Proposed Solution
Use the existing
mailmap-checkertool (https://github.com/cansarigol/mailmap-checker) which:.mailmapsyntax and completenessImplementation
1. Add to
Tools/scripts/patchcheck.py:2. Add to
.pre-commit-config.yaml:3. Update documentation:
Add to
Doc/developers/patchcheck.rstor contributing guide:Related
.mailmapintroductionHas this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response