Compare commits

...

36 Commits

Author SHA1 Message Date
Lukáš Mešťan
206ebd8a76 Merge pull request #53 from tomice/master
Improve color compatibility and other minor fixes
2018-12-21 19:35:55 +01:00
Tom Ice
2274ca1284 Improve color compatibility and other minor fixes
* Color was originally done with ANSI escape characters for defining
  different "expected" colors. However, this is not uniform across all
  terminals. To improve what the designers of this program expect
  colors to be, escape codes were replaced with tput equivalents.
  For more information, see the GNU manual here:

  https://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html

* Limited scope of variables to their local scope instead of having them
  be global

* Renamed menu variables to aid in readability and adjusted formatting
  slightly to be more uniform

* Fixed a bug where option_picked was assigning an array to a string
  and relying on the default behavior of the shell to interpret it

* Added the -r option to "read" for safety, as read without -r will
  interpret backslashes before spaces/line feeds, which tends to
  be an unintended side effect

* Updated all backtick notation to the newer POSIX $(..) notation for
  aid in readability when paired next to single quotes and improved
  safety

* Updated the README.md to include missing utilities and fixed some
  minor formatting issues
2018-12-21 12:05:53 -05:00
Lukáš Mešťan
37f15f6381 Update index.html 2018-12-07 15:43:23 +01:00
Lukáš Mešťan
337ead38e3 Update index.html 2018-12-07 15:42:16 +01:00
Lukáš Mešťan
c38e4eb7b6 Merge pull request #49 from motiprajapati/respect-mailmap-author-email
Respect mailmap author email
2018-11-30 09:19:50 +01:00
motiprajapati
b767822eb3 Respect mailmap author email
While using this tool feature "Contribution stats (by author)", I observed that script was not respecting author email as option was being used here was "%ae". Corrected it to "%aE", output looks good now.
2018-11-30 13:26:17 +05:30
Lukáš Mešťan
08520bf068 Merge pull request #48 from danieltaub96/master
fixed  Git changelogs wont work
2018-11-05 21:40:36 +01:00
Daniel
374527dbe1 changelogs printed with days limit 2018-11-05 20:45:01 +02:00
Daniel
dba2d87206 fixed git changelogs without author wont work 2018-11-05 20:40:13 +02:00
Lukáš Mešťan
8bfc58710a Merge pull request #47 from mixn/master
Fixes minor typos
2018-09-28 11:46:59 +02:00
mixn
6f931ac9b5 Fixes minor typos 2018-09-27 13:56:19 +02:00
Lukáš Mešťan
42a657b0de Merge pull request #45 from thangdc94/thangdc94-patch-1
fix: author not show fullname in contribution stats
2018-09-21 08:55:32 +02:00
Lukáš Mešťan
a48347e0df Merge pull request #46 from mathstuf/fix-install-to-empty-prefix
Makefile: fix installing to an empty prefix
2018-09-21 08:52:09 +02:00
Ben Boeckel
f4930f152d Makefile: fix installing to an empty prefix
If `$(PREFIX)` was an empty directory, `$(PREFIX)/bin` would end up
being the executable instead of a directory. Create the `bin` directory
first.
2018-09-20 13:34:18 -04:00
Phạm Ngọc Thắng
e5727cf4e9 fix: author not show fullname 2018-09-19 10:17:16 +07:00
Lukáš Mešťan
6b54e9d8df Merge pull request #44 from dkalowsk/fix_makefile
Makefile: set PREFIX to conditional assignment
2018-08-23 09:32:17 +02:00
Dan Kalowsky
7f70c8b728 Makefile: set PREFIX to conditional assignment
When the variable PREFIX is provided on the command line, do not
override the value.

Signed-off-by: Dan Kalowsky <dank@deadmime.org>
2018-08-22 14:37:11 -07:00
Lukáš Mešťan
dc86f8b6ae Merge pull request #43 from afarah1/master
Fix ambiguous argument when author is not specified for commits by hour
2018-07-26 10:56:39 +02:00
Alef Farah
36967bc6f4 Fix ambiguous argument when author is not specified 2018-07-25 18:38:37 -03:00
Lukáš Mešťan
cdfa6bf467 Merge pull request #42 from RobertBeilich/master
Fix error on whitespace in author name
2018-07-17 16:34:43 +02:00
Robert Beilich
a496390884 Fix error on whitespace in author name
Fixes https://github.com/arzzen/git-quick-stats/issues/37
2018-07-17 09:42:39 +02:00
Lukáš Mešťan
e81d3ab9f4 Update README.md 2018-01-22 20:15:45 +01:00
Lukáš Mešťan
b0e62d64c7 Update README.md 2018-01-22 08:25:42 +01:00
Lukáš Mešťan
01b6e17007 Update LICENSE 2018-01-07 12:33:34 +01:00
Lukáš Mešťan
ac730dbfbc Merge pull request #36 from a7r3/master
Makefile: Don't treat newline characters literally
2017-10-20 08:20:50 +02:00
a7r3
37b37bb5c8 Makefile: Don't treat newline characters literally
Signed-off-by: a7r3 <arvindultimate7352@gmail.com>
2017-10-19 22:04:33 +05:30
Lukáš Mešťan
db8009ff6d Update README.md 2017-09-29 13:41:25 +02:00
Lukáš Mešťan
5a275c87b8 Delete CONTRIBUTING.md 2017-09-29 13:40:28 +02:00
Lukáš Mešťan
98c0252e97 Rename CONTRIBUTING.md to contributing.md 2017-09-29 13:40:15 +02:00
Lukáš Mešťan
5a389f5071 Create issue_template.md 2017-09-29 13:38:57 +02:00
Lukáš Mešťan
382f6759cf Create CONTRIBUTING.md 2017-09-29 13:37:36 +02:00
Lukáš Mešťan
6362149953 Update README.md 2017-09-29 13:33:00 +02:00
Lukáš Mešťan
36cae305a4 Update .travis.yml 2017-09-29 13:28:50 +02:00
Lukáš Mešťan
90f6b631a9 update badges 2017-09-11 15:53:31 +02:00
Lukáš Mešťan
6a894d9efe Update README.md 2017-09-11 15:51:12 +02:00
Lukas Mestan
ef6120fa64 add .mailmap 2017-09-05 08:42:41 +02:00
9 changed files with 115 additions and 58 deletions

3
.mailmap Normal file
View File

@@ -0,0 +1,3 @@
Lukas Mestan <lukas.mestan@gmail.com> Lukáš Mešťan <arzzen@users.noreply.github.com>
Lukas Mestan <lukas.mestan@gmail.com> arzzen

View File

@@ -1,2 +1,34 @@
language: bash
language: generic
sudo: required
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- cmake
install:
- git checkout ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- git branch --set-upstream-to origin/$TRAVIS_BRANCH
- git rev-parse HEAD
script: make test
after_success: |
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
cd kcov-master &&
mkdir build &&
cd build &&
cmake .. &&
make &&
sudo make install &&
cd ../.. &&
rm -rf kcov-master &&
mkdir -p coverage &&
kcov coverage git-quick-stats suggestReviewers && bash <(curl -s https://codecov.io/bash) -cF suggestReviewers &&
kcov coverage git-quick-stats detailedGitStats && bash <(curl -s https://codecov.io/bash) -cF detailedGitStats &&
kcov coverage git-quick-stats commitsPerDay && bash <(curl -s https://codecov.io/bash) -cF commitsPerDay

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 Lukáš Mešťan
Copyright (c) 2018 Lukáš Mešťan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,5 +1,5 @@
PREFIX=/usr/local
TASK_DONE = echo "\n✓ $@ done\n"
PREFIX ?= /usr/local
TASK_DONE = echo -e "\n✓ $@ done\n"
# files that need mode 755
EXEC_FILES=git-quick-stats
@@ -16,7 +16,8 @@ help:
@$(TASK_DONE)
install:
install -m 0755 $(EXEC_FILES) $(PREFIX)/bin
mkdir -p $(PREFIX)/bin
install -m 0755 $(EXEC_FILES) $(PREFIX)/bin/$(EXEC_FILES)
git config --global alias.quick-stats '! $(PREFIX)/bin/$(EXEC_FILES)'
@$(TASK_DONE)

View File

@@ -1,12 +1,13 @@
## GIT quick statistics
## GIT quick statistics [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Simple%20and%20efficient%20way%20to%20access%20various%20statistics%20in%20git%20repository&url=https://github.com/arzzen/git-quick-stat&via=arzzen&hashtags=git,stats,tool,statistics,developers)
[![Travis](https://api.travis-ci.org/arzzen/git-quick-stats.svg?branch=master)](https://travis-ci.org/arzzen/git-quick-stats)
[![homebrew](https://img.shields.io/homebrew/v/git-quick-stats.svg)]()
[![Travis](https://api.travis-ci.org/arzzen/git-quick-stats.svg?branch=master)](https://travis-ci.org/arzzen/git-quick-stats)
[![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](http://braumeister.org/formula/git-quick-stats)
[![Linuxbrew package](https://repology.org/badge/version-for-repo/linuxbrew/git-quick-stats.svg)](https://repology.org/metapackage/git-quick-stats/packages)
> `git quick-stats` is a simple and efficient way to access various statistics in git repository.
> Any git repository contains a tonne of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because of a gadzillion options to a gadzillion git commands I dont think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
> Any git repository contains tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because of a gadzillion options to a gadzillion git commands I dont think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
## Table of Contents
@@ -18,7 +19,7 @@
* [**Windows**](#windows-cygwin)
[**Usage**](#usage)
* [**Git log since/unitl**](#git-log-since-until)
* [**Git log since/until**](#git-log-since-until)
* [**Git log limit**](#git-log-limit)
* [**Git pathspec**](#git-pathspec)
* [**Tests**](#tests)
@@ -28,6 +29,8 @@
[**Contribution**](#contribution)
[**FAQ**](#faq)
[**License**](#licensing)
@@ -48,7 +51,7 @@
```bash
git quick-stats
# or
# or
git-quick-stats
```
@@ -56,7 +59,7 @@ Or you can use (non-interactive) direct execution:
`git quick-stats <optional-command-to-execute-directly>`
Possible arguments:
Possible arguments:
> suggestReviewers, detailedGitStats, commitsByHour, commitsByWeekday, commitsByMonth, commitsPerDay, commitsPerAuthor, myDailyStats, contributors,
branchTree, branchesByDate, changelogs, changelogsByAuthor
@@ -73,7 +76,7 @@ export _GIT_UNTIL="2017-22-01"
then run `git quick-stats` (affect all stats, except "My daily status" and "Git changelogs" )
#### Git log limit
#### Git log limit
You can set variable `_GIT_LIMIT` for limited output (it will affect: "Git changelogs" and "Branch tree view" )
@@ -119,29 +122,35 @@ brew install git-quick-stats
#### Windows (cygwin)
* [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
* [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
* [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
## System requirements
* Unix like OS with a proper shell
* Tools we use: git ; awk ; sed ; tr ; echo ; grep ; cut ; sort ; head ; uniq ; column.
* Tools we use: git ; awk ; sed ; tr ; echo ; grep ; cut ; sort ; head ; uniq ; column ; seq ; tput.
#### Dependences
* [`bsdmainutils`](https://packages.debian.org/sid/bsdmainutils) `apt install bsdmainutils`
## Contribution
## FAQ
*Q:* I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found`
*A:* You can run dos2unix app in cygwin `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert it to Unix format and you then should be able to run it.
## Contribution
Want to contribute? Great! First, read this page.
#### Code reviews
All submissions, including submissions by project members, require review.
All submissions, including submissions by project members, require review.</br>
We use Github pull requests for this purpose.
#### Some tips for good pull requests:
* Use our code
* Use our code </br>
When in doubt, try to stay true to the existing code of the project.
* Write a descriptive commit message. What problem are you solving and what
are the consequences? Where and what did you test? Some good tips:
@@ -159,6 +168,8 @@ This documentation is written using standard [markdown syntax](https://help.gith
#### Tests
[![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats)
```bash
make test
```
@@ -166,7 +177,7 @@ make test
## Licensing
MIT see [LICENSE][] for the full license text.
[read this page]: http://github.com/arzzen/git-quick-stats/blob/master/CONTRIBUTING.md
[read this page]: http://github.com/arzzen/git-quick-stats/blob/master/docs/CONTRIBUTING.md
[landing page]: http://arzzen.github.io/git-quick-stats
[LICENSE]: https://github.com/arzzen/git-quick-stats/blob/master/LICENSE.txt
[LICENSE]: https://github.com/arzzen/git-quick-stats/blob/master/LICENSE

View File

@@ -17,6 +17,7 @@
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<meta http-equiv="refresh" content="0;url=https://lukasmestan.com/git-quick-stats/">
</head>
<body id="page-top">
<header>

9
docs/issue_template.md Normal file
View File

@@ -0,0 +1,9 @@
#### Expected behavior and actual behavior.
#### Steps to reproduce the problem.
#### Specifications like the version of the project, operating system, or hardware.

View File

@@ -26,48 +26,46 @@ else
fi
function show_menu() {
NORMAL=`echo "\033[m"`
MENU=`echo "\033[36m"`
NUMBER=`echo "\033[33m"`
FGRED=`echo "\033[41m"`
RED_TEXT=`echo "\033[31m"`
ENTER_LINE=`echo "\033[33m"`
echo -e ""
echo -e "${RED_TEXT} Generate: ${NORMAL}"
echo -e "${MENU} ${NUMBER} 1)${MENU} Contribution stats (by author) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 2)${MENU} Git changelogs (last $_limit)${NORMAL}"
echo -e "${MENU} ${NUMBER} 3)${MENU} Git changelogs by author ${NORMAL}"
echo -e "${MENU} ${NUMBER} 4)${MENU} My daily status ${NORMAL}"
local NORMAL=$(tput sgr0)
local CYAN_TEXT=$(tput setaf 6)
local RED_TEXT=$(tput setaf 1)
local YELLOW_TEXT=$(tput setaf 3)
echo -e "\n${RED_TEXT} Generate: ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 1)${CYAN_TEXT} Contribution stats (by author) ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 2)${CYAN_TEXT} Git changelogs (last $_limit days)${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 3)${CYAN_TEXT} Git changelogs by author ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 4)${CYAN_TEXT} My daily status ${NORMAL}"
echo -e "${RED_TEXT} List: ${NORMAL}"
echo -e "${MENU} ${NUMBER} 5)${MENU} Branch tree view (last $_limit)${NORMAL}"
echo -e "${MENU} ${NUMBER} 6)${MENU} All branches (sorted by most recent commit) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 7)${MENU} All contributors (sorted by name) ${NORMAL}"
echo -e "${MENU} ${NUMBER} 8)${MENU} Git commits per author ${NORMAL}"
echo -e "${MENU} ${NUMBER} 9)${MENU} Git commits per date ${NORMAL}"
echo -e "${MENU} ${NUMBER} 10)${MENU} Git commits per month ${NORMAL}"
echo -e "${MENU} ${NUMBER} 11)${MENU} Git commits per weekday ${NORMAL}"
echo -e "${MENU} ${NUMBER} 12)${MENU} Git commits per hour ${NORMAL}"
echo -e "${MENU} ${NUMBER} 13)${MENU} Git commits by author per hour ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 5)${CYAN_TEXT} Branch tree view (last $_limit)${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 6)${CYAN_TEXT} All branches (sorted by most recent commit) ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 7)${CYAN_TEXT} All contributors (sorted by name) ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 8)${CYAN_TEXT} Git commits per author ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 9)${CYAN_TEXT} Git commits per date ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 10)${CYAN_TEXT} Git commits per month ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 11)${CYAN_TEXT} Git commits per weekday ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 12)${CYAN_TEXT} Git commits per hour ${NORMAL}"
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 13)${CYAN_TEXT} Git commits by author per hour ${NORMAL}"
echo -e "${RED_TEXT} Suggest: ${NORMAL}"
echo -e "${MENU} ${NUMBER} 14)${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
echo -e "${CYAN_TEXT} ${YELLOW_TEXT} 14)${CYAN_TEXT} Code reviewers (based on git history) ${NORMAL}"
echo -e "\n${YELLOW_TEXT}Please enter a menu option or ${RED_TEXT}press enter to exit. ${NORMAL}"
read -r opt
}
function option_picked() {
COLOR='\033[01;31m'
RESET='\033[00;00m'
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
echo ""
local BOLD=$(tput bold)
local RED_TEXT=$(tput setaf 1)
local COLOR="${BOLD}${RED_TEXT}"
local RESET=$(tput sgr0)
local MESSAGE=${*:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}\n"
}
function detailedGitStats() {
option_picked "Contribution stats (by author):"
git log --use-mailmap --no-merges --numstat --pretty="format:commit %H%nAuthor: %aN <%ae>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until $_pathspec | LC_ALL=C awk '
git log --use-mailmap --no-merges --numstat --pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until $_pathspec | LC_ALL=C awk '
function printStats(author) {
printf "\t%s:\n", author
@@ -97,7 +95,8 @@ function detailedGitStats() {
}
/^Author:/ {
author = $2 " " $3
$1 = ""
author = $0
commits[author] += 1
commits["total"] += 1
}
@@ -201,10 +200,10 @@ function commitsByHour() {
_author="--author=$author"
fi
echo -e "\thour\tsum"
for i in `seq -w 0 23`
for i in $(seq -w 0 23)
do
echo -ne "\t$i\t"
echo $(git shortlog -n --no-merges --format='%ad %s' $_author $_since $_until | grep " $i:" | wc -l)
echo "$(git shortlog -n --no-merges --format='%ad %s' $_author $_since $_until | grep ' '$i: | wc -l)"
done | awk '{
count[$1] = $2
total += $2
@@ -268,19 +267,20 @@ function branchesByDate() {
function changelogs() {
local author="${1:-}"
local _author=''
local _author
if [ -z "$author" ]; then
option_picked "Git changelogs:"
_author="--author=**"
else
option_picked "Git changelogs for author '$author':"
_author="--author=$author"
fi
NEXT=$(date +%F)
git log --use-mailmap --no-merges --format="%cd" --date=short $_author $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
git log --use-mailmap --no-merges --format="%cd" --date=short "$_author" $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
echo
echo "[$DATE]"
GIT_PAGER=cat git log --use-mailmap --no-merges --format=" * %s (%aN)" $_author --since=$DATE --until=$NEXT
GIT_PAGER=cat git log --use-mailmap --no-merges --format=" * %s (%aN)" "$_author" --since=$DATE --until=$NEXT
NEXT=$DATE
done
}