2 # TopGit - A different patch queue manager
3 # (C) Petr Baudis <pasky@suse.cz> 2008
4 # (C) Kyle J. McKay <mackyle@gmail.com> 2015
19 echo "Usage: ${tgname:-tg} [...] summary [-t | --sort | --deps | --rdeps | --graphviz] [-i | -w] [branch]" >&2
27 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
49 branch
="$(verify_topgit_branch "$1")"
52 [ "$terse$graphviz$sort$deps" = "" ] ||
53 [ "$terse$graphviz$sort$deps$rdeps" = "1" ] ||
54 die
"mutually exclusive options given"
58 if [ -n "$branch" ]; then
61 non_annihilated_branches
65 curname
="$(strip_ref "$
(git symbolic-ref HEAD
2>/dev
/null
)")"
69 printf '%s %s\n' "$(echo "$_depchain" | sed -e 's/[^ ][^ ]*/ /g')" "$_dep"
72 if [ -n "$rdeps" ]; then
77 [ -z "$showbreak" ] ||
echo
79 ref_exists
"refs/heads/$b" ||
continue
82 recurse_deps show_rdeps
"$b"
87 if [ -n "$graphviz" ]; then
89 # GraphViz output; pipe to:
90 # | dot -Tpng -o <output>
98 label="TopGit Layout\n\n\n"
107 if [ -n "$sort" ]; then
108 tsort_input
="$(get_temp tg-summary-sort)"
120 [ "$name" != "$curname" ] || current
='>'
122 [ "$name" = "$curname" ] ||
125 ! branch_empty
"$name" $from || nonempty
='0'
127 [ -z "$base_remote" ] || remote
='l'
128 ! has_remote
"$name" || remote
='r'
130 [ "$remote" != 'r' ] ||
! ref_exists
"refs/remotes/$base_remote/top-bases/$name" ||
{
131 branch_contains
"refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$name" &&
132 branch_contains
"$name" "refs/remotes/$base_remote/$name"
134 [ "$rem_update" = 'R' ] || branch_contains
"refs/remotes/$base_remote/$name" "$name" 2>/dev
/null ||
137 needs_update
"$name" >/dev
/null || deps_update
='D'
139 [ -z "$missing_deps" ] || deps_missing
='!'
141 branch_contains
"$name" "refs/top-bases/$name" || base_update
='B'
143 if [ "$(git rev-parse "$name")" != "$rev" ]; then
144 subject
="$(cat_file "$name:.topmsg
" $from | sed -n 's/^Subject: //p')"
147 subject
="(No commits)"
150 printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
154 if [ -n "$deps" ]; then
161 if [ -n "$terse" ]; then
163 elif [ -n "$graphviz$sort" ]; then
165 [ "$name" = "$curname" ] ||
167 cat_file
"$name:.topdeps" $from |
while read dep
; do
169 ref_exists
"refs/top-bases/$dep" ||
171 if ! "$dep_is_tgish" ||
! branch_annihilated
$dep; then
172 if [ -n "$graphviz" ]; then
173 echo "\"$name\" -> \"$dep\";"
174 if [ "$name" = "$curname" ] ||
[ "$dep" = "$curname" ]; then
175 echo "\"$curname\" [style=filled,fillcolor=yellow];"
178 echo "$name $dep" >&4
187 if [ -n "$graphviz" ]; then
191 if [ -n "$sort" ]; then