From 05dd972ccc5b552f02829ae4ec54fa84b6acdc4b Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 10 Jul 2006 20:34:47 +0000 Subject: [PATCH] Sync with FreeBSD (makes it actually work). --- tools/tools/commitsdb/make_commit_db | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/tools/commitsdb/make_commit_db b/tools/tools/commitsdb/make_commit_db index 37ff446133..078b5c43ad 100644 --- a/tools/tools/commitsdb/make_commit_db +++ b/tools/tools/commitsdb/make_commit_db @@ -1,7 +1,7 @@ #!/usr/bin/perl -w -# $FreeBSD: src/tools/tools/commitsdb/make_commit_db,v 1.1.2.1 2002/08/12 13:37:46 joe Exp $ -# $DragonFly: src/tools/tools/commitsdb/make_commit_db,v 1.2 2003/06/17 04:29:11 dillon Exp $ +# $FreeBSD: src/tools/tools/commitsdb/make_commit_db,v 1.2 2002/10/17 16:29:26 joe Exp $ +# $DragonFly: src/tools/tools/commitsdb/make_commit_db,v 1.3 2006/07/10 20:34:47 swildner Exp $ # This script walks the tree from the current directory # and spits out a database generated by md5'ing the cvs log @@ -20,21 +20,21 @@ while (@dirs) { my %logs; opendir DIR, $dir or die $!; - foreach (grep { /[^\.]/ } readdir DIR) { - my $filename = "$dir/$_"; + foreach my $f (grep { /[^\.]/ } readdir DIR) { + my $filename = "$dir/$f"; if (-f $filename) { my %loghash = parse_log_message($filename); next unless %loghash; $logs{$filename} = {%loghash}; - } elsif (-d $_) { - next if /^CVS$/; - push @dirs, $_; + } elsif (-d $filename) { + next if $filename =~ /\/CVS$/; + push @dirs, $filename; } } close DIR; - # Product a database of the commits + # Produce a database of the commits foreach my $f (keys %logs) { my $file = $logs{$f}; foreach my $rev (keys %$file) { @@ -59,7 +59,7 @@ sub parse_log_message { my $file = shift; # Get a log of the file. - open LOG, "cvs -R log $file |" or die $!; + open LOG, "cvs -R log $file 2>/dev/null |" or die $!; my @log = ; my $log = join "", @log; close LOG; @@ -78,11 +78,14 @@ sub parse_log_message { my $rev = $1; # Strip off any other headers. - while ($e =~ s/^(date|branches):[^\n]*\n//sg) { + my $user; + while ($e =~ s/^(date|branches):([^\n]*)\n//sg) { + my $sub = $2; + $user = $1 if $sub =~ /author: (.*?);/; }; my $hash = string_to_hash($e); - $loghash{$rev} = $hash; + $loghash{$rev} = "$user:$hash"; } return %loghash; -- 2.41.0