mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Improve 2 of the github scripts (#27493)
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
#
|
||||
|
||||
# shellcheck disable=2002,2086,2268
|
||||
DEBUG=${DEBUG:=0}
|
||||
|
||||
if [ "x$2" = "x" ]; then
|
||||
if [ "$2" = "" ]; then
|
||||
echo "***** github_lines_perusers.sh *****"
|
||||
echo "Return the number of lines of code produced by each contributor between 2 versions"
|
||||
echo "Usage: $0 origin/branchstart|tagnamestart|START origin/branchend|tagnameend|HEAD"
|
||||
@@ -15,12 +16,13 @@ if [ "x$2" = "x" ]; then
|
||||
fi
|
||||
|
||||
START="$1.."
|
||||
if [ "x$START" = "xSTART.." ]; then
|
||||
END=$2
|
||||
if [ "$START" = "START.." ]; then
|
||||
START=""
|
||||
fi
|
||||
|
||||
echo "git log $START$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log $START$2 --shortstat --use-mailmap | 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
|
||||
[ "$DEBUG" ] && echo "git log '${START}${END}' --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log "${START}${END}" --shortstat --use-mailmap | 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
|
||||
|
||||
Reference in New Issue
Block a user