Mercurial > hg
comparison contrib/zsh_completion @ 8980:6d5dca8737b9
zsh completion: include guarded patches in qdelete
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Tue, 30 Jun 2009 14:31:16 -0700 |
parents | c963d49ac7a1 |
children | 9c0cecb71350 |
comparison
equal
deleted
inserted
replaced
8963:a4ceae3aa7be | 8980:6d5dca8737b9 |
---|---|
12 # fpath=("$HOME/.zsh.d" $fpath) | 12 # fpath=("$HOME/.zsh.d" $fpath) |
13 # autoload -U compinit | 13 # autoload -U compinit |
14 # compinit | 14 # compinit |
15 # | 15 # |
16 # Copyright (C) 2005, 2006 Steve Borho <steve@borho.org> | 16 # Copyright (C) 2005, 2006 Steve Borho <steve@borho.org> |
17 # Copyright (C) 2006, 2007, 2008 Brendan Cully <brendan@kublai.com> | 17 # Copyright (C) 2006-9 Brendan Cully <brendan@kublai.com> |
18 # | 18 # |
19 # Permission is hereby granted, without written agreement and without | 19 # Permission is hereby granted, without written agreement and without |
20 # licence or royalty fees, to use, copy, modify, and distribute this | 20 # licence or royalty fees, to use, copy, modify, and distribute this |
21 # software and to distribute modified versions of this software for any | 21 # software and to distribute modified versions of this software for any |
22 # purpose, provided that the above copyright notice and the following | 22 # purpose, provided that the above copyright notice and the following |
752 typeset -a patches | 752 typeset -a patches |
753 patches=(${(f)"$(_hg_cmd qunapplied 2>/dev/null)"}) | 753 patches=(${(f)"$(_hg_cmd qunapplied 2>/dev/null)"}) |
754 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches | 754 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches |
755 } | 755 } |
756 | 756 |
757 # unapplied, including guarded patches | |
758 _hg_qdeletable() { | |
759 typeset -a unapplied | |
760 unapplied=(${(f)"$(_hg_cmd qseries 2>/dev/null)"}) | |
761 for p in $(_hg_cmd qapplied 2>/dev/null) | |
762 do | |
763 unapplied=(${unapplied:#$p}) | |
764 done | |
765 | |
766 (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied | |
767 } | |
768 | |
757 _hg_qguards() { | 769 _hg_qguards() { |
758 typeset -a guards | 770 typeset -a guards |
759 local guard | 771 local guard |
760 compset -P "+|-" | 772 compset -P "+|-" |
761 _hg_cmd qselect -s 2>/dev/null | while read guard | 773 _hg_cmd qselect -s 2>/dev/null | while read guard |
774 | 786 |
775 _hg_cmd_qdelete() { | 787 _hg_cmd_qdelete() { |
776 _arguments -s -w : $_hg_global_opts \ | 788 _arguments -s -w : $_hg_global_opts \ |
777 '(--keep -k)'{-k,--keep}'[keep patch file]' \ | 789 '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
778 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ | 790 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ |
779 '*:unapplied patch:_hg_qunapplied' | 791 '*:unapplied patch:_hg_qdeletable' |
780 } | 792 } |
781 | 793 |
782 _hg_cmd_qdiff() { | 794 _hg_cmd_qdiff() { |
783 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | 795 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
784 '*:pattern:_hg_files' | 796 '*:pattern:_hg_files' |