aboutsummaryrefslogtreecommitdiffstats
path: root/tools/status
diff options
context:
space:
mode:
authorGustav Eek <gustav.eek@fripost.org>2020-01-14 06:55:20 +0100
committerGustav Eek <gustav.eek@fripost.org>2020-01-14 06:55:20 +0100
commit8de104dd0d273e84a504009f507e8ce5b4ae4e27 (patch)
treec8e63c7c76cccb5215f7fd94e65ffdbffbb834c9 /tools/status
parentd0e54f0c653f021f18cc66adfe2cd4fed098ab72 (diff)
parent5a1d1b95993cd6f1184133bcf9c409ef74334acc (diff)
Merge branch 'master' into 2019-05-05-annual
Conflicts: preamble/preamble.tex preamble/acronyms.tex preamble/attendants.tex
Diffstat (limited to 'tools/status')
-rwxr-xr-xtools/status48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/status b/tools/status
new file mode 100755
index 0000000..f053ef4
--- /dev/null
+++ b/tools/status
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+
+y=$(basename $(pwd))
+b=$(git branch | grep '\*' | tr '*' ' ')
+
+# Control
+
+all=
+year=true
+
+case $1 in
+ -v) all=true ;;
+esac
+
+if ! [[ $y =~ ^[0-9]*$ ]]; then # Not a year
+ year=
+ all=true
+fi
+
+
+function year_branches {
+ echo "Minues tex files $y on $b:"
+ ls -1 $y*.tex | while read f; do
+ wc=$(cat $f | sed '/begin{document}/,/end{document}/ p; d' | wc -w)
+ echo " $(printf '%s %4.d' $f $wc)"
+ done
+
+ echo "Local branches of $y:"
+ git branch | grep "master\|$y" | tr '*' ' ' \
+ | xargs -I{} -n1 git log -n1 \
+ --pretty=format:" {} - %h -%d%n %s%n (%an, %ad, %cr)"\
+ {}
+}
+
+function all_branches {
+ echo "All branches (commiter date, author date, hash, branch):"
+ git branch -a | tr '*' ' ' | grep -v HEAD \
+ | xargs -n1 git log -n1 \
+ --date=short \
+ --pretty=format:' %cd %ad %h -%d%n' \
+ | sort -u
+}
+
+if [[ "${0##*/}" == "status" ]]; then
+ test -n "$year" && year_branches
+ test -n "$all" && all_branches
+fi