forked from mackyle/topgit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vastly improve the usability of the various commands' help usage output. Signed-off-by: Kyle J. McKay <[email protected]>
- Loading branch information
Showing
12 changed files
with
198 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,15 @@ | |
# TopGit - A different patch queue manager | ||
# (C) Petr Baudis <[email protected]> 2008 | ||
# (C) Per Cederqvist <[email protected]> 2010 | ||
# (C) Kyle J. McKay <[email protected]> 2017 | ||
# All rights reserved. | ||
# (C) Kyle J. McKay <[email protected]> 2017, 2021 | ||
# All rights reserved | ||
# GPLv2 | ||
|
||
USAGE="Usage: ${tgname:-tg} [...] base [--short[=n] | --no-short] [--] [branch...]" | ||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] base [--short[=<n>] | --no-short] [--] [branch...] | ||
Options: | ||
--short[=<n>] display shortened hashes (default) | ||
--no-short display full hashes" | ||
|
||
usage() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
#!/bin/sh | ||
# TopGit - A different patch queue manager | ||
# Copyright (C) 2013 Per Cederqvist <[email protected]> | ||
# Copyright (C) 2015,2017,2018 Kyle J. McKay <[email protected]> | ||
# All rights reserved. | ||
# Copyright (C) 2015,2017,2018,2021 Kyle J. McKay <[email protected]> | ||
# All rights reserved | ||
# GPLv2 | ||
|
||
## Parse options | ||
|
||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] checkout [--iow] [-f] [-b <branch>] (next | prev) [<steps>] | ||
Or: ${tgname:-tg} [...] checkout [--iow] [-f] (next | prev) -a | ||
Or: ${tgname:-tg} [...] checkout [--iow] [-f] [goto] [--] <pattern> | --series[=<head>]" | ||
Usage: ${tgname:-tg} [...] checkout [<opt>...] [-b <branch>] (next | prev) [<steps>] | ||
Or: ${tgname:-tg} [...] checkout [<opt>...] (next | prev) -a | ||
Or: ${tgname:-tg} [...] checkout [<opt>...] [goto] [--] <pattern> | --series[=<head>] | ||
Options: | ||
--iow pass '--ignore-other-worktrees' to git >= v2.5.0 | ||
--force / -f pass '--force' option to git | ||
--merge / -m pass '--merge' option to git | ||
--quiet / -q pass '--quiet' option to git | ||
--branch <branch> start at branch <branch> instead of HEAD | ||
-b <branch> alias for --branch <branch> | ||
--all / -a step as many times as possible" | ||
|
||
usage() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/sh | ||
# TopGit - A different patch queue manager | ||
# Copyright (C) 2008 Petr Baudis <[email protected]> | ||
# Copyright (C) 2015,2016,2017 Kyle J. McKay <[email protected]> | ||
# Copyright (C) 2015,2016,2017,2021 Kyle J. McKay <[email protected]> | ||
# All rights reserved | ||
# GPLv2 | ||
|
||
|
@@ -25,7 +25,25 @@ quiet= | |
branchtype=PATCH | ||
branchdesc=patch | ||
|
||
USAGE="Usage: ${tgname:-tg} [... -r remote] create [-q] [-m <msg> | -F <file>] [--topmsg <msg> | --topmsg-file <file>] [--no-edit] [--no-commit | --no-update] [--base] [<name> [<dep>...|-r [<rname>]] ]" | ||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] create [<option>...] [<name> [<dep>...]] | ||
Or: ${tgname:-tg} [...] create [<option>...] --base <name> [<committish>] | ||
Or: ${tgname:-tg} [-r <remote>] create [<option>...] <name> -r [<rbranch>] | ||
Options: | ||
--no-deps alternate spelling of '--base' | ||
--quiet / -q suppress most informational messages | ||
--message <msg> replace default commit message | ||
-m <msg> (default message is \"tg create <name>\") | ||
--file <file> replace default commit message | ||
-F <file> with contents of <file> | ||
--topmsg <msg> use <msg> as .topmsg and skip editor | ||
--tm <msg> (<msg> may be reformatted with a warning) | ||
--topmsg-file <f> use contents of file <f> as --topmsg | ||
--tF <file> alias for --topmsg-file <file> | ||
--force / -f ignore tag with same name as new branch | ||
--no-edit do not run the editor on default .topmsg | ||
--no-commit / -n stop before actually making the commit | ||
--no-update do not run 'tg update' (implied by -n)" | ||
|
||
usage() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
#!/bin/sh | ||
# TopGit - A different patch queue manager | ||
# (c) Petr Baudis <[email protected]> 2008 | ||
# Copyright (C) Petr Baudis <[email protected]> 2008 | ||
# Copyright (C) 2021 Kyle J. McKay <[email protected]> | ||
# All rights reserved | ||
# GPLv2 | ||
|
||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] files [-i | -w] [<name>] | ||
Options: | ||
-i use TopGit metadata from index instead of HEAD branch | ||
-w use metadata from working directory instead of branch" | ||
|
||
usage() | ||
{ | ||
if [ "${1:-0}" != 0 ]; then | ||
printf '%s\n' "$USAGE" >&2 | ||
else | ||
printf '%s\n' "$USAGE" | ||
fi | ||
exit ${1:-0} | ||
} | ||
|
||
name= | ||
head_from= | ||
|
||
|
||
## Parse options | ||
|
||
while [ -n "$1" ]; do | ||
arg="$1"; shift | ||
case "$arg" in | ||
-h|--help) | ||
usage;; | ||
-i|-w) | ||
[ -z "$head_from" ] || die "-i and -w are mutually exclusive" | ||
head_from="$arg";; | ||
-*) | ||
echo "Usage: ${tgname:-tg} [...] files [-i | -w] [<name>]" >&2 | ||
exit 1;; | ||
usage 1;; | ||
*) | ||
[ -z "$name" ] || die "name already specified ($name)" | ||
name="$arg";; | ||
esac | ||
done | ||
|
||
|
||
head="$(git symbolic-ref -q HEAD)" || : | ||
head="${head#refs/heads/}" | ||
|
||
|
@@ -44,6 +61,3 @@ v_pretty_tree b_tree -t "$name" -b | |
v_pretty_tree t_tree -t "$name" $head_from | ||
|
||
git diff-tree --name-only -r $b_tree $t_tree | ||
|
||
# vim:noet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
#!/bin/sh | ||
# TopGit - A different patch queue manager | ||
# Copyright (C) Petr Baudis <[email protected]> 2008 | ||
# Copyright (C) Kyle J. McKay <[email protected]> 2015, 2016, 2017, 2018 | ||
# Copyright (C) Kyle J. McKay <[email protected]> 2015, 2016, 2017, 2018, 2021 | ||
# GPLv2 | ||
|
||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] info [-i | -w] [--heads | --leaves | --series[=<head>]] [<name>] | ||
Or: ${tgname:-tg} [...] info [-i | -w] [--deps | --dependencies | --dependents] [<name>]" | ||
Or: ${tgname:-tg} [...] info [-i | -w] [--deps | --dependencies | --dependents] [<name>] | ||
Options: | ||
-i use TopGit metadata from index instead of HEAD branch | ||
-w use metadata from working directory instead of branch" | ||
|
||
usage() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
#!/bin/sh | ||
# TopGit revert command | ||
# Copyright (C) 2015 Kyle J. McKay <[email protected]> | ||
# All rights reserved. | ||
# Copyright (C) 2015,2021 Kyle J. McKay <[email protected]> | ||
# All rights reserved | ||
# GPLv2 | ||
|
||
USAGE="\ | ||
Usage: ${tgname:-tg} [...] revert (-f | -i | -n) [-q] [--tgish-only] [--no-deps] [--no-stash] [--exclude <ref>...] (<tagname> | --stash) [<ref>...] | ||
Or: ${tgname:-tg} [...] revert [-l] [--no-short] [--hash] [--tgish-only] [(--deps | --rdeps)] [--exclude <ref>...] (<tagname> | --stash) [(--[topgit-]heads] | <ref>...)]" | ||
Usage: ${tgname:-tg} [...] revert (-f | -i | -n) [<opt>...] (<tagname> | --stash) [<ref>...] | ||
Or: ${tgname:-tg} [...] revert [<opt>...] (<tagname> | --stash) [(--[topgit-]heads] | <ref>...)] | ||
Options: | ||
--quiet / -q suppress non-dry-run ref change messages | ||
--force / -f force revert operation to make changes | ||
--dry-run / -n show '-f' changes but don't actually make them | ||
--interactive / -i edit revert instruction sheet before proceeding | ||
--list / -l list mode (default if no -f, -n or -i present) | ||
--short[=<n>] display shortened hashes (default unless --hash) | ||
--no-short display full hashes (default for --hash-only) | ||
--hash-only show only hashes in list mode (aka '--hash') | ||
--no-stash skip preliminary stash before making changes | ||
--exclude <ref> exclude <ref> during operation (may be repeated) | ||
--tgish-only exclude non-TopGit branches (aka '--tgish') | ||
--no-deps do not include dependencies in revert mode | ||
--deps include dependencies in list mode | ||
--rdeps list relationships like 'tg summary --rdeps' | ||
--stash specifies a <tagname> of refs/tgstash | ||
--heads list only merge-base --independent heads | ||
--heads-independent alternate spelling of '--heads' | ||
--topgit-heads list only independent TopGit branch heads" | ||
|
||
usage() | ||
{ | ||
|
Oops, something went wrong.