2 # TopGit - A different patch queue manager
3 # Copyright (C) 2008 Petr Baudis <pasky@suse.cz>
4 # Copyright (C) 2009 Bert Wesarg <Bert.Wesarg@googlemail.com>
5 # Copyright (C) 2017 Kyle J. McKay <mackyle@gmail.com>
10 Usage: ${tgname:-tg} [...] next [-v] [-i | -w] [-a | -n <steps>] [<name>]"
14 [ -z "$2" ] ||
printf '%s\n' "$2" >&2
15 if [ "${1:-0}" != 0 ]; then
16 printf '%s\n' "$USAGE" >&2
18 printf '%s\n' "$USAGE"
27 for (i = 2; i <= NF; ++i) names = names ", " $i
28 print $1 " [" substr(names, 3) "]"
37 aremutex
="are mutually exclusive"
43 [ "$2" = "${2%%[!0-9]*}" ] ||
44 usage
1 "invalid $1 step count"
46 [ "$steps" != "0" ] ||
47 usage
1 "invalid $1 step count (0 not allowed)"
50 usage
1 "invalid $1 step count (may not be empty string)"
53 usage
1 "invalid $1 step count (must be positive number)"
58 while [ $# -gt 0 ]; do case "$1" in
66 [ -z "$head_from" ] || usage
1 "-i and -w $aremutex"
70 [ -z "$steps" ] || usage
1 "-a and -n $aremutex"
74 [ -z "$all" ] || usage
1 "--count= and -a $aremutex"
75 docount
"--count=" "${1#--count=}"
78 [ -z "$all" ] || usage
1 "$1 and -a $aremutex"
79 [ $# -ge 2 ] || usage
1 "$1 requires an argument"
84 usage
1 "Unknown option: $1"
90 [ $# -ne 0 ] ||
set -- "HEAD"
91 [ $# -eq 1 ] || usage
1 "at most one branch name argument is allowed"
92 v_verify_topgit_branch name
"$1"
93 [ -z "$all" ] || steps
="-1"
94 [ -n "$steps" ] || steps
="1"
97 [ -z "$head_from" ] || v_get_tdopt tdopt
"$head_from"
100 if [ -n "$verbose" ]; then
102 verbcmd
='| awk "$script"'
104 eval navigate_deps
"$tdopt" "$oneopt" '-n -t -s="$steps" -- "$name"' "$verbcmd"