X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fsite-functions%2F_hg;h=f4f3b583596621be4015ff4e5ccd4528aaafecaa;hb=538b20715841b392eb9b8f7a410546e78de57afa;hp=bca462ea0fdcbc571f37b9e17232a11dad29c8bc;hpb=7cb3be14606f3e2f2e7d01adbf2cf64db4176606;p=grml-etc-core.git diff --git a/etc/zsh/site-functions/_hg b/etc/zsh/site-functions/_hg index bca462e..f4f3b58 100644 --- a/etc/zsh/site-functions/_hg +++ b/etc/zsh/site-functions/_hg @@ -14,7 +14,18 @@ local curcontext="$curcontext" state line typeset -A opt_args -local subcmds repos tags newFiles addedFiles includeExclude +local subcmds repos tags newFiles addedFiles includeExclude commitMessage + +_mq_state () { + case "$state" in + (qapplied) + compadd $(hg qapplied) + ;; + (qunapplied) + compadd $(hg qunapplied) + ;; + esac +} tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ @@ -27,6 +38,14 @@ includeExclude=( '*-X-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/' '*--exclude-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/') +commitMessage=( + '(-m --message -l --logfile --edit)-e[edit commit message]' + '(-m --message -l --logfile -e)--edit[edit commit message]' + '(-e --edit -l --logfile --message)-m[use as commit message]:message:' + '(-e --edit -l --logfile -m)--message[use as commit message]:message:' + '(-e --edit -m --message --logfile)-l[read the commit message from ]:log file:_files' + '(-e --edit -m --message -l)--logfile[read the commit message from ]:log file:_files') + if [[ $service == "hg" ]]; then _arguments -C -A "-*" \ '(--repository)-R[repository root directory]:root:_files -/' \ @@ -419,6 +438,43 @@ case $service in # no arguments for these commands ;; + # MQ commands + (qdel*|qrm|qrem*) + _arguments \ + {-k,--keep}'[keep patch file]' \ + {-r,--rev}'[revision]:applied patch:->qapplied' \ + '*:unapplied patches:->qunapplied' + _mq_state + ;; + + (qnew) + _arguments $commitMessage \ + {-f,--force}'[import uncommitted changes into patch]' \ + ':patch name:' + ;; + + (qpo*) + applied=( $(hg qapplied) ) + _arguments \ + (1){-a,--all}'[pop all patches]' \ + {-f,--force}'[forget any local changes]' \ + ':applied patch:->qapplied' + _mq_state + ;; + + (qpu*) + _arguments \ + (1){-a,--all}'[apply all patches]' \ + {-f,--force}'[apply if the patch has rejects]' \ + ':unapplied patch:->qunapplied' + _mq_state + ;; + (qref*) + _arguments $commitMessage $includeExclude \ + {-g,--git}'[use git extended diff format]' \ + {-s,--short}'[short refresh]' + ;; + (*) _message "unknown hg command completion: $service" ;;