cvsserver: Use the user part of the email in log and annotate results
Generate the CVS author names by taking the first eight characters of the user part of the email address. The resulting names are more likely to make sense (or at least reduce ambiguities) in "corporate" environments. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Damien Diederen committed
Mar 27, 2008 at 23:18 UTC
c1bc30614ad0a9b63f4f798f0aa71d376a095938
1 file changed
+12
-4
git-cvsserver.perl
+12
-4
@@ -1728,8 +1728,7 @@ sub req_log
1728
print "M revision 1.$revision->{revision}\n";
1729
# reformat the date for log output
1730
$revision->{modified} = sprintf('%04d/%02d/%02d %s', $3, $DATE_LIST->{$2}, $1, $4 ) if ( $revision->{modified} =~ /(\d+)\s+(\w+)\s+(\d+)\s+(\S+)/ and defined($DATE_LIST->{$2}) );
1731
- $revision->{author} =~ s/\s+.*//;
1732
- $revision->{author} =~ s/^(.{8}).*/$1/;
1731
+ $revision->{author} = cvs_author($revision->{author});
1732
print "M date: $revision->{modified}; author: $revision->{author}; state: " . ( $revision->{filehash} eq "deleted" ? "dead" : "Exp" ) . "; lines: +2 -3\n";
1733
my $commitmessage = $updater->commitmessage($revision->{commithash});
1734
$commitmessage =~ s/^/M /mg;
@@ -1844,8 +1843,7 @@ sub req_annotate
1843
unless ( defined ( $metadata->{$commithash} ) )
1844
{
1845
$metadata->{$commithash} = $updater->getmeta($filename, $commithash);
1847
- $metadata->{$commithash}{author} =~ s/\s+.*//;
1848
- $metadata->{$commithash}{author} =~ s/^(.{8}).*/$1/;
1846
+ $metadata->{$commithash}{author} = cvs_author($metadata->{$commithash}{author});
1847
$metadata->{$commithash}{modified} = sprintf("%02d-%s-%02d", $1, $2, $3) if ( $metadata->{$commithash}{modified} =~ /^(\d+)\s(\w+)\s\d\d(\d\d)/ );
1848
}
1849
printf("M 1.%-5d (%-8s %10s): %s\n",
@@ -2139,6 +2137,16 @@ sub kopts_from_path
2137
}
2138
}
2139
2140
+# Generate a CVS author name from Git author information, by taking
2141
+# the first eight characters of the user part of the email address.
2142
+sub cvs_author
2143
+{
2144
+ my $author_line = shift;
2145
+ (my $author) = $author_line =~ /<([^>@]{1,8})/;
2146
+
2147
+ $author;
2148
+}
2149
+
2150
package GITCVS::log;
2151
2152
####