mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Rename shell tools
This commit is contained in:
36
dev/tools/github_authors_and_commits_bydate.sh
Executable file
36
dev/tools/github_authors_and_commits_bydate.sh
Executable file
@@ -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 } }'
|
||||
@@ -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 } }'
|
||||
@@ -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: "
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user