git-review-workflow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.es.md +548 -0
- package/README.md +540 -0
- package/VERSION +1 -0
- package/bin/git-review +104 -0
- package/bin/git-review-lib.sh +121 -0
- package/bin/git-review-verbs/abort +101 -0
- package/bin/git-review-verbs/clean +123 -0
- package/bin/git-review-verbs/compare +159 -0
- package/bin/git-review-verbs/continue +178 -0
- package/bin/git-review-verbs/finish +494 -0
- package/bin/git-review-verbs/forget +289 -0
- package/bin/git-review-verbs/list +99 -0
- package/bin/git-review-verbs/next +46 -0
- package/bin/git-review-verbs/prev +45 -0
- package/bin/git-review-verbs/preview +195 -0
- package/bin/git-review-verbs/save +167 -0
- package/bin/git-review-verbs/start +333 -0
- package/bin/git-review-verbs/status +99 -0
- package/completions/git-review-workflow.bash +143 -0
- package/completions/git-review-workflow.fish +140 -0
- package/completions/git-review-workflow.zsh +153 -0
- package/package.json +39 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Bash completion for git-review-workflow.
|
|
2
|
+
#
|
|
3
|
+
# All commands live under the `git review <verb>` dispatcher, so a single
|
|
4
|
+
# `_git_review` completer drives them: it offers the verbs, then dispatches to a
|
|
5
|
+
# per-verb helper for that verb's options and arguments.
|
|
6
|
+
#
|
|
7
|
+
# Requires git's own bash completion to be loaded first (it provides the
|
|
8
|
+
# __gitcomp* / __git_* helpers and the $cur variable). Source this file after it:
|
|
9
|
+
#
|
|
10
|
+
# source /path/to/completions/git-review-workflow.bash
|
|
11
|
+
#
|
|
12
|
+
# zsh users: run `autoload -U +X bashcompinit && bashcompinit` first, then
|
|
13
|
+
# source this file.
|
|
14
|
+
|
|
15
|
+
# Source branches with a saved review (review-saved/*), for `continue` and
|
|
16
|
+
# `forget --saved`.
|
|
17
|
+
__grw_saved_branches() {
|
|
18
|
+
git for-each-ref --format='%(refname:short)' refs/heads/review-saved/ 2>/dev/null |
|
|
19
|
+
sed -n 's#^review-saved/##p'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# review/* branches with the prefix stripped, for `clean`.
|
|
23
|
+
__grw_review_branches() {
|
|
24
|
+
git for-each-ref --format='%(refname:short)' refs/heads/review/ 2>/dev/null |
|
|
25
|
+
sed -n 's#^review/##p'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Source branches that have a recorded --delta marker. These outlive the
|
|
29
|
+
# review/* branches, so they — not local heads — are what `forget --delta` acts on.
|
|
30
|
+
__grw_marked_branches() {
|
|
31
|
+
# Both marker sections, reviewworkflow.* (remote) and reviewworkflowlocal.*
|
|
32
|
+
# (--local). A branch reviewed both ways collapses to one entry via sort -u, so
|
|
33
|
+
# it is offered once by its plain name (`forget --delta <branch>` clears both).
|
|
34
|
+
{
|
|
35
|
+
git config --get-regexp '^reviewworkflow\..*\.reviewed$' 2>/dev/null
|
|
36
|
+
git config --get-regexp '^reviewworkflowlocal\..*\.reviewed$' 2>/dev/null
|
|
37
|
+
} | sed -n -e 's/^reviewworkflowlocal\.//' -e 's/^reviewworkflow\.//' \
|
|
38
|
+
-e 's/\.reviewed .*//p' | sort -u
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_git_review_start() {
|
|
42
|
+
case "$cur" in
|
|
43
|
+
--*)
|
|
44
|
+
__gitcomp "--base --delta --from --step --local --h"
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
__gitcomp_nl "$(__git_refs)"
|
|
48
|
+
;;
|
|
49
|
+
esac
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_git_review_compare() {
|
|
53
|
+
case "$cur" in
|
|
54
|
+
--*)
|
|
55
|
+
__gitcomp "--step --h"
|
|
56
|
+
;;
|
|
57
|
+
*)
|
|
58
|
+
__gitcomp_nl "$(__git_refs)"
|
|
59
|
+
;;
|
|
60
|
+
esac
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
_git_review_finish() {
|
|
64
|
+
__gitcomp "--onto-source --resume --abort --force --h"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_git_review_preview() {
|
|
68
|
+
__gitcomp "--stat --h"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_git_review_continue() {
|
|
72
|
+
case "$cur" in
|
|
73
|
+
--*)
|
|
74
|
+
__gitcomp "--h"
|
|
75
|
+
;;
|
|
76
|
+
*)
|
|
77
|
+
__gitcomp_nl "$(__grw_saved_branches)"
|
|
78
|
+
;;
|
|
79
|
+
esac
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_git_review_clean() {
|
|
83
|
+
case "$cur" in
|
|
84
|
+
--*)
|
|
85
|
+
__gitcomp "--h"
|
|
86
|
+
;;
|
|
87
|
+
*)
|
|
88
|
+
__gitcomp_nl "$(__grw_review_branches)"
|
|
89
|
+
;;
|
|
90
|
+
esac
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# forget has two modes: --delta (acts on the recorded markers) and --saved
|
|
94
|
+
# (acts on review-saved/* branches). Offer the relevant flags and candidates once a
|
|
95
|
+
# mode word is on the line; before that, just the two modes.
|
|
96
|
+
_git_review_forget() {
|
|
97
|
+
case " ${COMP_WORDS[*]} " in
|
|
98
|
+
*" --saved "*)
|
|
99
|
+
case "$cur" in
|
|
100
|
+
--*) __gitcomp "--all --dry-run --h" ;;
|
|
101
|
+
*) __gitcomp_nl "$(__grw_saved_branches)" ;;
|
|
102
|
+
esac
|
|
103
|
+
;;
|
|
104
|
+
*" --delta "*)
|
|
105
|
+
case "$cur" in
|
|
106
|
+
--*) __gitcomp "--all --stale --dry-run --h" ;;
|
|
107
|
+
*) __gitcomp_nl "$(__grw_marked_branches)" ;;
|
|
108
|
+
esac
|
|
109
|
+
;;
|
|
110
|
+
*)
|
|
111
|
+
__gitcomp "--delta --saved --h"
|
|
112
|
+
;;
|
|
113
|
+
esac
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
# Entry point: git's bash completion calls this for `git review ...`. Find the
|
|
117
|
+
# verb already on the line; if none yet, complete the verb list (or the
|
|
118
|
+
# dispatcher's own -h/--version). Otherwise dispatch to the verb's helper —
|
|
119
|
+
# verbs with no options beyond --h fall through to the default.
|
|
120
|
+
_git_review() {
|
|
121
|
+
local subcommands="start compare next prev status list preview finish save continue abort clean forget"
|
|
122
|
+
local subcommand
|
|
123
|
+
subcommand="$(__git_find_on_cmdline "$subcommands")"
|
|
124
|
+
|
|
125
|
+
if [ -z "$subcommand" ]; then
|
|
126
|
+
case "$cur" in
|
|
127
|
+
-*) __gitcomp "--h --version" ;;
|
|
128
|
+
*) __gitcomp "$subcommands" ;;
|
|
129
|
+
esac
|
|
130
|
+
return
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
case "$subcommand" in
|
|
134
|
+
start) _git_review_start ;;
|
|
135
|
+
compare) _git_review_compare ;;
|
|
136
|
+
finish) _git_review_finish ;;
|
|
137
|
+
preview) _git_review_preview ;;
|
|
138
|
+
continue) _git_review_continue ;;
|
|
139
|
+
clean) _git_review_clean ;;
|
|
140
|
+
forget) _git_review_forget ;;
|
|
141
|
+
*) __gitcomp "--h" ;;
|
|
142
|
+
esac
|
|
143
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Fish completion for git-review-workflow.
|
|
2
|
+
#
|
|
3
|
+
# Every command lives under the `git review <verb>` dispatcher, so these
|
|
4
|
+
# completions offer the verbs after `git review`, then each verb's own options
|
|
5
|
+
# and arguments.
|
|
6
|
+
#
|
|
7
|
+
# Install by copying (or symlinking) this file into your fish completions dir:
|
|
8
|
+
#
|
|
9
|
+
# ln -s /path/to/git-review-workflow/completions/git-review-workflow.fish \
|
|
10
|
+
# ~/.config/fish/completions/
|
|
11
|
+
|
|
12
|
+
# Echo the git-review verb on the command line (the first non-option token after
|
|
13
|
+
# `review`), or fail with no output if none has been typed yet.
|
|
14
|
+
function __grw_review_verb
|
|
15
|
+
set -l tokens (commandline -opc)
|
|
16
|
+
test (count $tokens) -ge 2; and test $tokens[1] = git; and test $tokens[2] = review
|
|
17
|
+
or return 1
|
|
18
|
+
for t in $tokens[3..-1]
|
|
19
|
+
switch $t
|
|
20
|
+
case '-*'
|
|
21
|
+
continue
|
|
22
|
+
case '*'
|
|
23
|
+
echo $t
|
|
24
|
+
return 0
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
return 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# True on `git review` before any verb is chosen — when to offer the verb list.
|
|
31
|
+
function __grw_review_bare
|
|
32
|
+
not __grw_review_verb >/dev/null 2>&1
|
|
33
|
+
and begin
|
|
34
|
+
set -l tokens (commandline -opc)
|
|
35
|
+
test (count $tokens) -ge 2; and test $tokens[1] = git; and test $tokens[2] = review
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# True when the chosen verb equals $verb.
|
|
40
|
+
function __grw_review_using -a verb
|
|
41
|
+
test (__grw_review_verb 2>/dev/null) = $verb
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Local + remote branch names, for branch/commit-ish arguments.
|
|
45
|
+
function __grw_branches
|
|
46
|
+
git for-each-ref --format='%(refname:short)' refs/heads refs/remotes 2>/dev/null
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# review/* branches with the prefix stripped, for clean.
|
|
50
|
+
function __grw_review_branches
|
|
51
|
+
git for-each-ref --format='%(refname:short)' refs/heads/review/ 2>/dev/null \
|
|
52
|
+
| string replace -r '^review/' ''
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Source branches that have a recorded --delta marker, for forget --delta. The
|
|
56
|
+
# markers outlive the review/* branches, so this is the right candidate set.
|
|
57
|
+
function __grw_marked_branches
|
|
58
|
+
# Both marker sections, reviewworkflow.* (remote) and reviewworkflowlocal.*
|
|
59
|
+
# (--local). A branch reviewed both ways collapses to one entry via sort -u, so
|
|
60
|
+
# it shows once by its plain name (forget --delta <branch> clears both).
|
|
61
|
+
begin
|
|
62
|
+
git config --get-regexp '^reviewworkflow\..*\.reviewed$' 2>/dev/null
|
|
63
|
+
git config --get-regexp '^reviewworkflowlocal\..*\.reviewed$' 2>/dev/null
|
|
64
|
+
end \
|
|
65
|
+
| string replace -r '^reviewworkflow(local)?\.(.*)\.reviewed .*$' '$2' \
|
|
66
|
+
| sort -u
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Source branches with a saved review (review-saved/*), for continue and
|
|
70
|
+
# forget --saved.
|
|
71
|
+
function __grw_saved_branches
|
|
72
|
+
git for-each-ref --format='%(refname:short)' refs/heads/review-saved/ 2>/dev/null \
|
|
73
|
+
| string replace -r '^review-saved/' ''
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# ── git review (no verb yet): dispatcher flags + the verb list ────────────────
|
|
77
|
+
complete -c git -n '__grw_review_bare' -f -l h -d 'list all available commands'
|
|
78
|
+
complete -c git -n '__grw_review_bare' -f -s V -l version -d 'print the installed version'
|
|
79
|
+
complete -c git -n '__grw_review_bare' -f -a start -d 'stage a PR diff on a new review/<branch> branch'
|
|
80
|
+
complete -c git -n '__grw_review_bare' -f -a compare -d 'stage the diff between two commit-ish, read-only'
|
|
81
|
+
complete -c git -n '__grw_review_bare' -f -a next -d 'advance a commit-by-commit review to the next commit'
|
|
82
|
+
complete -c git -n '__grw_review_bare' -f -a prev -d 'step a commit-by-commit review back to the previous commit'
|
|
83
|
+
complete -c git -n '__grw_review_bare' -f -a status -d 'show the state of the review on the current branch'
|
|
84
|
+
complete -c git -n '__grw_review_bare' -f -a list -d 'list every review/* branch in progress'
|
|
85
|
+
complete -c git -n '__grw_review_bare' -f -a preview -d 'show your edits so far without committing or switching'
|
|
86
|
+
complete -c git -n '__grw_review_bare' -f -a finish -d 'extract your edits onto review-fixes/<branch>'
|
|
87
|
+
complete -c git -n '__grw_review_bare' -f -a save -d 'pause the current review and return to where you started'
|
|
88
|
+
complete -c git -n '__grw_review_bare' -f -a continue -d 'resume a review paused with git review save'
|
|
89
|
+
complete -c git -n '__grw_review_bare' -f -a abort -d 'cancel the current review and return to where you started'
|
|
90
|
+
complete -c git -n '__grw_review_bare' -f -a clean -d 'delete review/* and review-fixes/* branches'
|
|
91
|
+
complete -c git -n '__grw_review_bare' -f -a forget -d "discard a review's persistent state (delta markers or a saved review)"
|
|
92
|
+
|
|
93
|
+
# ── git review start ──────────────────────────────────────────────────────────
|
|
94
|
+
complete -c git -n '__grw_review_using start' -f -r -l base -d 'base to diff against when the branch is omitted'
|
|
95
|
+
complete -c git -n '__grw_review_using start' -f -l delta -d 'review only commits since your last review'
|
|
96
|
+
complete -c git -n '__grw_review_using start' -f -l from -d 'review only commits after <commit>'
|
|
97
|
+
complete -c git -n '__grw_review_using start' -f -l step -d 'review one commit at a time'
|
|
98
|
+
complete -c git -n '__grw_review_using start' -f -l local -d 'review your local branches directly, without fetching'
|
|
99
|
+
complete -c git -n '__grw_review_using start' -f -l h -d 'show help'
|
|
100
|
+
complete -c git -n '__grw_review_using start' -f -a '(__grw_branches)'
|
|
101
|
+
|
|
102
|
+
# ── git review compare ────────────────────────────────────────────────────────
|
|
103
|
+
complete -c git -n '__grw_review_using compare' -f -l step -d 'review one commit at a time'
|
|
104
|
+
complete -c git -n '__grw_review_using compare' -f -l h -d 'show help'
|
|
105
|
+
complete -c git -n '__grw_review_using compare' -f -a '(__grw_branches)'
|
|
106
|
+
|
|
107
|
+
# ── git review finish ─────────────────────────────────────────────────────────
|
|
108
|
+
complete -c git -n '__grw_review_using finish' -f -l onto-source -d 'stage edits on the PR branch itself'
|
|
109
|
+
complete -c git -n '__grw_review_using finish' -f -l resume -d 'continue after resolving replay conflicts'
|
|
110
|
+
complete -c git -n '__grw_review_using finish' -f -l abort -d 'undo the last finish and return to editing'
|
|
111
|
+
complete -c git -n '__grw_review_using finish' -f -l force -d 'with --abort, discard changes made to the finish branch'
|
|
112
|
+
complete -c git -n '__grw_review_using finish' -f -l h -d 'show help'
|
|
113
|
+
|
|
114
|
+
# ── git review preview ────────────────────────────────────────────────────────
|
|
115
|
+
complete -c git -n '__grw_review_using preview' -f -l stat -d 'show a diffstat summary instead of the full diff'
|
|
116
|
+
complete -c git -n '__grw_review_using preview' -f -l h -d 'show help'
|
|
117
|
+
|
|
118
|
+
# ── git review continue ───────────────────────────────────────────────────────
|
|
119
|
+
complete -c git -n '__grw_review_using continue' -f -l h -d 'show help'
|
|
120
|
+
complete -c git -n '__grw_review_using continue' -f -a '(__grw_saved_branches)'
|
|
121
|
+
|
|
122
|
+
# ── git review clean ──────────────────────────────────────────────────────────
|
|
123
|
+
complete -c git -n '__grw_review_using clean' -f -l h -d 'show help'
|
|
124
|
+
complete -c git -n '__grw_review_using clean' -f -a '(__grw_review_branches)'
|
|
125
|
+
|
|
126
|
+
# ── git review forget (--delta acts on markers, --saved on review-saved/*) ─────
|
|
127
|
+
complete -c git -n '__grw_review_using forget' -f -l delta -d 'forget the --delta markers recorded by git review start'
|
|
128
|
+
complete -c git -n '__grw_review_using forget' -f -l saved -d 'discard a review paused with git review save'
|
|
129
|
+
complete -c git -n '__grw_review_using forget' -f -l all -d 'every marker (--delta) or every saved review (--saved)'
|
|
130
|
+
complete -c git -n '__grw_review_using forget' -f -l stale -d 'with --delta, forget markers whose branch is gone'
|
|
131
|
+
complete -c git -n '__grw_review_using forget' -f -l dry-run -d 'list what would be forgotten without forgetting it'
|
|
132
|
+
complete -c git -n '__grw_review_using forget' -f -l h -d 'show help'
|
|
133
|
+
# Offer saved branches once --saved is on the line, marked branches otherwise.
|
|
134
|
+
complete -c git -n '__grw_review_using forget; and __fish_contains_opt saved' -f -a '(__grw_saved_branches)'
|
|
135
|
+
complete -c git -n '__grw_review_using forget; and not __fish_contains_opt saved' -f -a '(__grw_marked_branches)'
|
|
136
|
+
|
|
137
|
+
# ── Verbs that take no arguments beyond --h ───────────────────────────────────
|
|
138
|
+
for verb in next prev status list abort save
|
|
139
|
+
complete -c git -n "__grw_review_using $verb" -f -l h -d 'show help'
|
|
140
|
+
end
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#compdef -value-,GIT_REVIEW_WORKFLOW,-default-
|
|
2
|
+
#
|
|
3
|
+
# Native zsh completion for git-review-workflow.
|
|
4
|
+
#
|
|
5
|
+
# Every command lives under the `git review <verb>` dispatcher, so zsh's git
|
|
6
|
+
# completion only ever dispatches `git review` to `_git-review`; this file makes
|
|
7
|
+
# that one function offer the verbs and then complete each verb's own options and
|
|
8
|
+
# arguments (the `git bisect` idiom).
|
|
9
|
+
#
|
|
10
|
+
# Install: put this file on your $fpath (or source it after compinit), e.g.
|
|
11
|
+
#
|
|
12
|
+
# fpath=(/path/to/git-review-workflow/completions $fpath)
|
|
13
|
+
# autoload -Uz compinit && compinit
|
|
14
|
+
#
|
|
15
|
+
# or simply:
|
|
16
|
+
#
|
|
17
|
+
# source /path/to/git-review-workflow/completions/git-review-workflow.zsh
|
|
18
|
+
|
|
19
|
+
# Helpers per verb. Named with underscores (not `_git-review-<verb>`) so zsh's
|
|
20
|
+
# git dispatcher never mistakes one for the completer of a `git review-<verb>`
|
|
21
|
+
# subcommand — there is no such subcommand any more.
|
|
22
|
+
|
|
23
|
+
_git_review_start() {
|
|
24
|
+
_arguments -S \
|
|
25
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
26
|
+
'--base[base to diff against when the branch is omitted]:base:__git_revisions' \
|
|
27
|
+
'(--from)--delta[review only the commits added since your last review]' \
|
|
28
|
+
'(--delta)--from[review only the commits after <commit>]:commit:__git_commits' \
|
|
29
|
+
'--step[review one commit at a time]' \
|
|
30
|
+
'--local[review your local branches directly, without fetching]' \
|
|
31
|
+
'*: :__git_revisions'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_git_review_compare() {
|
|
35
|
+
_arguments -S \
|
|
36
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
37
|
+
'--step[review one commit at a time]' \
|
|
38
|
+
'*:commit-ish:__git_revisions'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_git_review_finish() {
|
|
42
|
+
_arguments -S \
|
|
43
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
44
|
+
'--onto-source[stage your edits on the PR branch itself]' \
|
|
45
|
+
'--resume[continue after resolving replay conflicts]' \
|
|
46
|
+
'--abort[undo the last finish and return to editing]' \
|
|
47
|
+
'--force[with --abort, discard changes made to the finish branch]'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_git_review_preview() {
|
|
51
|
+
_arguments -S \
|
|
52
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
53
|
+
'--stat[show a diffstat summary instead of the full diff]'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_git_review_continue() {
|
|
57
|
+
local state
|
|
58
|
+
_arguments -S \
|
|
59
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
60
|
+
'*: :->savedbranches'
|
|
61
|
+
|
|
62
|
+
if [ "$state" = savedbranches ]; then
|
|
63
|
+
local -a names
|
|
64
|
+
names=(${(f)"$(git for-each-ref --format='%(refname:short)' refs/heads/review-saved/ 2>/dev/null | sed 's#^review-saved/##')"})
|
|
65
|
+
_describe 'saved review' names
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_git_review_clean() {
|
|
70
|
+
local state
|
|
71
|
+
_arguments -S \
|
|
72
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
73
|
+
'*: :->reviewbranches'
|
|
74
|
+
|
|
75
|
+
if [ "$state" = reviewbranches ]; then
|
|
76
|
+
local -a names
|
|
77
|
+
names=(${(f)"$(git for-each-ref --format='%(refname:short)' refs/heads/review/ 2>/dev/null | sed 's#^review/##')"})
|
|
78
|
+
_describe 'review branch' names
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_git_review_forget() {
|
|
83
|
+
local state
|
|
84
|
+
_arguments -S \
|
|
85
|
+
'(-h --h)'{-h,--h}'[show help]' \
|
|
86
|
+
'(--saved)--delta[forget the --delta markers recorded by git review start]' \
|
|
87
|
+
'(--delta)--stale[(--delta) forget markers whose branch no longer exists]' \
|
|
88
|
+
'(--delta --saved)--saved[discard a review paused with git review save]' \
|
|
89
|
+
'--all[every marker (--delta) or every saved review (--saved)]' \
|
|
90
|
+
'--dry-run[list what would be forgotten without forgetting it]' \
|
|
91
|
+
'*: :->forgetbranches'
|
|
92
|
+
|
|
93
|
+
# With --saved, complete from review-saved/* branches; otherwise from the
|
|
94
|
+
# recorded --delta markers (which outlive the review/* branches).
|
|
95
|
+
if [ "$state" = forgetbranches ]; then
|
|
96
|
+
local -a names
|
|
97
|
+
if (( ${words[(I)--saved]} )); then
|
|
98
|
+
names=(${(f)"$(git for-each-ref --format='%(refname:short)' refs/heads/review-saved/ 2>/dev/null | sed 's#^review-saved/##')"})
|
|
99
|
+
_describe 'saved review' names
|
|
100
|
+
else
|
|
101
|
+
names=(${(f)"$({ git config --get-regexp '^reviewworkflow\..*\.reviewed$' 2>/dev/null; git config --get-regexp '^reviewworkflowlocal\..*\.reviewed$' 2>/dev/null; } | sed -n -e 's/^reviewworkflowlocal\.//' -e 's/^reviewworkflow\.//' -e 's/\.reviewed .*//p' | sort -u)"})
|
|
102
|
+
_describe 'marked branch' names
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
_git-review() {
|
|
108
|
+
local curcontext="$curcontext" state line
|
|
109
|
+
typeset -A opt_args
|
|
110
|
+
|
|
111
|
+
_arguments -C \
|
|
112
|
+
'(-h --h)'{-h,--h}'[list all available commands]' \
|
|
113
|
+
'(-V --version)'{-V,--version}'[print the installed version]' \
|
|
114
|
+
': :->verb' \
|
|
115
|
+
'*:: :->args'
|
|
116
|
+
|
|
117
|
+
case "$state" in
|
|
118
|
+
verb)
|
|
119
|
+
local -a verbs
|
|
120
|
+
verbs=(
|
|
121
|
+
'start:stage a PR diff on a new review/<branch> branch'
|
|
122
|
+
'compare:stage the diff between two commit-ish, read-only'
|
|
123
|
+
'next:advance a commit-by-commit review to the next commit'
|
|
124
|
+
'prev:step a commit-by-commit review back to the previous commit'
|
|
125
|
+
'status:show the state of the review on the current branch'
|
|
126
|
+
'list:list every review/* branch in progress'
|
|
127
|
+
'preview:show your edits so far without committing or switching'
|
|
128
|
+
'finish:extract your edits onto review-fixes/<branch>'
|
|
129
|
+
'save:pause the current review and return to where you started'
|
|
130
|
+
'continue:resume a review paused with git review save'
|
|
131
|
+
'abort:cancel the current review and return to where you started'
|
|
132
|
+
'clean:delete review/* and review-fixes/* branches'
|
|
133
|
+
'forget:discard a review'\''s persistent state (delta markers or a saved review)'
|
|
134
|
+
)
|
|
135
|
+
_describe -t verbs 'git review verb' verbs
|
|
136
|
+
;;
|
|
137
|
+
args)
|
|
138
|
+
curcontext="${curcontext%:*:*}:git-review-$line[1]:"
|
|
139
|
+
case "$line[1]" in
|
|
140
|
+
start) _git_review_start ;;
|
|
141
|
+
compare) _git_review_compare ;;
|
|
142
|
+
finish) _git_review_finish ;;
|
|
143
|
+
preview) _git_review_preview ;;
|
|
144
|
+
continue) _git_review_continue ;;
|
|
145
|
+
clean) _git_review_clean ;;
|
|
146
|
+
forget) _git_review_forget ;;
|
|
147
|
+
next|prev|status|list|save|abort)
|
|
148
|
+
_arguments '(-h --h)'{-h,--h}'[show help]'
|
|
149
|
+
;;
|
|
150
|
+
esac
|
|
151
|
+
;;
|
|
152
|
+
esac
|
|
153
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-review-workflow",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Git commands to review a pull request branch locally as one staged diff",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"git",
|
|
7
|
+
"git-subcommand",
|
|
8
|
+
"review",
|
|
9
|
+
"code-review",
|
|
10
|
+
"pull-request",
|
|
11
|
+
"pr",
|
|
12
|
+
"cli",
|
|
13
|
+
"workflow"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/EzeVillo/git-review-workflow#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/EzeVillo/git-review-workflow/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "EzeVillo <ezevillodev@gmail.com>",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/EzeVillo/git-review-workflow.git"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"git-review": "bin/git-review"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin/",
|
|
30
|
+
"completions/",
|
|
31
|
+
"VERSION",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"provenance": true
|
|
38
|
+
}
|
|
39
|
+
}
|