19 Mar 2019 20:24:55 UTC
- Distribution: Git-Mailmap
- Module version: 0.005
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (923 / 0 / 0)
- KwaliteeBus factor: 1
- 82.68% Coverage
- License: perl_5
- Perl: v5.10.0
- Activity24 month
- Download (17.05KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- COPYRIGHT AND LICENSE
Git::Mailmap - Construct and read/write Git mailmap file.
require Git::Mailmap; my $mailmap_file_as_string = '<firstname.lastname@example.org> <email@example.com> Some Dude <firstname.lastname@example.org> nick1 <email@example.com> Other Author <firstname.lastname@example.org> nick2 <email@example.com> '; my $plain_mailmap = Git::Mailmap->new(); # => isa 'Git::Mailmap' $plain_mailmap->from_string('mailmap' => $mailmap_file_as_string); # OR: my $mailmap = Git::Mailmap->from_string('mailmap' => $mailmap_file_as_string); # => isa 'Git::Mailmap' my $correct = $mailmap->verify( 'proper-email' => '<firstname.lastname@example.org>'); # => 1 my $fail = $mailmap->verify( 'proper-email' => '<email@example.com>', 'proper-name' => 'CTO'); # => 0 # Fail: no email address with that name! my ($mapped_to_name, $mapped_to_email) = $mailmap->map( 'email' => '<firstname.lastname@example.org>', 'name' => 'nick1'); # mapped_to_name => 'Some Dudeeed' # mapped_to_email => '<email@example.com>' my @mapped_to = $mailmap->map('email' => '<firstname.lastname@example.org>'); # mapped_to => is_deeply (undef, '<email@example.com>') # Return map as string for writing to file. my $map = $mailmap->to_string(); # => like qr/Some Dude/
Git::Mailmap is a pure Perl implementation of the mailmap functionality in Git. It allows to create a mailmap by adding a mapped address at a time, or removing unwanted ones. You can also read or write the mailmap file as a string.
For mailmap, please see http://git-scm.com/docs/git-shortlog#_mapping_authors
Package Git::Mailmap is currently being developed so changes in the API and functionality are possible, though not likely.
The Git::Mailmap package requires the following packages (in addition to normal Perl core packages):
Map the committer name and email to proper name/email. The email can be proper-email or committer-email (alias). Email is mandatory parameter. If also name is given, then looks for both. If only email, then the mapping is done to the first matching email address, regardless of the name.
- Return: LIST(proper-name, proper-email). If no name is mapped, then undef. If no email address is mapped, then both are undef.
Add new committer. Add all other information. Note!
There can be only one proper name for each proper email. If more is found, the latter replaces the former.
There can be several different commit names for each commit email.
- Return: [NONE]
Search for a given name and/or email.
- Return: 1/0, 1 if verified to exist.
Remove committer information. Remove as much information as you can.
- proper-email, mandatory. If you specify only this, the whole entry (with proper-name and aliases) will be removed. Other combinations are not supported.
- proper-name, not mandatory. Not supported.
- commit-email, not mandatory. If you specify only this, every entry will be checked, and all aliases with this commit email will be removed. If you specify this together with proper-email, only the alias in the entry with that proper-email will be removed.
- commit-name, not mandatory. Not supported.
- all, not mandatory. Cannot be used together with other parameters. Removes all committers.
- Return: [NONE]
Read the committers from a string. If any committers already exist, these will not be removed; so it is possible to merge mailmap files. If called as a class method (creator method instead of method new()), will also create the object and return it.
Return a mailmap file as string.
'Mikko Koivunalho <firstname.lastname@example.org>'
This software is copyright (c) 2015 by Mikko Koivunalho.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.