chiark
/
gitweb
/
~ian
/
topgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix indentation
[topgit.git]
/
tg-summary.sh
diff --git
a/tg-summary.sh
b/tg-summary.sh
index 4ffebcefda524f434860306779cd541d21477af5..3c90a6b5952e526bac9da80e84386d6abf6246a8 100644
(file)
--- a/
tg-summary.sh
+++ b/
tg-summary.sh
@@
-3,22
+3,64
@@
# (c) Petr Baudis <pasky@suse.cz> 2008
# GPLv2
# (c) Petr Baudis <pasky@suse.cz> 2008
# GPLv2
+terse=
+graphviz=
+
## Parse options
## Parse options
-if [ -n "$1" ]; then
- echo "Usage: tg summary" >&2
- exit 1
-fi
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -t)
+ terse=1;;
+ --graphviz)
+ graphviz=1;;
+ *)
+ echo "Usage: tg [...] summary [-t | --graphviz]" >&2
+ exit 1;;
+ esac
+done
curname="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
curname="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+if [ -n "$graphviz" ]; then
+ cat <<EOT
+# GraphViz output; pipe to:
+# | dot -Tpng -o <ouput>
+# or
+# | dot -Txlib
+
+digraph G {
+
+graph [
+ rankdir = "TB"
+ label="TopGit Layout\n\n\n"
+ fontsize = 14
+ labelloc=top
+ pad = "0.5,0.5"
+];
+
+EOT
+fi
+
## List branches
git for-each-ref refs/top-bases |
while read rev type ref; do
name="${ref#refs/top-bases/}"
## List branches
git for-each-ref refs/top-bases |
while read rev type ref; do
name="${ref#refs/top-bases/}"
+ if [ -n "$terse" ]; then
+ echo "$name"
+ continue
+ fi
+ if [ -n "$graphviz" ]; then
+ git cat-file blob "$name:.topdeps" | while read dep; do
+ echo "\"$name\" -> \"$dep\";"
+ done
+ continue
+ fi
+
missing_deps=
current=' '
missing_deps=
current=' '
@@
-52,3
+94,7
@@
git for-each-ref refs/top-bases |
printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
"$name" "$subject"
done
printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
"$name" "$subject"
done
+
+if [ -n "$graphviz" ]; then
+ echo '}'
+fi