Skip to main content

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

mailmap_generator-0.3.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

mailmap_generator-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file mailmap_generator-0.3.0.tar.gz.

File metadata

  • Download URL: mailmap_generator-0.3.0.tar.gz
  • Upload date:
  • Size: 4.1 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

Hashes for mailmap_generator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 14d247b4a7dc94a3de930a3d5281581bffed98745dd5d7e5b144de6b15d6cb7d
MD5 924fdbbf0b485b57bd8f1da967c119ff
BLAKE2b-256 90b9cb985d9563e93163eda93be3e80299b0597982b1a0f9d1ffa6c5e613202f

See more details on using hashes here.

File details

Details for the file mailmap_generator-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mailmap_generator-0.3.0-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

Hashes for mailmap_generator-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9813cd64a9cc96745a1306f7fa922931e72120bf73344f0409503b7d82562f39
MD5 b6a0ef3a56501e31ecf9f5e5b0aba81d
BLAKE2b-256 52b0c7d3c5ba751b0438702c69f2af165367b1e3c034792fae9f150f9f952167

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page