diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/get-authors | 33 | ||||
-rwxr-xr-x | contrib/update-copyright.pl | 24 |
2 files changed, 53 insertions, 4 deletions
diff --git a/contrib/get-authors b/contrib/get-authors new file mode 100755 index 000000000..a42f8a25b --- /dev/null +++ b/contrib/get-authors @@ -0,0 +1,33 @@ +#!/bin/sh +# +# get-authors +# Morgan Deters <mdeters@cs.nyu.edu> for CVC4 +# +# usage: get-authors [ files... ] +# +# This script uses svn to get the original author +# + +while [ $# -gt 0 ]; do + f=$1 + shift + original_author= + major_contributors= + minor_contributors= + total_lines=`wc -l "$f" | awk '{print$1}'` + original_author=`svn log -q --incremental "$f" | tail -1 | awk '{print$3}'` + svn blame "$f" | awk '{print$2}' | sort | uniq -c | sort -n | + ( while read lines author; do + pct=$((100*$lines/$total_lines)) + if [ "$author" != "$original_author" ]; then + if [ $pct -gt 10 ]; then + major_contributors="${major_contributors:+$major_contributors, }$author" + else + minor_contributors="${minor_contributors:+$minor_contributors, }$author" + fi + fi + done; \ + echo "$original_author" + echo "${major_contributors:-none}" + echo "${minor_contributors:-none}" ) +done diff --git a/contrib/update-copyright.pl b/contrib/update-copyright.pl index 72bc006d7..1548e3fa6 100755 --- a/contrib/update-copyright.pl +++ b/contrib/update-copyright.pl @@ -1,5 +1,10 @@ #!/usr/bin/perl -w # +# update-copyright.pl +# Morgan Deters <mdeters@cs.nyu.edu> for CVC4 +# +# usage: update-copyright [ files/directories... ] +# # This script goes through a source directory rewriting the top bits of # source files to match a template (inline, below). For files with no # top comment, it adds a fresh one. @@ -50,12 +55,12 @@ EOF use strict; use Fcntl ':mode'; +my $dir = $0; +$dir =~ s,/[^/]+/*$,,; + my @searchdirs = (); if($#ARGV == -1) { - my $dir = $0; - $dir =~ s,/[^/]+/*$,,; - - (chdir($dir."/..") && -f "src/include/cvc4_expr.h") || die "can't find top-level source directory for CVC4"; + (chdir($dir."/..") && -f "src/include/cvc4_config.h") || die "can't find top-level source directory for CVC4"; my $pwd = `pwd`; chomp $pwd; print <<EOF; @@ -103,6 +108,11 @@ sub recurse { my $outfile = $srcdir.'/#'.$file.'.tmp'; open(my $IN, $infile) || die "error opening $infile for reading"; open(my $OUT, '>', $outfile) || die "error opening $outfile for writing"; + open(my $AUTHOR, "$dir/get-authors " . $infile . '|'); + my $author = <$AUTHOR>; chomp $author; + my $major_contributors = <$AUTHOR>; chomp $major_contributors; + my $minor_contributors = <$AUTHOR>; chomp $minor_contributors; + close $AUTHOR; $_ = <$IN>; if(m,^(%{)?/\*\*\*\*\*,) { print "updating\n"; @@ -112,6 +122,9 @@ sub recurse { print $OUT "/********************* -*- C++ -*- */\n"; } print $OUT "/** $file\n"; + print $OUT " ** Original author: $author\n"; + print $OUT " ** Major contributors: $major_contributors\n"; + print $OUT " ** Minor contributors (to current version): $minor_contributors\n"; print $OUT $standard_template; print $OUT " **\n"; while(my $line = <$IN>) { @@ -126,6 +139,9 @@ sub recurse { print $OUT "/********************* -*- C++ -*- */\n"; } print $OUT "/** $file\n"; + print $OUT " ** Original author: $author\n"; + print $OUT " ** Major contributors: $major_contributors\n"; + print $OUT " ** Minor contributors (to current version): $minor_contributors\n"; print $OUT $standard_template; print $OUT " **\n"; print $OUT " ** [[ Add file-specific comments here ]]\n"; |