5
use strict;
6
use vars qw/ $AUTHOR $VERSION
7
$sha1 $sha1_short $_revision $_repository
8
- $_q $_authors %users/;
8
+ $_q $_authors $_authors_prog %users/;
9
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
10
$VERSION = '@@GIT_VERSION@@';
11
39
use IO::File qw//;
40
use File::Basename qw/dirname basename/;
41
use File::Path qw/mkpath/;
42
+use File::Spec;
43
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
44
use IPC::Open3;
45
use Git;
77
'ignore-paths=s' => \$SVN::Git::Fetcher::_ignore_regex );
78
my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
79
'authors-file|A=s' => \$_authors,
80
+ 'authors-prog=s' => \$_authors_prog,
81
'repack:i' => \$Git::SVN::_repack,
82
'noMetadata' => \$Git::SVN::_no_metadata,
83
'useSvmProps' => \$Git::SVN::_use_svm_props,
265
version() if $_version;
266
usage(1) unless defined $cmd;
267
load_authors() if $_authors;
268
+if (defined $_authors_prog) {
269
+ $_authors_prog = "'" . File::Spec->rel2abs($_authors_prog) . "'";
270
+}
271
272
unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
273
Git::SVN::Migration::migration_check();
2669
$gs
2670
}
2671
2672
+sub call_authors_prog {
2673
+ my ($orig_author) = @_;
2674
+ my $author = `$::_authors_prog $orig_author`;
2675
+ if ($? != 0) {
2676
+ die "$::_authors_prog failed with exit code $?\n"
2677
+ }
2678
+ if ($author =~ /^\s*(.+?)\s*<(.*)>\s*$/) {
2679
+ my ($name, $email) = ($1, $2);
2680
+ $email = undef if length $2 == 0;
2681
+ return [$name, $email];
2682
+ } else {
2683
+ die "Author: $orig_author: $::_authors_prog returned "
2684
+ . "invalid author format: $author\n";
2685
+ }
2686
+}
2687
+
2688
sub check_author {
2689
my ($author) = @_;
2690
if (!defined $author || length $author == 0) {
2691
$author = '(no author)';
2671
- } elsif (defined $::_authors && ! defined $::users{$author}) {
2672
- die "Author: $author not defined in $::_authors file\n";
2692
+ }
2693
+ if (!defined $::users{$author}) {
2694
+ if (defined $::_authors_prog) {
2695
+ $::users{$author} = call_authors_prog($author);
2696
+ } elsif (defined $::_authors) {
2697
+ die "Author: $author not defined in $::_authors file\n";
2698
+ }
2699
}
2700
$author;
2701
}