merged master with dejan's constant evaluating equality engine
[cvc5.git] / contrib / get-authors
1 #!/bin/sh
2 #
3 # get-authors
4 # Morgan Deters <mdeters@cs.nyu.edu> for CVC4
5 # Copyright (c) 2009-2013 The CVC4 Project
6 #
7 # usage: get-authors [ files... ]
8 #
9 # This script uses git to get the original author
10 #
11
12 gituser="`git config user.name` <`git config user.email`>"
13
14 while [ $# -gt 0 ]; do
15 f=$1
16 shift
17 original_author=
18 major_contributors=
19 minor_contributors=
20 total_lines=`wc -l "$f" | awk '{print$1}'`
21 original_author=`git log --pretty="format:%aN <%aE>" "$f" | tail -1`
22 git blame --incremental "$f" | gawk '/^[0-9a-f]+ [0-9]+ [0-9]+ [0-9]+$/ {nl=$4;} /^author / {$1=""; author=$0;} /^author-mail / {mail=$2} /^filename / {while(nl--) {print author,mail}}' | sed "s,Not Committed Yet <not.committed.yet>,$gituser," | sort | uniq -c | sort -n |
23 ( while read lines author; do
24 pct=$((100*$lines/$total_lines))
25 if [ "$author" != "$original_author" ]; then
26 if [ $pct -ge 10 ]; then
27 major_contributors="${major_contributors:+$major_contributors, }$author"
28 else
29 minor_contributors="${minor_contributors:+$minor_contributors, }$author"
30 fi
31 fi
32 done; \
33 echo "$original_author"
34 echo "${major_contributors:-none}"
35 echo "${minor_contributors:-none}" )
36 done