[TopGit PATCH 3/4] tg-prev/tg-next: --all option
This adds an --all option to tg-prev and tg-next, to show all offenders.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
Note the dependency on bw/tred is only historical, it depends only bw/fan-in-out.
README | 2 ++
contrib/tg-completion.bash | 2 ++
tg-next.sh | 11 ++++++++++-
tg-prev.sh | 11 ++++++++++-
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/README b/README
index 49f7b10..b1dc45a 100644 README
--- a/README
+++ b/README
@@ -573,6 +573,7 @@ tg prev
Options:
-i show dependencies based on index instead of branch
-w show dependencies based on working tree instead of branch
+ --all show not only the direct but all dependencies
tg next
~~~~~~~
@@ -582,6 +583,7 @@ tg next
Options:
-i show dependencies based on index instead of branch
-w show dependencies based on working tree instead of branch
+ --all show not only the direct but all dependencies
TODO: tg rename
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index d319828..d18f564 100755 contrib/tg-completion.bash
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -475,6 +475,7 @@ _tg_next ()
case "$cur" in
-*)
__tgcomp "
+ --all
-i
-w
"
@@ -491,6 +492,7 @@ _tg_prev ()
case "$cur" in
-*)
__tgcomp "
+ --all
-i
-w
"
diff --git a/tg-next.sh b/tg-next.sh
index 9b352b3..abb9a53 100644 tg-next.sh
--- a/tg-next.sh
+++ b/tg-next.sh
@@ -5,6 +5,7 @@
# GPLv2
name=
+all=false
head_deps=
@@ -17,8 +18,10 @@ while [ -n "$1" ]; do
head_deps='(i)';;
-w)
head_deps='(w)';;
+ --all)
+ all=true;;
-*)
- echo "Usage: tg next [-i | -w] [NAME]" >&2
+ echo "Usage: tg next [--all] [-i | -w] [NAME]" >&2
exit 1;;
*)
[ -z "$name" ] || die "name already specified ($name)"
@@ -29,6 +32,12 @@ done
head="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
[ -n "$name" ] || name=$head
+if $all; then
+ # ignore first line, which is $name
+ list_fan_in "$name" $head_deps | tail --lines=+2
+ exit $?
+fi
+
git for-each-ref --format='%(refname)' refs/top-bases |
while read ref; do
parent="${ref#refs/top-bases/}"
diff --git a/tg-prev.sh b/tg-prev.sh
index efef410..63f71bd 100644 tg-prev.sh
--- a/tg-prev.sh
+++ b/tg-prev.sh
@@ -5,6 +5,7 @@
# GPLv2
name=
+all=false
head_deps=
@@ -17,8 +18,10 @@ while [ -n "$1" ]; do
head_deps='(i)';;
-w)
head_deps='(w)';;
+ --all)
+ all=true;;
-*)
- echo "Usage: tg next [-i | -w] [NAME]" >&2
+ echo "Usage: tg next [--all] [-i | -w] [NAME]" >&2
exit 1;;
*)
[ -z "$name" ] || die "name already specified ($name)"
@@ -31,6 +34,12 @@ head="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "not a TopGit-controlled branch"
+if $all; then
+ # ignore first line, which is $name
+ list_fan_out "$name" $head_deps | tail --lines=+2
+ exit $?
+fi
+
deps_src=$name
# select .topdeps source for HEAD branch
[ "x$name" = "x$head" -a -n "$head_deps" ] &&
--
tg: (bf1dfaa..) bw/next-prev (depends on: bw/tred bw/next-prev-base)