Merge "Add node script that sends a telegram when folder is unmodified"
diff --git a/Readme.md b/Readme.md
index 531ece7..e430782 100644
--- a/Readme.md
+++ b/Readme.md
@@ -3,6 +3,7 @@
## Index of tools
* [Import (cherry-pick) pull requests from github](Import pull requests from github)
+* [Count commits in repositories](Count commits in repositories)
## Import pull requests from github
@@ -99,3 +100,13 @@
#
# ssh -p 29418 korap gerrit review --code-review +1 $(git rev-list f4fa1eb65586dd0f96ea1cc8efb71223f8667e9f..HEAD)
```
+
+## Count commits in repositories
+
+Script to count all commits in various repositories for reporting.
+
+More information using ...
+
+```shell
+$ perldoc count_commits
+```
diff --git a/bin/count_commits b/bin/count_commits
index 6e47184..d765c71 100755
--- a/bin/count_commits
+++ b/bin/count_commits
@@ -2,14 +2,17 @@
use strict;
use warnings;
use Mojo::File qw'path';
+use Mojo::Util qw!extract_usage!;
use feature 'say';
use DateTime;
use Getopt::Long;
GetOptions (
"help|h" => sub {
- say "--quarter (Defaults to month)";
- say "--current (Default to last)";
+ say "--quarter (show statistics for a quarter instead of a month)";
+ say "--current (show statistics for the current instead of the last unit)";
+ say "--user []";
+ say extract_usage;
exit(0);
},
"quarter|q" => \(my $quarter),
@@ -53,6 +56,7 @@
my $cmd = "git shortlog -sne " .
"--since='01 $from $year' " .
"--before='31 $to $year' " .
+ "--no-merges " .
"--max-parents=1";
my $sum = 0;
@@ -96,8 +100,16 @@
exit(0);
+__END__
+
=pod
+=head1 SYNOPSIS
+
+ Usage: count_commits --quarter --current --user Akron
+
+=head1 DESCRIPTION
+
This script will count and sum up all commits
in all repositories listed in the configured repositories
for a certain user in the current branches.
@@ -112,6 +124,8 @@
/path/to/my/repo2
...
+The username has to be in the first line and written in square brackets.
+
Two different time ranges are supported:
Per default the last finished month
diff --git a/bin/import_github_pull_requests b/bin/import_github_pull_requests
index 4dd6e14..f0f5477 100755
--- a/bin/import_github_pull_requests
+++ b/bin/import_github_pull_requests
@@ -54,8 +54,8 @@
git fetch github
git fetch origin
OLDHEAD=$(git log --pretty=format:%H -1)
-IFS=','
-while read -r success nr sha message; do
+
+while IFS=',' read -r success nr sha message; do
if [ "$success" == "$GET_CI_STATUS_SUCCESS" ]; then
if git cherry-pick "$sha" > /dev/null 2> /dev/null; then
# add closes #<nr> to let github automatically close the PR and add change-id via hook