Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Implement "tg summary --deps" as a shell function.

This avoids running "$tg summary --deps" from all commands that need
that information internally.

Signed-off-by: Per Cederqvist <ceder@lysator.liu.se>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information...
commit 83d44c01a9494fdd1935012f3bad5ed805c750a3 1 parent 9404aa1
Per Cederqvist cederlys authored Uwe Kleine-König committed

Showing 2 changed files with 30 additions and 9 deletions. Show diff stats Hide diff stats

  1. +9 9 tg-summary.sh
  2. +21 0 tg.sh
18 tg-summary.sh
@@ -99,18 +99,21 @@ process_branch()
99 99 "$name" "$subject"
100 100 }
101 101
  102 +if [ -n "$deps" ]; then
  103 + list_deps
  104 + exit 0
  105 +fi
  106 +
102 107 git for-each-ref refs/top-bases |
103 108 while read rev type ref; do
104 109 name="${ref#refs/top-bases/}"
105 110 if branch_annihilated "$name"; then
106 111 continue;
107   - fi;
  112 + fi
108 113
109 114 if [ -n "$terse" ]; then
110 115 echo "$name"
111   - continue
112   - fi
113   - if [ -n "$graphviz$sort$deps" ]; then
  116 + elif [ -n "$graphviz$sort" ]; then
114 117 git cat-file blob "$name:.topdeps" | while read dep; do
115 118 dep_is_tgish=true
116 119 ref_exists "refs/top-bases/$dep" ||
@@ -118,17 +121,14 @@ git for-each-ref refs/top-bases |
118 121 if ! "$dep_is_tgish" || ! branch_annihilated $dep; then
119 122 if [ -n "$graphviz" ]; then
120 123 echo "\"$name\" -> \"$dep\";"
121   - elif [ -n "$deps" ]; then
122   - echo "$name $dep"
123 124 else
124 125 echo "$name $dep" >&4
125 126 fi
126 127 fi
127 128 done
128   - continue
  129 + else
  130 + process_branch
129 131 fi
130   -
131   - process_branch
132 132 done
133 133
134 134 if [ -n "$graphviz" ]; then
21 tg.sh
@@ -239,6 +239,27 @@ branch_empty()
239 239 [ -z "$(git diff-tree "refs/top-bases/$1" "$1" -- | fgrep -v " .top")" ]
240 240 }
241 241
  242 +# list_deps
  243 +list_deps()
  244 +{
  245 + git for-each-ref refs/top-bases |
  246 + while read rev type ref; do
  247 + name="${ref#refs/top-bases/}"
  248 + if branch_annihilated "$name"; then
  249 + continue;
  250 + fi
  251 +
  252 + git cat-file blob "$name:.topdeps" | while read dep; do
  253 + dep_is_tgish=true
  254 + ref_exists "refs/top-bases/$dep" ||
  255 + dep_is_tgish=false
  256 + if ! "$dep_is_tgish" || ! branch_annihilated $dep; then
  257 + echo "$name $dep"
  258 + fi
  259 + done
  260 + done
  261 +}
  262 +
242 263 # switch_to_base NAME [SEED]
243 264 switch_to_base()
244 265 {

0 comments on commit 83d44c0

Please sign in to comment.
Something went wrong with that request. Please try again.