Mercurial > hg-stable
changeset 3587:c8494fcc9d39
zsh: tab-complete status results by directory
Filter diff and revert for modified files only, unless -r is given.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 30 Oct 2006 00:03:04 -0800 |
parents | 66a17364c30e |
children | 45574a225632 |
files | contrib/zsh_completion |
diffstat | 1 files changed, 33 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/zsh_completion Sun Oct 29 16:33:46 2006 +0100 +++ b/contrib/zsh_completion Mon Oct 30 00:03:04 2006 -0800 @@ -140,13 +140,19 @@ _hg_unknown() { typeset -a status_files _hg_status u - (( $#status_files )) && _describe -t files 'unknown files' status_files + _wanted files expl 'unknown files' _multi_parts / status_files } _hg_missing() { typeset -a status_files _hg_status d - (( $#status_files )) && _describe -t files 'missing files' status_files + _wanted files expl 'missing files' _multi_parts / status_files +} + +_hg_modified() { + typeset -a status_files + _hg_status m + _wanted files expl 'modified files' _multi_parts / status_files } _hg_addremove() { @@ -303,13 +309,24 @@ } _hg_cmd_diff() { + typeset -A opt_args _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ - '*:file:_files -W $(_hg_cmd root)' + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _files -W $(_hg_cmd root) + else + _hg_modified + fi + fi } _hg_cmd_export() { @@ -448,7 +465,19 @@ '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ '--no-backup[do not save backup copies of files]' \ - '*:file:_files -W $(_hg_cmd root)' + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _files -W $(_hg_cmd root) + else + typeset -a status_files + _hg_status mard + _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files + fi + fi } _hg_cmd_serve() {