2 # TopGit - A different patch queue manager
3 # Copyright (C) Petr Baudis <pasky@suse.cz> 2008
4 # Copyright (C) Kyle J. McKay <mackyle@gmail.com> 2015
23 echo "Usage: ${tgname:-tg} [...] summary [-t | --list | --sort | --deps | --deps-only | --rdeps | --graphviz] [-i | -w] [--exclude branch]... [--all | branch...]" >&2
31 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
50 [ -n "${1#--exclude=}" ] || die
"--exclude= requires a branch name"
51 exclude
="$exclude ${1#--exclude=}";;
54 [ -n "$1" -a "$1" != "--all" ] || die
"--exclude requires a branch name"
55 exclude
="$exclude $1";;
63 [ -z "$exclude" ] || exclude
="$exclude "
64 if [ "$1" = "--all" ]; then
69 [ $# -ne 0 -o -z "$head" ] ||
set -- "$head"
71 [ "$terse$graphviz$sort$deps$depsonly" = "" ] ||
72 [ "$terse$graphviz$sort$deps$depsonly$rdeps" = "1" ] ||
73 die
"mutually exclusive options given"
76 [ "$b" != "--all" ] || usage
77 branches
="$branches $(verify_topgit_branch "$b")"
82 if [ -n "$branches" ]; then
83 printf '%s\n' $branches
85 non_annihilated_branches
90 case "$exclude" in *" $_dep "*) return; esac
91 case " $seen_deps " in *" $_dep "*) return 0; esac
92 seen_deps
="${seen_deps:+$seen_deps }$_dep"
100 get_branch_list |
while read _b
; do
101 case "$exclude" in *" $_b "*) continue; esac
102 case " $recurse_deps_exclude " in *" $_b "*) continue; esac
104 _dep
="$_b"; _dep_is_tgish
=1; show_dep
105 recurse_deps show_dep
"$_b"
106 recurse_deps_exclude
="$recurse_deps_exclude $seen_deps"
110 if [ -n "$depsonly" ]; then
111 show_deps | LC_ALL
=C
sort -u -b -k1,1
117 case "$exclude" in *" $_dep "*) return; esac
118 printf '%s %s\n' "$_depchain" "$_dep"
121 if [ -n "$rdeps" ]; then
126 case "$exclude" in *" $b "*) continue; esac
127 [ -z "$showbreak" ] ||
echo
129 ref_exists
"refs/heads/$b" ||
continue
133 recurse_deps show_rdeps
"$b"
134 } |
sed -e 's/[^ ][^ ]*[ ]/ /g'
139 curname
="$(strip_ref "$
(git symbolic-ref HEAD
2>/dev
/null
)")"
141 if [ -n "$graphviz" ]; then
143 # GraphViz output; pipe to:
144 # | dot -Tpng -o <output>
152 label="TopGit Layout\n\n\n"
161 if [ -n "$sort" ]; then
162 tsort_input
="$(get_temp tg-summary-sort)"
174 [ "$name" != "$curname" ] || current
='>'
176 [ "$name" = "$curname" ] ||
179 ! branch_empty
"$name" $from || nonempty
='0'
181 [ -z "$base_remote" ] || remote
='l'
182 ! has_remote
"$name" || remote
='r'
184 [ "$remote" != 'r' ] ||
! ref_exists
"refs/remotes/$base_remote/top-bases/$name" ||
{
185 branch_contains
"refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$name" &&
186 branch_contains
"refs/heads/$name" "refs/remotes/$base_remote/$name"
188 [ "$remote" != 'r' -o "$rem_update" = 'R' ] ||
{
189 branch_contains
"refs/remotes/$base_remote/$name" "refs/heads/$name" 2>/dev
/null
192 needs_update
"$name" >/dev
/null || deps_update
='D'
194 [ -z "$missing_deps" ] || deps_missing
='!'
196 branch_contains
"refs/heads/$name" "refs/top-bases/$name" || base_update
='B'
198 if [ "$(ref_exists_rev "refs
/heads
/$name")" != "$(ref_exists_rev "refs
/top-bases
/$name")" ]; then
199 subject
="$(cat_file "refs
/heads
/$name:.topmsg
" $from | sed -n 's/^Subject: //p')"
202 subject
="(No commits)"
205 printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
209 if [ -n "$deps" ]; then
210 if [ -n "$branches" ]; then
213 case "$exclude" in *" $b "*) continue; esac
214 list_deps
$head_from $b |
215 while read name dep
; do
216 case "$exclude" in *" $dep "*) continue; esac
221 list_deps
$head_from |
222 while read name dep
; do
223 case "$exclude" in *" $dep "*) continue; esac
232 case "$exclude" in *" $name "*) continue; esac
233 if [ -n "$terse" ]; then
235 elif [ -n "$graphviz$sort" ]; then
237 [ "$name" = "$curname" ] ||
239 cat_file
"refs/heads/$name:.topdeps" $from |
while read dep
; do
241 ref_exists
"refs/top-bases/$dep" ||
243 if ! "$dep_is_tgish" ||
! branch_annihilated
$dep; then
244 if [ -n "$graphviz" ]; then
245 echo "\"$name\" -> \"$dep\";"
246 if [ "$name" = "$curname" ] ||
[ "$dep" = "$curname" ]; then
247 echo "\"$curname\" [style=filled,fillcolor=yellow];"
250 echo "$name $dep" >&4
259 if [ -n "$graphviz" ]; then
263 if [ -n "$sort" ]; then