Skip to content

Commit f4cb8ab

Browse files
jomakazmeta-codesync[bot]
authored andcommitted
Add zsh completions for sl unshelve
Summary: Adding zsh completion to `unshelve` command. With this change, when typing and pressing: `sl unshelve <tab>` or `sl unshelve --name <tab>` it prints available shelved names. Without this change, currently it prints the local file names. Differential Revision: D99759568 fbshipit-source-id: ce29679bf8d0ba9ad34a54c2b8b8d6f53044c619
1 parent 395686a commit f4cb8ab

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

eden/scm/contrib/zsh_completion

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,19 @@ _hg_branches() {
191191
(( $#branches )) && _describe -t branches 'branches' branches
192192
}
193193

194+
_hg_shelves() {
195+
typeset -a shelves
196+
local line shelf
197+
198+
_hg_cmd shelve --list | while IFS= read -r line
199+
do
200+
shelf=${line%%[[:space:]]##\(*}
201+
shelf=${shelf%%[[:space:]]#}
202+
[[ -n "$shelf" ]] && shelves+=("$shelf")
203+
done
204+
(( $#shelves )) && _describe -t hg-shelves 'shelved changes' shelves
205+
}
206+
194207
# likely merge candidates
195208
_hg_mergerevs() {
196209
typeset -a heads
@@ -454,7 +467,7 @@ _hg_subrepos_opts=(
454467
'(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]')
455468

456469
_hg_cmd() {
457-
_call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
470+
_call_program hg HGPLAIN=1 "${words[1]:-hg}" "$_hg_cmd_globals[@]" "$@" 2> /dev/null
458471
}
459472

460473
_hg_cmd_add() {
@@ -958,6 +971,15 @@ _hg_cmd_unhide() {
958971
':revision:_hg_labels'
959972
}
960973

974+
_hg_cmd_unshelve() {
975+
_arguments -s -w : $_hg_global_opts $_hg_mergetool_opts \
976+
'(-c --continue -k --keep -n --name)'{-a,--abort}'[abort an incomplete unshelve operation]' \
977+
'(-a --abort -k --keep -n --name)'{-c,--continue}'[continue an incomplete unshelve operation]' \
978+
'(-a --abort -c --continue)'{-k,--keep}'[keep shelve after unshelving]' \
979+
'(-a --abort -c --continue)'{-n+,--name=}'[restore shelved change with given name]:shelved change:_hg_shelves' \
980+
'(-a --abort -c --continue -n --name):shelved change:_hg_shelves'
981+
}
982+
961983
## extensions ##
962984

963985
# HGK

0 commit comments

Comments
 (0)