diff --git a/dev/tools/github_authors_and_commits_bydate.sh b/dev/tools/github_authors_and_commits_bydate.sh new file mode 100755 index 00000000000..7013854c093 --- /dev/null +++ b/dev/tools/github_authors_and_commits_bydate.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Count number of different contributors and number of commits for a given year or month +# Can be used for statistics (for example to generate the infography of the year) +# +# shellcheck disable=2027,2086,2268 + +echo "***** github_authors_and_commits_bydate.sh *****" +if [ "x$1" = "x" ]; then + echo "Usage: $0 (byyear|bymonth) YEARSTART [YEAREND]" + exit +fi +if [ "x$1" != "xbyyear" -a "x$1" != "xbymonth" ]; then + echo "Usage: $0 (byyear|bymonth) YEARSTART [YEAREND]" + exit +fi + +FROM=$1-01-01 +TO=$1-12-31 +DATEFORMAT="%Y" +if [ "x$1" = "xbymonth" ]; then + DATEFORMAT="%Y%m" +fi + +if [ "x$3" != "x" ]; then + TO=$2-12-31 +fi + +echo "--- Number of different contributors for the year" +echo "git log --since $FROM --before $TO | grep ^Author | awk -F'<' '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l" +git log --since $FROM --before $TO | iconv -f UTF-8 -t ASCII//TRANSLIT | grep '^Author' | awk -F"<" '{ print $1 }' | sort -u -f -i -b | wc -l + + +echo "--- Number of commit $1" +echo "git log --pretty='format:%cd' --date=format:'$DATEFORMAT' | sort | uniq -c | awk '{ if (\$2 >= '"$1"') { print \"Year: \"\$2\", commits: \"\$1 } }'" +git log --pretty='format:%cd' --date=format:"$DATEFORMAT" | iconv -f UTF-8 -t ASCII//TRANSLIT | sort | uniq -c | awk '{ if ($2 >= '$1') { print "Year: "$2", commits: "$1 } }' diff --git a/dev/tools/github_authors_and_commits_peryear.sh b/dev/tools/github_authors_and_commits_peryear.sh deleted file mode 100755 index 421705bcdee..00000000000 --- a/dev/tools/github_authors_and_commits_peryear.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Count number of different contributors and number of commits for a given year. -# Can be used for statistics (for example to generate the inforgraphy of the year) -# -# shellcheck disable=2027,2086,2268 - -if [ "x$1" = "x" ]; then - echo "Usage: $0 YEARSTART [YEAREND]" - exit -fi - - -FROM=$1-01-01 -TO=$1-12-31 - -if [ "x$2" != "x" ]; then - TO=$2-12-31 -fi - -echo "--- Number of contributors for the year" -echo "git log --since $FROM --before $TO | grep ^Author | awk -F'<' '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l" -git log --since $FROM --before $TO | grep '^Author' | awk -F"<" '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l - - -echo "--- Number of commit for the year" -echo "git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if (\$2 >= '"$1"') { print \"Year: \"\$2\", commits: \"\$1 } }'" -git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if ($2 >= '$1') { print "Year: "$2", commits: "$1 } }' diff --git a/dev/tools/github_commits_perversion.sh b/dev/tools/github_commits_byversion.sh similarity index 92% rename from dev/tools/github_commits_perversion.sh rename to dev/tools/github_commits_byversion.sh index 7c5892f60c1..6354f7d9253 100755 --- a/dev/tools/github_commits_perversion.sh +++ b/dev/tools/github_commits_byversion.sh @@ -37,7 +37,7 @@ do echo "Checkout into version $i" git checkout $i #git shortlog -s -n --after=YYYY-MM-DD --before=YYYY-MM-DD | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt - git shortlog -s -n $commitidcommon.. | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt + git shortlog -s -n $commitidcommon.. | iconv -f UTF-8 -t ASCII//TRANSLIT | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt #cat /tmp/github_commits_perversion.txt echo "Total for version $i:" echo -n "- Nb of commits: " diff --git a/dev/tools/github_lines_perusers.sh b/dev/tools/github_lines_byuser.sh similarity index 68% rename from dev/tools/github_lines_perusers.sh rename to dev/tools/github_lines_byuser.sh index 4f3a211c315..8bc5802aa2f 100755 --- a/dev/tools/github_lines_perusers.sh +++ b/dev/tools/github_lines_byuser.sh @@ -20,7 +20,7 @@ if [ "x$START" = "xSTART.." ]; then fi echo "git log $START$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp" -git log $START$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp +git log $START$2 --shortstat | iconv -f UTF-8 -t ASCII//TRANSLIT | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp echo "Users and nb of lines"; cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; lastuser=""; } { if ($1 ~ /^Author:/) { sub(/<.*/, ""); lastuser=tolower($1) }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' | sort