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
="$(strip_ref "$
(git symbolic-ref HEAD
2>/dev
/null
)")"
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 non_annihilated_branches |
114 if [ -n "$terse" ]; then
116 elif [ -n "$graphviz$sort" ]; then
118 [ "$name" = "$curname" ] ||
120 cat_file
"$name:.topdeps" $from |
while read dep
; do
122 ref_exists
"refs/top-bases/$dep" ||
124 if ! "$dep_is_tgish" ||
! branch_annihilated
$dep; then
125 if [ -n "$graphviz" ]; then
126 echo "\"$name\" -> \"$dep\";"
127 if [ "$name" = "$curname" ] ||
[ "$dep" = "$curname" ]; then
128 echo "\"$curname\" [style=filled,fillcolor=yellow];"
131 echo "$name $dep" >&4
140 if [ -n "$graphviz" ]; then
144 if [ -n "$sort" ]; then