From afbe885bb59c158242141a06ecb4e783750bd7fa Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 29 Mar 2017 15:01:32 -0700 Subject: [PATCH] tg-summary.sh: awksome accelerate --list --verbosely Use the run_awk_topgit_branches and run_awk_topgit_msg functions to extremely accelerate the "--list" function of tg summary. As a bonus, if the new "--verbose" (or just "-v") option is also used then include the subjects in the list. It's now blazingly fast with or without --verbose whereas before it was okay but nowhere near fast enough to include the subject lines too. Also sneak in support for spelling out "-t" as "--terse". Signed-off-by: Kyle J. McKay --- README | 1 + tg-summary.sh | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README b/README index 1611d7f..61f762c 100644 --- a/README +++ b/README @@ -890,6 +890,7 @@ tg summary This can take a longish time to accurately determine all the relevant information about each branch; you can pass ``-t`` (or ``-l`` or ``--list``) to get just a terse list of topic branch names quickly. + Also adding ``--verbose`` (or ``-v``) includes the subjects too. If no options or arguments are passed, the default is not actually to show ``--all`` branches (that was the default once upon a time). diff --git a/tg-summary.sh b/tg-summary.sh index fc154e1..71fdc1c 100644 --- a/tg-summary.sh +++ b/tg-summary.sh @@ -20,6 +20,7 @@ headsonly= exclude= tgish= withdeps= +verbose=0 ## Parse options @@ -35,8 +36,10 @@ while [ -n "$1" ]; do -i|-w) [ -z "$head_from" ] || die "-i and -w are mutually exclusive" head_from="$arg";; - -t|--list|-l) + -t|--list|-l|--terse) terse=1;; + -v|--verbose) + verbose=1;; --heads|--topgit-heads) heads=1 headsindep=;; @@ -236,7 +239,7 @@ if [ -n "$withdeps" ]; then savetgish="$tgish" tgish=1 origbranches="$branches" - branches="$(skip_ann=1; show_deps | sort -u -b -k1,1)" + branches="$(skip_ann=1; show_deps | sort -u -b -k1,1 | paste -d " " -s -)" tgish="$savetgish" fi @@ -363,13 +366,21 @@ if [ -n "$deps" ]; then exit 0 fi -[ -n "$terse$graphviz$sort" ] || compute_ahead_list +if [ -n "$terse" ]; then + refslist= + [ -z "$tg_read_only" ] || [ -z "$tg_ref_cache" ] || ! [ -s "$tg_ref_cache" ] || + refslist="-r=\"$tg_ref_cache\"" + cmd="run_awk_topgit_msg --list" + [ "${verbose:-0}" != "0" ] || cmd="run_awk_topgit_branches -n" + eval "$cmd" "$refslist" '-i="$branches" -x="$exclude" "refs/$topbases"' + exit 0 +fi + +[ -n "$graphviz$sort" ] || compute_ahead_list get_branch_list | while read name; do case "$exclude" in *" $name "*) continue; esac - if [ -n "$terse" ]; then - echol "$name" - elif [ -n "$graphviz$sort" ]; then + if [ -n "$graphviz$sort" ]; then from=$head_from [ "$name" = "$curname" ] || from= -- 2.11.4.GIT