contacts: introduce --since and --min-percent
PATCH 1/1 contacts: introduce --since and --min-percent
Signed-off-by Ramkumar Ramachandra <[email protected]>
--- contrib/contacts/git-contacts | 4 ++++ 1 file changed, 4 insertions(+)
contrib/contacts/git-contacts +4 -0
@@ -8,12 +8,16 @@ use strict; use warnings; use IPC::Open2; +use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/; my $since = '5-years-ago'; my $min_percent = 10; my $labels_rx = qr/Signed-off-by|Reviewed-by|Acked-by|Cc/i; my %seen; +my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent); +exit 1 if (!$rv); + sub format_contact { my ($name, $email) = @_; return "$name <$email>";
Signature · 1 line
2.2.1
PATCH v2 1/1 contacts: introduce --since and --min-percent
Signed-off-by Ramkumar Ramachandra <[email protected]>
--- contrib/contacts/git-contacts | 4 ++++ contrib/contacts/git-contacts.txt | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
contrib/contacts/git-contacts +4 -0
@@ -8,6 +8,7 @@ use strict; use warnings; use IPC::Open2; +use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); my $since = '5-years-ago'; my $min_percent = 10;
@@ -158,6 +159,9 @@ sub mailmap_contacts { return \%mapped; } +my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent); +exit 1 if (!$rv); + if (!@ARGV) { die "No input revisions or patch files\n"; }
contrib/contacts/git-contacts.txt +12 -4
@@ -31,6 +31,16 @@ discuss proposed changes, or for finding the list of recipients to Cc: when submitting a patch series via `git send-email`. For the latter case, `git contacts` can be used as the argument to `git send-email`'s `--cc-cmd` option. +OPTIONS +------- + +--min-percent:: + The minimum threshold of blame percentage that a person must + exceed in order to be reported. + +--since:: + Depth of history to dig. + DISCUSSION ----------
@@ -83,10 +93,8 @@ $ git send-email --cc-cmd='git contacts' feature/*.patch LIMITATIONS ----------- -Several conditions controlling a person's significance are currently -hard-coded, such as minimum participation level (10%), blame date-limiting (5 -years), and `-C` level for detecting moved and copied lines (a single `-C`). In -the future, these conditions may become configurable. +The `-C` level for detecting moved and copied lines (a single `-C`) is +hard-coded. In the future, this may become configurable. GIT
Signature · 1 line
2.2.1
contrib/contacts/git-contacts line 11
Quoted 11 lines · Ramkumar Ramachandra
Signed-off-by Ramkumar Ramachandra <[email protected]>---
contrib/contacts/git-contacts +1
-0@@ -8,12 +8,16 @@ use strict; use warnings; use IPC::Open2; +use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
Most of the rest of the codebase uses qw(...) rather than qw/.../.
contrib/contacts/git-contacts line 19
Quoted 7 lines
contrib/contacts/git-contacts +2
-0my $since = '5-years-ago'; my $min_percent = 10; my $labels_rx = qr/Signed-off-by|Reviewed-by|Acked-by|Cc/i; my %seen; +my $rv = GetOptions('since=s' => \$since, 'min-percent=i' => \$min_percent); +exit 1 if (!$rv);
This would make more sense if moved down to the point where the script arguments are processed (just before the 'if (!@ARGV)' line, for instance).
These new options should be documented in git-contacts.txt. Also, the "Limitations" section of the documentation says that these values are currently hard-coded, so it deserves an update as well.
Quoted 5 lines
contrib/contacts/git-contacts +0
-1sub format_contact { my ($name, $email) = @_; return "$name <$email>"; --2.2.1
Quoted 1 line · Ramkumar Ramachandra
Signed-off-by Ramkumar Ramachandra <[email protected]>
Junio: this isn't in the latest rebuild of pu; I wonder if you've forgotten to pick it up.