A small command line tool to create git .mailmap files from a commit history.
Project description
What is this?
This tool, mailmap-generator
suggests a Git .mailmap
file based on the commit history.
It is intended to support you when you have a repository for which you do not have a .mailmap
file yet but want to create one.
Installation
pip install mailmap-generator
Requirements
The tool requires that git
is installed and accessible on PATH
.
How to use it?
You have to either point the tool to a directory containing a Git repository. From the terminal, the tool can be run as in the following:
Usage:
mailmap <repository>
mailmap -h | --help
mailmap --version
Options:
-h --help Show this screen.
--version Show version.
For example, if you wanted to create a .mailmap
file for the psf/requests
repository, it could be done as in the following:
$ git clone https://github.com/psf/requests
$ mailmap requests > requests/.mailmap
$ nano requests/.mailmap
The above shows, that the tool just prints a suggested .mailmap
file to stdout. Be aware of that the tool only suggests a .mailmap
file.
It might be wrong. Since the tool maps same author names, you have to inspect and double check if the suggested file is correct.
Calling it from code:
from mailmap_generator.mailmap import create_mailmap
mailmap_str = create_mailmap(["<path_to_repo>", ... ])
How does the tool create the .mailmap
file?
Currently, the tool works in two stages. In the first stage, authors with the same email address are mapped to one author name. Secondly, all authors with the exact same name -- and potentially different email addresses -- are mapped to another. That second step might be wrong in case of authors with same names but different email addresses are actually two different persons.
Alternative tools
Via StackOverflow one finds genmailmap.sh
and mailmap_update.py
. The latter is removed from the project, i.e., not maintained anymore and inner workings of the former is not entirely clear to me :) Therefore, I created this tool.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mailmap_generator-0.3.1.tar.gz
.
File metadata
- Download URL: mailmap_generator-0.3.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-76051900-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38c0e2aceb2e560663b905fde48c64d745a06eb22f4729b2a3f9348c9974ffa3 |
|
MD5 | 120f1eb48f629c70e4084d91e7d30058 |
|
BLAKE2b-256 | 12c62cbc3c7522f812c273db05ef6e5326aa6939595a955214ade86ca9551efd |
File details
Details for the file mailmap_generator-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: mailmap_generator-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-76051900-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abb250417484b68bbf2263776797bd4088738c653df3d233bd4a272be33e8a7a |
|
MD5 | 626c61c5beec9509303142df1a888f26 |
|
BLAKE2b-256 | 02a09023f03805b2688cc206185de5f180239b14028431d88b6d5faff734a982 |