chiark / gitweb /
Added the --deps option to "tg summary".
authorPer Cederqvist <ceder@lysator.liu.se>
Wed, 14 Jul 2010 16:21:15 +0000 (18:21 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 25 Jul 2010 18:51:18 +0000 (20:51 +0200)
The --deps option can be used by scripts that need to know
the dependencies between the topic branches.

Signed-off-by: Per Cederqvist <ceder@lysator.liu.se>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
README
tg-summary.sh

diff --git a/README b/README
index dcb7e805412d361def75c54e56f31f465bfbca58..d7dfb5f6497ca03776f7c883b493e4a365332922 100644 (file)
--- a/README
+++ b/README
@@ -358,6 +358,10 @@ tg summary
        order.  In more complex scenarios, a text graph view would be
        much more useful, but that is not yet implemented.
 
        order.  In more complex scenarios, a text graph view would be
        much more useful, but that is not yet implemented.
 
+       The --deps option outputs dependency informations between
+       branches in a machine-readable format.  Feed this to "tsort"
+       to get the output from --sort.
+
        TODO: Speed up by an order of magnitude
        TODO: Text graph view
 
        TODO: Speed up by an order of magnitude
        TODO: Text graph view
 
index a2cb9862cec62195383c8d571604676a7b9a1971..a92480ff38f0f13444909c5d3895ae2543b7765e 100644 (file)
@@ -6,6 +6,7 @@
 terse=
 graphviz=
 sort=
 terse=
 graphviz=
 sort=
+deps=
 
 
 ## Parse options
 
 
 ## Parse options
@@ -19,22 +20,19 @@ while [ -n "$1" ]; do
                graphviz=1;;
        --sort)
                sort=1;;
                graphviz=1;;
        --sort)
                sort=1;;
+       --deps)
+               deps=1;;
        *)
        *)
-               echo "Usage: tg [...] summary [-t | --sort | --graphviz]" >&2
+               echo "Usage: tg [...] summary [-t | --sort | --deps | --graphviz]" >&2
                exit 1;;
        esac
 done
 
 curname="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
 
                exit 1;;
        esac
 done
 
 curname="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
 
-! [ -n "$terse" -a -n "$graphviz" ] ||
-       die "-t and --graphviz options are mutual exclusive"
-
-! [ -n "$sort" -a -n "$graphviz" ] ||
-       die "--sort and --graphviz options are mutual exclusive"
-
-! [ -n "$sort" -a -n "$terse" ] ||
-       die "-t and --sort options are mutual exclusive"
+[ "$terse$graphviz$sort$deps" = "" ] ||
+       [ "$terse$graphviz$sort$deps" = "1" ] ||
+       die "mutually exclusive options given"
 
 if [ -n "$graphviz" ]; then
        cat <<EOT
 
 if [ -n "$graphviz" ]; then
        cat <<EOT
@@ -76,7 +74,7 @@ git for-each-ref refs/top-bases |
                        echo "$name"
                        continue
                fi
                        echo "$name"
                        continue
                fi
-               if [ -n "$graphviz" ] || [ -n "$sort" ]; then
+               if [ -n "$graphviz$sort$deps" ]; then
                        git cat-file blob "$name:.topdeps" | while read dep; do
                                dep_is_tgish=true
                                ref_exists "refs/top-bases/$dep"  ||
                        git cat-file blob "$name:.topdeps" | while read dep; do
                                dep_is_tgish=true
                                ref_exists "refs/top-bases/$dep"  ||
@@ -84,6 +82,8 @@ git for-each-ref refs/top-bases |
                                if ! "$dep_is_tgish" || ! branch_annihilated $dep; then
                                        if [ -n "$graphviz" ]; then
                                                echo "\"$name\" -> \"$dep\";"
                                if ! "$dep_is_tgish" || ! branch_annihilated $dep; then
                                        if [ -n "$graphviz" ]; then
                                                echo "\"$name\" -> \"$dep\";"
+                                       elif [ -n "$deps" ]; then
+                                               echo "$name $dep"
                                        else
                                                echo "$name $dep" >&4
                                        fi
                                        else
                                                echo "$name $dep" >&4
                                        fi