mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-21 12:13:52 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b08bb0b52 | ||
|
|
08d1a5a6e3 | ||
|
|
f5c2b82f02 | ||
|
|
bf29c19cf5 | ||
|
|
c6cb74a5e0 | ||
|
|
3f0befcd07 |
@@ -178,6 +178,14 @@ export _GIT_MERGE_VIEW="enable"
|
||||
export _GIT_MERGE_VIEW="exclusive"
|
||||
```
|
||||
|
||||
### Git branch
|
||||
|
||||
You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works with commands `--git-stats-by-branch`.
|
||||
|
||||
```bash
|
||||
export _GIT_BRANCH="master"
|
||||
```
|
||||
|
||||
### Color themes
|
||||
|
||||
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
|
||||
|
||||
@@ -61,7 +61,7 @@ fi
|
||||
_log_options=${_GIT_LOG_OPTIONS:-}
|
||||
if [[ -n "${_log_options}" ]]; then
|
||||
_log_options=$_log_options
|
||||
else
|
||||
else
|
||||
_log_options=""
|
||||
fi
|
||||
|
||||
@@ -158,7 +158,9 @@ ADDITIONAL USAGE
|
||||
You can also set _GIT_MERGE_VIEW to only show merge commits
|
||||
ex: export _GIT_MERGE_VIEW=exclusive
|
||||
You can set _MENU_THEME to display the legacy color scheme
|
||||
ex: export _MENU_THEME=legacy"
|
||||
ex: export _MENU_THEME=legacy
|
||||
You can set _GIT_BRANCH to set the branch of the stats
|
||||
ex: export _GIT_BRANCH=master"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -377,11 +379,13 @@ function jsonOutput() {
|
||||
function commitsByMonth() {
|
||||
optionPicked "Git commits by month:"
|
||||
echo -e "\tmonth\tsum"
|
||||
local startYear=$(echo "$_since" | grep -Eo "[0-9]{4}")
|
||||
local endYear=$(echo "$_until" | grep -Eo "[0-9]{4}")
|
||||
for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
||||
do
|
||||
echo -en "\t$i\t"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
"$_since" "$_until" $_log_options | grep " $i " | wc -l
|
||||
"$_since" "$_until" $_log_options | grep -E "($startYear|$endYear)" | grep " $i " | wc -l
|
||||
done | awk '{
|
||||
count[$1] = $2
|
||||
total += $2
|
||||
@@ -408,12 +412,14 @@ function commitsByMonth() {
|
||||
function commitsByWeekday() {
|
||||
optionPicked "Git commits by weekday:"
|
||||
echo -e "\tday\tsum"
|
||||
local startYear=$(echo "$_since" | grep -Eo "[0-9]{4}")
|
||||
local endYear=$(echo "$_until" | grep -Eo "[0-9]{4}")
|
||||
local counter=1
|
||||
for i in Mon Tue Wed Thu Fri Sat Sun
|
||||
do
|
||||
echo -en "\t$counter\t$i\t"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
"$_since" "$_until" $_log_options | grep "$i " | wc -l
|
||||
"$_since" "$_until" $_log_options | grep -E "($startYear|$endYear)" | grep "$i " | wc -l
|
||||
counter=$((counter+1))
|
||||
done | awk '{
|
||||
}
|
||||
@@ -453,11 +459,14 @@ function commitsByHour() {
|
||||
_author="--author=${author}"
|
||||
fi
|
||||
echo -e "\thour\tsum"
|
||||
|
||||
local startYear=$(echo "$_since" | grep -Eo "[0-9]{4}")
|
||||
local endYear=$(echo "$_until" | grep -Eo "[0-9]{4}")
|
||||
for i in $(seq -w 0 23)
|
||||
do
|
||||
echo -ne "\t$i\t"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
"${_author}" "$_since" "$_until" $_log_options | grep ' '$i: | wc -l
|
||||
"${_author}" "$_since" "$_until" $_log_options | grep -E "($startYear|$endYear)" | grep ' '$i: | wc -l
|
||||
done | awk '{
|
||||
count[$1] = $2
|
||||
total += $2
|
||||
@@ -539,7 +548,7 @@ function myDailyStats() {
|
||||
--author="$(git config user.name)" $_merges \
|
||||
--since=$(date "+%Y-%m-%dT00:00:00") \
|
||||
--until=$(date "+%Y-%m-%dT23:59:59") --reverse $_log_options \
|
||||
| grep commit | wc -l) "commits"
|
||||
| grep -E "commit [a-f0-9]{40}" | wc -l) "commits"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -626,7 +635,7 @@ if [[ "$#" -eq 1 ]]; then
|
||||
-r|--suggest-reviewers) suggestReviewers;;
|
||||
-T|--detailed-git-stats) detailedGitStats;;
|
||||
-R|--git-stats-by-branch)
|
||||
branch=""
|
||||
branch="${_GIT_BRANCH:-}"
|
||||
while [[ -z "${branch}" ]]; do
|
||||
read -r -p "Which branch? " branch
|
||||
done
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
.TH git-quick-stats "1" "January 2020" "git-quick-stats" "User Commands"
|
||||
.SH NAME
|
||||
.B git\-quick\-stats
|
||||
.B git\-quick\-stats
|
||||
\- Simple and efficient way to access various stats in a git repository.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
For non\-interactive mode:
|
||||
For non\-interactive mode:
|
||||
.B git\-quick\-stats [OPTIONS]
|
||||
.PP
|
||||
For interactive mode:
|
||||
For interactive mode:
|
||||
.B git-quick-stats
|
||||
.PP
|
||||
.SH DESCRIPTION
|
||||
@@ -131,6 +131,10 @@ You can also set _GIT_MERGE_VIEW to only show merge commits, example:
|
||||
You can switch to the legacy color scheme, example:
|
||||
.PP
|
||||
.B export _MENU_THEME=legacy
|
||||
.PP
|
||||
You can set _GIT_BRANCH to set the branch of the stats, example:
|
||||
.PP
|
||||
.B export _GIT_BRANCH="master"
|
||||
.
|
||||
.fi
|
||||
|
||||
|
||||
@@ -69,7 +69,9 @@ ADDITIONAL USAGE
|
||||
You can also set _GIT_MERGE_VIEW to only show merge commits
|
||||
ex: export _GIT_MERGE_VIEW=exclusive
|
||||
You can set _MENU_THEME to display the legacy color scheme
|
||||
ex: export _MENU_THEME=legacy"
|
||||
ex: export _MENU_THEME=legacy
|
||||
You can set _GIT_BRANCH to set the branch of the stats
|
||||
ex: export _GIT_BRANCH=master"
|
||||
|
||||
assert_raises "$src fail" 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user