Skip to content

Commit

Permalink
cvsserver: Use the user part of the email in log and annotate results
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Damien Diederen authored and Junio C Hamano committed Mar 27, 2008
1 parent 6e8937a commit c1bc306
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions git-cvsserver.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1728,8 +1728,7 @@ sub req_log
print "M revision 1.$revision->{revision}\n";
# reformat the date for log output
$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}) );
$revision->{author} =~ s/\s+.*//;
$revision->{author} =~ s/^(.{8}).*/$1/;
$revision->{author} = cvs_author($revision->{author});
print "M date: $revision->{modified}; author: $revision->{author}; state: " . ( $revision->{filehash} eq "deleted" ? "dead" : "Exp" ) . "; lines: +2 -3\n";
my $commitmessage = $updater->commitmessage($revision->{commithash});
$commitmessage =~ s/^/M /mg;
Expand Down Expand Up @@ -1844,8 +1843,7 @@ sub req_annotate
unless ( defined ( $metadata->{$commithash} ) )
{
$metadata->{$commithash} = $updater->getmeta($filename, $commithash);
$metadata->{$commithash}{author} =~ s/\s+.*//;
$metadata->{$commithash}{author} =~ s/^(.{8}).*/$1/;
$metadata->{$commithash}{author} = cvs_author($metadata->{$commithash}{author});
$metadata->{$commithash}{modified} = sprintf("%02d-%s-%02d", $1, $2, $3) if ( $metadata->{$commithash}{modified} =~ /^(\d+)\s(\w+)\s\d\d(\d\d)/ );
}
printf("M 1.%-5d (%-8s %10s): %s\n",
Expand Down Expand Up @@ -2139,6 +2137,16 @@ sub kopts_from_path
}
}

# Generate a CVS author name from Git author information, by taking
# the first eight characters of the user part of the email address.
sub cvs_author
{
my $author_line = shift;
(my $author) = $author_line =~ /<([^>@]{1,8})/;

$author;
}

package GITCVS::log;

####
Expand Down

0 comments on commit c1bc306

Please sign in to comment.