Compare commits

...

10 Commits
1.0.0 ... 1.0.2

Author SHA1 Message Date
Lukáš Mešťan
6d0e1aa692 Merge pull request #22 from xdlbx/add-november
added november to the list of months, thanks @xdlbx
2017-02-18 11:39:37 +01:00
Dustin Blomquist
27f0857b77 added november to the list of months 2017-02-18 01:08:10 -06:00
Lukáš Mešťan
1f1b281b6f Update git-quick-stats 2017-02-12 11:01:57 +01:00
Lukas Mestan
64fc7150ad update graph stats 2017-02-06 08:57:05 +01:00
arzzen
a477fa279e Merge branch 'master' of https://github.com/arzzen/git-quick-stats 2017-02-05 21:03:28 +01:00
arzzen
0db92c4cc1 stats ascii graph 2017-02-05 21:03:14 +01:00
Lukáš Mešťan
7b485e9a17 Update README.md 2017-02-04 22:01:44 +01:00
Lukáš Mešťan
3ecfa3f333 Update README.md 2017-02-04 21:58:57 +01:00
Lukáš Mešťan
2d7c71f7b1 Update README.md 2017-02-04 21:49:45 +01:00
arzzen
c6a294f390 added stats ber hour,day,month 2017-02-04 21:48:32 +01:00
2 changed files with 109 additions and 34 deletions

View File

@@ -5,11 +5,11 @@
## Example
Branch tree view:
![screenshot from 2017-01-22 19-49-56](https://cloud.githubusercontent.com/assets/6382002/22396053/a2b8259e-e54f-11e6-9110-72d4fb662615.png)
Suggested code reviewers (based on git history):
![screenshot from 2017-01-22 19-50-27](https://cloud.githubusercontent.com/assets/6382002/22396052/a29311b4-e54f-11e6-9dbb-0bdf96161bcb.png)
![screenshot from 2017-02-04 22-00-30](https://cloud.githubusercontent.com/assets/6382002/22621490/62257c30-eb25-11e6-8608-9cfe17509464.png)
Asciinema preview:
[![asciicast](https://asciinema.org/a/6fsugv3m2vygykk49bk7l49ut.png)](https://asciinema.org/a/6fsugv3m2vygykk49bk7l49ut)
Want to contribute? Great! First, [read this page][].
@@ -28,7 +28,7 @@ Or you can use (non-interactive) direct execution:
`git quick-stats <optional-command-to-execute-directly>`
> Possible arguments:
> suggestReviewers, detailedGitStats, commitsPerDay, commitsPerAuthor, myDailyStats, contributors,
> suggestReviewers, detailedGitStats, commitsByHour, commitsByWeekday, commitsByMonth, commitsPerDay, commitsPerAuthor, myDailyStats, contributors,
branchTree, branchesByDate, changelogs

View File

@@ -31,9 +31,12 @@ show_menu() {
echo -e "${MENU} ${NUMBER} 5)${MENU} All branches (sorted by most recent commit) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 6)${MENU} All contributors (sorted by name) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 7)${MENU} Git commits per author ${NORMAL}"
echo -e "${MENU} ${NUMBER} 8)${MENU} Git commits per day ${NORMAL}"
echo -e "${MENU} ${NUMBER} 8)${MENU} Git commits per date ${NORMAL}"
echo -e "${MENU} ${NUMBER} 9)${MENU} Git commits per month ${NORMAL}"
echo -e "${MENU} ${NUMBER} 10)${MENU} Git commits per weekday ${NORMAL}"
echo -e "${MENU} ${NUMBER} 11)${MENU} Git commits per hour ${NORMAL}"
echo -e "${RED_TEXT} Suggest: ${NORMAL}"
echo -e "${MENU} ${NUMBER} 9)${MENU} Code reviewers (based on git history) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 12)${MENU} Code reviewers (based on git history) ${NORMAL}"
echo -e ""
echo -e "${ENTER_LINE}Please enter a menu option or ${RED_TEXT}press enter to exit. ${NORMAL}"
read opt
@@ -44,13 +47,12 @@ function option_picked() {
RESET='\033[00;00m'
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
echo ""
}
function detailedGitStats() {
option_picked "Contribution stats (by author):"
echo ""
git log --no-merges --numstat --pretty="format:commit %H%nAuthor: %an <%ae>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until | LC_ALL=C awk '
function printStats(author) {
printf "\t%s:\n", author
@@ -113,7 +115,6 @@ function detailedGitStats() {
function suggestReviewers() {
option_picked "Suggested code reviewers (based on git history):"
echo ""
git log --no-merges $_since $_until --pretty=%an $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
{ args[NR] = $0; }
END {
@@ -123,27 +124,97 @@ function suggestReviewers() {
}' | column -t -s,
}
function commitsByMonth() {
option_picked "Git commits by month:"
echo -e "\tmonth\tsum"
for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
do
echo -en "\t$i\t"
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i " | wc -l)
done | awk '{
count[$1] = $2
total += $2
}
END{
for (month in count) {
s="";
percent = ((count[month] / total) * 100) / 1.25;
for (i = 1; i <= percent; ++i) {
s=s"="
}
printf( "\t%s\t%-0s\t|%s\n", month, count[month], s );
}
}' | LC_TIME="en_EN.UTF-8" sort -M
}
function commitsByWeekday() {
option_picked "Git commits by weekday:"
echo -e "\tday\tsum"
for i in Mon Tue Wed Thu Fri Sat Sun
do
echo -en "\t$i\t"
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep "$i " | wc -l)
done | awk '{
}
NR == FNR {
count[$1] = $2;
total += $2;
next
}
END{
for (day in count) {
s="";
percent = ((count[day] / total) * 100) / 1.25;
for (i = 1; i <= percent; ++i) {
s=s"="
}
printf( "\t%s\t%-0s\t|%s\n", day, count[day], s );
}
}'
}
function commitsByHour() {
option_picked "Git commits by hour:"
echo -e "\thour\tsum"
for i in `seq -w 0 23`
do
echo -ne "\t$i\t"
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i:" | wc -l)
done | awk '{
count[$1] = $2
total += $2
}
END{
for (hour in count) {
s="";
percent = ((count[hour] / total) * 100) / 1.25;
for (i = 1; i <= percent; ++i) {
s=s"="
}
printf( "\t%s\t%-0s\t|%s\n", hour, count[hour], s );
}
}' | sort
}
function commitsPerDay() {
option_picked "Git commits per day:";
echo ""
option_picked "Git commits per date:";
git log --no-merges $_since $_until --date=short --format='%ad' | sort | uniq -c
}
function commitsPerAuthor() {
option_picked "Git commits per author:"
echo ""
git shortlog $_since $_until --no-merges -n -s | sort -nr | LC_ALL=C awk '
{ args[NR] = $0; sum += $0 }
END {
for (i = 1; i <= NR; ++i) {
printf "%s,%2.1f%%\n", args[i], 100 * args[i] / sum
}
}' | column -t -s,
}' | column -t -s,
}
function myDailyStats() {
option_picked "My daily status:"
echo ""
git diff --shortstat '@{0 day ago}' | sort -nr | tr ',' '\n' | LC_ALL=C awk '
{ args[NR] = $0; }
END {
@@ -157,26 +228,22 @@ function myDailyStats() {
function contributors() {
option_picked "All contributors (sorted by name):"
echo ""
git log --no-merges $_since $_until --format='%aN' | sort -u | cat -n
}
function branchTree() {
option_picked "Branching tree view:"
echo ""
git log --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %an %n' --all | head -n 50
}
function branchesByDate() {
option_picked "All branches (sorted by most recent commit):"
echo ""
git for-each-ref --sort=committerdate refs/heads/ --format='[%(authordate:relative)] %(authorname) %(refname:short)' | cat -n
}
function changelogs() {
option_picked "Git changelogs:"
echo ""
git log --pretty=format:"- %s%n%b" --since="$(git show -s --format=%ad `git rev-list --all --max-count=1`)" | sort -nr
}
@@ -189,14 +256,12 @@ if [ $# -eq 1 ]
"suggestReviewers")
suggestReviewers
;;
"detailedGitStats")
detailedGitStats
;;
"branchTree")
branchTree
;;
"commitsPerDay")
commitsPerDay
;;
@@ -215,8 +280,17 @@ if [ $# -eq 1 ]
"changelogs")
changelogs
;;
"commitsByWeekday")
commitsByWeekday
;;
"commitsByHour")
commitsByHour
;;
"commitsByMonth")
commitsByMonth
;;
*)
echo "Invalid argument. Possible arguments: suggestReviewers, detailedGitStats, commitsPerDay, commitsPerAuthor, myDailyStats, contributors, branchTree, branchesByDate, changelogs"
echo "Invalid argument. Possible arguments: suggestReviewers, detailedGitStats, commitsPerDay, commitsByMonth, commitsByWeekday, commitsByHour, commitsPerAuthor, myDailyStats, contributors, branchTree, branchesByDate, changelogs"
;;
esac
exit 0;
@@ -242,57 +316,58 @@ while [ opt != '' ]
detailedGitStats
show_menu
;;
2)
changelogs
show_menu
;;
3)
myDailyStats
show_menu
;;
4)
branchTree
show_menu
;;
5)
branchesByDate
show_menu
;;
6)
contributors
show_menu
;;
7)
commitsPerAuthor
show_menu
;;
8)
commitsPerDay
show_menu
;;
9)
commitsByMonth
show_menu
;;
10)
commitsByWeekday
show_menu
;;
11)
commitsByHour
show_menu
;;
12)
suggestReviewers
show_menu
;;
q)
exit
;;
\n)
exit
;;
*)
clear
clear
option_picked "Pick an option from the menu"
show_menu
;;