From 3aa68732ef63cb4a821468193dc6a20654287935 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 30 Sep 2015 17:26:19 -0700 Subject: [PATCH] tg-summary.sh: default to HEAD for --rdeps but allow --all Signed-off-by: Kyle J. McKay --- README | 10 +++++++--- tg-summary.sh | 8 +++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README b/README index e62e179..7d8a9f6 100644 --- a/README +++ b/README @@ -417,7 +417,10 @@ tg remote tg summary ~~~~~~~~~~ Show overview of all TopGit-tracked topic branches and their - up-to-date status. With a branch name limit output to that branch: + up-to-date status. With a branch name limit output to that branch. + Using ``--rdeps`` changes the default from all branches to just the + current ``HEAD`` branch but using ``--all`` as the branch name will + show ``--rdeps`` for all branches. ``>`` marks the current topic branch @@ -464,8 +467,9 @@ tg summary The --rdeps option outputs dependency information in an indented text format that clearly shows all the dependencies and their - relationships to one another. By specifying a branch name the - dependency tree output can be limited to that for a single branch. + relationships to one another. When --rdeps is given the default is + to just display information for HEAD, but that can be changed by using + --all as the branch name. Note that the branch name can be specified as ``HEAD`` as a shortcut for the TopGit-controlled branch that ``HEAD`` is a symbolic ref to. diff --git a/tg-summary.sh b/tg-summary.sh index ba8afe9..6c55724 100644 --- a/tg-summary.sh +++ b/tg-summary.sh @@ -16,10 +16,11 @@ branch= usage() { - echo "Usage: ${tgname:-tg} [...] summary [-t | --sort | --deps | --rdeps | --graphviz] [-i | -w] [branch]" >&2 + echo "Usage: ${tgname:-tg} [...] summary [-t | --sort | --deps | --rdeps | --graphviz] [-i | -w] [--all | branch]" >&2 exit 1 } +head= while [ -n "$1" ]; do arg="$1" case "$arg" in @@ -35,7 +36,10 @@ while [ -n "$1" ]; do --deps) deps=1;; --rdeps) + head=HEAD rdeps=1;; + --all) + break;; -*) usage;; *) @@ -44,6 +48,8 @@ while [ -n "$1" ]; do shift done [ $# -le 1 ] || usage +[ $# -ne 1 -o "$1" != "--all" ] || { shift; head=; } +[ $# -ne 0 -o -z "$head" ] || set -- "$head" if [ $# -eq 1 ]; then branch="$(verify_topgit_branch "$1")" -- 2.11.4.GIT