BV strategy for SMT-EVAL
[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 if [ "$1" = "--email" ]; then
15 strip_email=cat
16 shift
17 else
18 strip_email="sed 's, *<[^>]*@[^>]*>,,g'"
19 fi
20
21 while [ $# -gt 0 ]; do
22 f=$1
23 shift
24 original_author=
25 major_contributors=
26 minor_contributors=
27 total_lines=`wc -l "$f" | awk '{print$1}'`
28 original_author=`git log --use-mailmap --pretty="format:%aN <%aE>" "$f" | tail -1`
29 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 |
30 ( while read lines author; do
31 pct=$((100*$lines/$total_lines))
32 if [ "$author" != "$original_author" ]; then
33 if [ $pct -ge 10 ]; then
34 major_contributors="${major_contributors:+$major_contributors, }$author"
35 else
36 minor_contributors="${minor_contributors:+$minor_contributors, }$author"
37 fi
38 fi
39 done; \
40 echo "$original_author"
41 echo "${major_contributors:-none}"
42 echo "${minor_contributors:-none}" ) | eval "$strip_email"
43 done