2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
18 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
29 echo "Usage: tg [...] summary [-t | --sort | --deps | --graphviz] [-i | -w]" >&2
34 curname
="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
36 [ "$terse$graphviz$sort$deps" = "" ] ||
37 [ "$terse$graphviz$sort$deps" = "1" ] ||
38 die
"mutually exclusive options given"
40 if [ -n "$graphviz" ]; then
42 # GraphViz output; pipe to:
43 # | dot -Tpng -o <ouput>
51 label="TopGit Layout\n\n\n"
60 if [ -n "$sort" ]; then
61 tsort_input
="$(get_temp tg-summary-sort)"
73 [ "$name" != "$curname" ] || current
='>'
75 [ "$name" = "$curname" ] ||
78 ! branch_empty
"$name" $from || nonempty
='0'
80 [ -z "$base_remote" ] || remote
='l'
81 ! has_remote
"$name" || remote
='r'
83 [ "$remote" != 'r' ] ||
! ref_exists
"refs/remotes/$base_remote/top-bases/$name" ||
{
84 branch_contains
"refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$name" &&
85 branch_contains
"$name" "refs/remotes/$base_remote/$name"
87 [ "$rem_update" = 'R' ] || branch_contains
"refs/remotes/$base_remote/$name" "$name" 2>/dev
/null ||
90 needs_update
"$name" >/dev
/null || deps_update
='D'
92 [ -z "$missing_deps" ] || deps_missing
='!'
94 branch_contains
"$name" "refs/top-bases/$name" || base_update
='B'
96 if [ "$(git rev-parse "$name")" != "$rev" ]; then
97 subject
="$(cat_file "$name:.topmsg
" $from | sed -n 's/^Subject: //p')"
100 subject
="(No commits)"
103 printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
107 if [ -n "$deps" ]; then
112 git for-each-ref refs
/top-bases |
113 while read rev type ref
; do
114 name
="${ref#refs/top-bases/}"
115 if branch_annihilated
"$name"; then
119 if [ -n "$terse" ]; then
121 elif [ -n "$graphviz$sort" ]; then
123 [ "$name" = "$curname" ] ||
125 cat_file
"$name:.topdeps" $from |
while read dep
; do
127 ref_exists
"refs/top-bases/$dep" ||
129 if ! "$dep_is_tgish" ||
! branch_annihilated
$dep; then
130 if [ -n "$graphviz" ]; then
131 echo "\"$name\" -> \"$dep\";"
132 if [ "$name" = "$curname" ] ||
[ "$dep" = "$curname" ]; then
133 echo "\"$curname\" [style=filled,fillcolor=yellow];"
136 echo "$name $dep" >&4
145 if [ -n "$graphviz" ]; then
149 if [ -n "$sort" ]; then