2 # TopGit - A different patch queue manager
3 # (C) Petr Baudis <pasky@suse.cz> 2008
4 # (C) Kyle J. McKay <mackyle@gmail.com> 2015
21 echo "Usage: ${tgname:-tg} [...] summary [-t | --sort | --deps | --rdeps | --graphviz] [-i | -w] [--exclude branch]... [--all | branch]" >&2
29 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
45 [ -n "${1#--exclude=}" ] || die
"--exclude= requires a branch name"
46 exclude
="$exclude ${1#--exclude=}";;
49 [ -n "$1" -a "$1" != "--all" ] || die
"--exclude requires a branch name"
50 exclude
="$exclude $1";;
58 [ -z "$exclude" ] || exclude
="$exclude "
60 [ $# -ne 1 -o "$1" != "--all" ] ||
{ shift; head=; }
61 [ $# -ne 0 -o -z "$head" ] ||
set -- "$head"
64 branch
="$(verify_topgit_branch "$1")"
67 [ "$terse$graphviz$sort$deps" = "" ] ||
68 [ "$terse$graphviz$sort$deps$rdeps" = "1" ] ||
69 die
"mutually exclusive options given"
73 if [ -n "$branch" ]; then
76 non_annihilated_branches
80 curname
="$(strip_ref "$
(git symbolic-ref HEAD
2>/dev
/null
)")"
84 case "$exclude" in *" $_dep "*) return; esac
85 printf '%s %s\n' "$(echo "$_depchain" | sed -e 's/[^ ][^ ]*/ /g')" "$_dep"
88 if [ -n "$rdeps" ]; then
93 case "$exclude" in *" $branch "*) continue; esac
94 [ -z "$showbreak" ] ||
echo
96 ref_exists
"refs/heads/$b" ||
continue
99 recurse_deps show_rdeps
"$b"
104 if [ -n "$graphviz" ]; then
106 # GraphViz output; pipe to:
107 # | dot -Tpng -o <output>
115 label="TopGit Layout\n\n\n"
124 if [ -n "$sort" ]; then
125 tsort_input
="$(get_temp tg-summary-sort)"
137 [ "$name" != "$curname" ] || current
='>'
139 [ "$name" = "$curname" ] ||
142 ! branch_empty
"$name" $from || nonempty
='0'
144 [ -z "$base_remote" ] || remote
='l'
145 ! has_remote
"$name" || remote
='r'
147 [ "$remote" != 'r' ] ||
! ref_exists
"refs/remotes/$base_remote/top-bases/$name" ||
{
148 branch_contains
"refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$name" &&
149 branch_contains
"$name" "refs/remotes/$base_remote/$name"
151 [ "$rem_update" = 'R' ] || branch_contains
"refs/remotes/$base_remote/$name" "$name" 2>/dev
/null ||
154 needs_update
"$name" >/dev
/null || deps_update
='D'
156 [ -z "$missing_deps" ] || deps_missing
='!'
158 branch_contains
"$name" "refs/top-bases/$name" || base_update
='B'
160 if [ "$(git rev-parse "$name")" != "$rev" ]; then
161 subject
="$(cat_file "$name:.topmsg
" $from | sed -n 's/^Subject: //p')"
164 subject
="(No commits)"
167 printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
171 if [ -n "$deps" ]; then
172 case "$exclude" in *" ${branch:-..all..} "*) exit 0; esac
173 list_deps
$head_from $branch |
174 while read name dep
; do
175 case "$exclude" in *" $dep "*) continue; esac
183 case "$exclude" in *" $name "*) continue; esac
184 if [ -n "$terse" ]; then
186 elif [ -n "$graphviz$sort" ]; then
188 [ "$name" = "$curname" ] ||
190 cat_file
"$name:.topdeps" $from |
while read dep
; do
192 ref_exists
"refs/top-bases/$dep" ||
194 if ! "$dep_is_tgish" ||
! branch_annihilated
$dep; then
195 if [ -n "$graphviz" ]; then
196 echo "\"$name\" -> \"$dep\";"
197 if [ "$name" = "$curname" ] ||
[ "$dep" = "$curname" ]; then
198 echo "\"$curname\" [style=filled,fillcolor=yellow];"
201 echo "$name $dep" >&4
210 if [ -n "$graphviz" ]; then
214 if [ -n "$sort" ]; then