##// END OF EJS Templates
Do not use 'self' in the purge() method...
Do not use 'self' in the purge() method Avoid any reference to 'self' in Purge.purge() to allow its refactoring in a simple function.

File last commit:

r3878:729f354f default
r4152:1c0488b5 default
Show More
zsh_completion
789 lines | 23.3 KiB | text/plain | TextLexer
Steve Borho
zsh completion function for hg
r1362 #compdef hg
# Zsh completion script for mercurial. Rename this file to _hg and copy
# it into your zsh function path (/usr/share/zsh/site-functions for
# instance)
#
# Copyright (C) 2005 Steve Borho
Brendan Cully
zsh: use standard tags where possible
r3548 # Copyright (C) 2006 Brendan Cully <brendan@kublai.com>
Steve Borho
zsh completion function for hg
r1362 #
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
local curcontext="$curcontext" state line
Brendan Cully
zsh: rewrite...
r3537 typeset -A _hg_cmd_globals
_hg() {
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 local cmd _hg_root
Brendan Cully
zsh: rewrite...
r3537 integer i=2
_hg_cmd_globals=()
while (( i < $#words ))
do
case "$words[$i]" in
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 -R|--repository)
Brendan Cully
zsh: perform ~ expansion on _hg_root
r3605 eval _hg_root="$words[$i+1]"
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 _hg_cmd_globals+=("$words[$i]" "$_hg_root")
Brendan Cully
zsh: rewrite...
r3537 (( i += 2 ))
continue
;;
-R*)
_hg_cmd_globals+="$words[$i]"
Brendan Cully
zsh: perform ~ expansion on _hg_root
r3605 eval _hg_root="${words[$i]#-R}"
Brendan Cully
zsh: rewrite...
r3537 (( i++ ))
continue
;;
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 --cwd|--config)
# pass along arguments to hg completer
_hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
(( i += 2 ))
continue
;;
Brendan Cully
zsh: rewrite...
r3537 -*)
# skip option
(( i++ ))
continue
;;
esac
if [[ -z "$cmd" ]]
then
cmd="$words[$i]"
words[$i]=()
(( CURRENT-- ))
fi
(( i++ ))
done
if [[ -z "$cmd" ]]
then
_arguments -s -w : $_hg_global_opts \
':mercurial command:_hg_commands'
return
fi
# resolve abbreviations and aliases
if ! (( $+functions[_hg_cmd_${cmd}] ))
then
local cmdexp
(( $#_hg_cmd_list )) || _hg_get_commands
cmdexp=$_hg_cmd_list[(r)${cmd}*]
if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
then
# might be nice to rewrite the command line with the expansion
cmd="$cmdexp"
fi
if [[ -n $_hg_alias_list[$cmd] ]]
then
cmd=$_hg_alias_list[$cmd]
fi
fi
Brendan Cully
zsh: add optional remote directory cache
r3600 curcontext="${curcontext%:*:*}:hg-${cmd}:"
zstyle -s ":completion:$curcontext:" cache-policy update_policy
if [[ -z "$update_policy" ]]
then
zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
fi
Brendan Cully
zsh: rewrite...
r3537 if (( $+functions[_hg_cmd_${cmd}] ))
then
_hg_cmd_${cmd}
Brendan Cully
zsh: complete unknown commands normally
r3597 else
# complete unknown commands normally
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:files:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 fi
}
Brendan Cully
zsh: complete according to the -R option if specified
r3497
Brendan Cully
zsh: add optional remote directory cache
r3600 _hg_cache_policy() {
typeset -a old
# cache for a minute
old=( "$1"(mm+10) )
(( $#old )) && return 0
return 1
}
Brendan Cully
zsh: rewrite...
r3537 _hg_get_commands() {
typeset -ga _hg_cmd_list
typeset -gA _hg_alias_list
local hline cmd cmdalias
_call_program help hg --verbose help | while read -A hline
do
cmd="$hline[1]"
case $cmd in
*:)
cmd=${cmd%:}
_hg_cmd_list+=($cmd)
;;
*,)
cmd=${cmd%,}
_hg_cmd_list+=($cmd)
integer i=2
while (( i <= $#hline ))
do
cmdalias=${hline[$i]%(:|,)}
_hg_cmd_list+=($cmdalias)
_hg_alias_list+=($cmdalias $cmd)
(( i++ ))
done
;;
esac
done
}
_hg_commands() {
(( $#_hg_cmd_list )) || _hg_get_commands
Brendan Cully
zsh: use standard tags where possible
r3548 _describe -t commands 'mercurial command' _hg_cmd_list
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh: add revrange completion
r3550 _hg_revrange() {
compset -P 1 '*:'
_hg_tags "$@"
}
Brendan Cully
zsh: rewrite...
r3537 _hg_tags() {
typeset -a tags
local tag rev
_hg_cmd tags 2> /dev/null | while read tag rev
do
tags+=($tag)
done
Brendan Cully
zsh: use standard tags where possible
r3548 (( $#tags )) && _describe -t tags 'tags' tags
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 _hg_files() {
if [[ -n "$_hg_root" ]]
then
[[ -d "$_hg_root/.hg" ]] || return
case "$_hg_root" in
/*)
_files -W $_hg_root
;;
*)
_files -W $PWD/$_hg_root
;;
esac
else
_files
fi
}
Brendan Cully
zsh: rewrite...
r3537 _hg_status() {
Steve Borho
zsh: better fix for partial completions...
r3878 [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
Steve Borho
zsh: fix completions with relative paths...
r3817 status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh completion: basic mq support
r3487
Brendan Cully
zsh: rewrite...
r3537 _hg_unknown() {
typeset -a status_files
_hg_status u
Brendan Cully
zsh: tab-complete status results by directory...
r3587 _wanted files expl 'unknown files' _multi_parts / status_files
Brendan Cully
zsh: rewrite...
r3537 }
_hg_missing() {
typeset -a status_files
_hg_status d
Brendan Cully
zsh: tab-complete status results by directory...
r3587 _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
Brendan Cully
zsh: rewrite...
r3537 }
_hg_addremove() {
Brendan Cully
zsh: use standard tags where possible
r3548 _alternative 'files:unknown files:_hg_unknown' \
'files:missing files:_hg_missing'
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh: complete SSH directories
r3598 _hg_ssh_urls() {
if [[ -prefix */ ]]
then
if zstyle -T ":completion:${curcontext}:files" remote-access
then
local host=${PREFIX%%/*}
typeset -a remdirs
compset -p $(( $#host + 1 ))
local rempath=${(M)PREFIX##*/}
Brendan Cully
zsh: complete users in ssh URLS
r3602 local cacheid="hg:${host}-${rempath//\//_}"
cacheid=${cacheid%[-_]}
Brendan Cully
zsh: complete SSH directories
r3598 compset -P '*/'
Brendan Cully
zsh: add optional remote directory cache
r3600 if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
then
remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
_store_cache "$cacheid" remdirs
fi
Brendan Cully
zsh: complete SSH directories
r3598 _describe -t directories 'remote directory' remdirs -S/
else
_message 'remote directory'
fi
else
Brendan Cully
zsh: complete users in ssh URLS
r3602 if compset -P '*@'
then
_hosts -S/
else
_alternative 'hosts:remote host name:_hosts -S/' \
'users:user:_users -S@'
fi
Brendan Cully
zsh: complete SSH directories
r3598 fi
}
Brendan Cully
zsh: support remote URLs
r3560 _hg_urls() {
if compset -P bundle://
then
_files
Brendan Cully
zsh: complete SSH directories
r3598 elif compset -P ssh://
then
_hg_ssh_urls
Brendan Cully
zsh: support remote URLs
r3560 elif [[ -prefix *: ]]
then
_urls
else
local expl
compset -S '[^:]*'
_wanted url-schemas expl 'URL schema' compadd -S '' - \
http:// https:// ssh:// bundle://
fi
}
Brendan Cully
zsh: rewrite...
r3537 _hg_paths() {
typeset -a paths pnames
_hg_cmd paths 2> /dev/null | while read -A pnames
do
paths+=($pnames[1])
done
Brendan Cully
zsh: support remote URLs
r3560 (( $#paths )) && _describe -t path-aliases 'repository alias' paths
Brendan Cully
zsh: rewrite...
r3537 }
_hg_remote() {
Brendan Cully
zsh: support remote URLs
r3560 _alternative 'path-aliases:repository alias:_hg_paths' \
'directories:directory:_files -/' \
Brendan Cully
zsh: complete SSH directories
r3598 'urls:URL:_hg_urls'
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh: support remote cloning
r3601 _hg_clone_dest() {
_alternative 'directories:directory:_files -/' \
'urls:URL:_hg_urls'
}
Brendan Cully
zsh: rewrite...
r3537 # Common options
_hg_global_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
Brendan Cully
zsh: rewrite...
r3537 '--cwd[change working directory]:new working directory:_files -/'
Brendan Cully
zsh: make option lists more compact
r3539 '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
'(--verbose -v)'{-v,--verbose}'[enable additional output]'
'(--quiet -q)'{-q,--quiet}'[suppress output]'
'(--help -h)'{-h,--help}'[display help and exit]'
Brendan Cully
zsh: rewrite...
r3537 '--debug[debug mode]'
'--debugger[start debugger]'
'--traceback[print traceback on exception]'
'--time[time how long the command takes]'
'--profile[profile]'
'--version[output version information and exit]'
)
_hg_pat_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
'*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
Brendan Cully
zsh: rewrite...
r3537
_hg_diff_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '(--text -a)'{-a,--text}'[treat all files as text]'
'(--git -g)'{-g,--git}'[use git extended diff format]'
Brendan Cully
zsh: rewrite...
r3537 "--nodates[don't include dates in diff headers]")
_hg_dryrun_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
Brendan Cully
zsh: rewrite...
r3537
_hg_style_opts=(
'--style[display using template map file]:'
'--template[display with template]:')
_hg_commit_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
'(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
'(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
Brendan Cully
zsh: rewrite...
r3537
_hg_remote_opts=(
Brendan Cully
zsh: make option lists more compact
r3539 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
Brendan Cully
zsh: rewrite...
r3537 '--remotecmd[specify hg command to run on the remote side]:')
_hg_cmd() {
_call_program hg hg "$_hg_cmd_globals[@]" "$@"
}
_hg_cmd_add() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
'*:unknown files:_hg_unknown'
}
_hg_cmd_addremove() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
Brendan Cully
zsh: rewrite...
r3537 '*:unknown or missing files:_hg_addremove'
}
_hg_cmd_annotate() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
'(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
'(--text -a)'{-a,--text}'[treat all files as text]' \
'(--user -u)'{-u,--user}'[list the author]' \
'(--date -d)'{-d,--date}'[list the date]' \
'(--number -n)'{-n,--number}'[list the revision number (default)]' \
'(--changeset -c)'{-c,--changeset}'[list the changeset]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:files:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_archive() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
'--no-decode[do not pass files through decoders]' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
'(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
'(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
Brendan Cully
zsh: rewrite...
r3537 '*:destination:_files'
}
_hg_cmd_bundle() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
Brendan Cully
zsh: rewrite...
r3537 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
':output file:_files' \
':destination repository:_files -/'
}
_hg_cmd_cat() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
'(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:file:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_clone() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
'(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
Brendan Cully
zsh: rewrite...
r3537 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
':source repository:_hg_remote' \
Brendan Cully
zsh: support remote cloning
r3601 ':destination:_hg_clone_dest'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_commit() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: typo in commit completion
r3666 '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
'(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
'(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
'(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:file:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_copy() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
'(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:file:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_diff() {
Brendan Cully
zsh: tab-complete status results by directory...
r3587 typeset -A opt_args
Brendan Cully
zsh: rewrite...
r3537 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
Brendan Cully
zsh: add revrange completion
r3550 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--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]' \
Brendan Cully
zsh: tab-complete status results by directory...
r3587 '*:file:->diff_files'
if [[ $state == 'diff_files' ]]
then
if [[ -n $opt_args[-r] ]]
then
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 _hg_files
Brendan Cully
zsh: tab-complete status results by directory...
r3587 else
_hg_modified
fi
fi
Brendan Cully
zsh completion: basic mq support
r3487 }
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_export() {
_arguments -s -w : $_hg_global_opts $_hg_diff_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
Brendan Cully
zsh: rewrite...
r3537 '--switch-parent[diff against the second parent]' \
'*:revision:_hg_tags'
}
Brendan Cully
zsh completion: basic mq support
r3487
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_grep() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
Brendan Cully
zsh: rewrite...
r3537 '--all[print all revisions with matches]' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
'(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
'(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
'(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
Brendan Cully
zsh: add revrange completion
r3550 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--user -u)'{-u,--user}'[print user who committed change]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:search pattern:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_heads() {
_arguments -s -w : $_hg_global_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
Brendan Cully
zsh: rewrite...
r3537 }
_hg_cmd_help() {
_arguments -s -w : $_hg_global_opts \
'*:mercurial command:_hg_commands'
}
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_import() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
'(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
'(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
Brendan Cully
zsh: rewrite...
r3537 '*:patch:_files'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_incoming() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
'(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
'(--patch -p)'{-p,--patch}'[show patch]' \
'(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
'(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
Brendan Cully
zsh: rewrite...
r3537 '--bundle[file to store the bundles into]:bundle file:_files' \
':source:_hg_remote'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_init() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
':dir:_files -/'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_locate() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
'(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
'(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:search pattern:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_log() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
Brendan Cully
zsh: rewrite...
r3537 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--copies -C)'{-C,--copies}'[show copied files]' \
'(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
'(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
Brendan Cully
zsh: add revrange completion
r3550 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
'(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
'(--patch -p)'{-p,--patch}'[show patch]' \
'(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:files:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_manifest() {
_arguments -s -w : $_hg_global_opts \
':revision:_hg_tags'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_outgoing() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
'(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
'(--patch -p)'{-p,--patch}'[show patch]' \
'(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
'(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
Brendan Cully
zsh: rewrite...
r3537 ':destination:_hg_remote'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_parents() {
_arguments -s -w : $_hg_global_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
Brendan Cully
zsh: rewrite...
r3537 ':revision:_hg_tags'
}
_hg_cmd_paths() {
_arguments -s -w : $_hg_global_opts \
':path:_hg_paths'
}
_hg_cmd_pull() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
'(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
Brendan Cully
zsh: rewrite...
r3537 ':source:_hg_remote'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_push() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--force -f)'{-f,--force}'[force push]' \
'(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
Brendan Cully
zsh: rewrite...
r3537 ':destination:_hg_remote'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_remove() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
'(--force -f)'{-f,--force}'[remove file even if modified]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:file:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_rename() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
'(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:file:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_revert() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
'(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
Brendan Cully
zsh: rewrite...
r3537 '--no-backup[do not save backup copies of files]' \
Brendan Cully
zsh: tab-complete status results by directory...
r3587 '*:file:->diff_files'
if [[ $state == 'diff_files' ]]
then
if [[ -n $opt_args[-r] ]]
then
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 _hg_files
Brendan Cully
zsh: tab-complete status results by directory...
r3587 else
typeset -a status_files
_hg_status mard
_wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
fi
fi
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_serve() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
'(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
'(--daemon -d)'{-d,--daemon}'[run server in background]' \
'(--port -p)'{-p+,--port}'[listen port]:listen port:' \
'(--address -a)'{-a+,--address}'[interface address]:interface address:' \
'(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
'(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
Brendan Cully
zsh: rewrite...
r3537 '--style[web template style]:style' \
'--stdio[for remote clients]' \
Brendan Cully
zsh: make option lists more compact
r3539 '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_status() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--all -A)'{-A,--all}'[show status of all files]' \
'(--modified -m)'{-m,--modified}'[show only modified files]' \
'(--added -a)'{-a,--added}'[show only added files]' \
'(--removed -r)'{-r,--removed}'[show only removed files]' \
'(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
'(--clean -c)'{-c,--clean}'[show only files without changes]' \
'(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
'(--ignored -i)'{-i,--ignored}'[show ignored files]' \
'(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
'(--copies -C)'{-C,--copies}'[show source of copied files]' \
'(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
Brendan Cully
zsh: rewrite...
r3537 '--rev[show difference from revision]:revision:_hg_tags' \
'*:files:_files'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_tag() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--local -l)'{-l,--local}'[make the tag local]' \
'(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
'(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
'(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
'(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
Brendan Cully
zsh: rewrite...
r3537 ':tag name:'
}
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_tip() {
_arguments -s -w : $_hg_global_opts $_hg_style_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--patch -p)'{-p,--patch}'[show patch]'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completions: new -M, -m arguments for log, etc.
r1438
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_unbundle() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
Brendan Cully
zsh: rewrite...
r3537 ':files:_files'
}
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_update() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
Brendan Cully
zsh: rewrite...
r3537 ':revision:_hg_tags'
}
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 # HGK
_hg_cmd_view() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
Brendan Cully
zsh: rewrite...
r3537 ':revision range:_hg_tags'
}
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 # MQ
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 _hg_qseries() {
typeset -a patches
Brendan Cully
zsh: suppress mq completion error messages outside of repository
r3559 patches=($(_hg_cmd qseries 2>/dev/null))
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 (( $#patches )) && _describe -t hg-patches 'patches' patches
}
_hg_qapplied() {
typeset -a patches
Brendan Cully
zsh: suppress mq completion error messages outside of repository
r3559 patches=($(_hg_cmd qapplied 2>/dev/null))
Brendan Cully
zsh: add qbase and qtip to qapplied completions
r3549 if (( $#patches ))
then
patches+=(qbase qtip)
_describe -t hg-applied-patches 'applied patches' patches
fi
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 }
_hg_qunapplied() {
typeset -a patches
Brendan Cully
zsh: suppress mq completion error messages outside of repository
r3559 patches=($(_hg_cmd qunapplied 2>/dev/null))
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
}
_hg_qguards() {
typeset -a guards
local guard
Brendan Cully
zsh: complete qguard with +/- guard prefixes
r3543 compset -P "+|-"
Brendan Cully
zsh: suppress mq completion error messages outside of repository
r3559 _hg_cmd qselect -s 2>/dev/null | while read guard
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 do
guards+=(${guard#(+|-)})
done
(( $#guards )) && _describe -t hg-guards 'guards' guards
}
_hg_qseries_opts=(
'(--summary -s)'{-s,--summary}'[print first line of patch header]')
_hg_cmd_qapplied() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts
}
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qdelete() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--keep -k)'{-k,--keep}'[keep patch file]' \
Brendan Cully
zsh: add revrange completion
r3550 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 '*:unapplied patch:_hg_qunapplied'
}
_hg_cmd_qdiff() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:pattern:_hg_files'
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 }
_hg_cmd_qfold() {
_arguments -s -w : $_hg_global_opts $_h_commit_opts \
'(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
'*:unapplied patch:_hg_qunapplied'
}
_hg_cmd_qguard() {
_arguments -s -w : $_hg_global_opts \
'(--list -l)'{-l,--list}'[list all patches and guards]' \
'(--none -n)'{-n,--none}'[drop all guards]' \
':patch:_hg_qseries' \
'*:guards:_hg_qguards'
Brendan Cully
zsh: rewrite...
r3537 }
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qheader() {
_arguments -s -w : $_hg_global_opts \
':patch:_hg_qseries'
}
Steve Borho
zsh completion function for hg
r1362
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 _hg_cmd_qimport() {
_arguments -s -w : $_hg_global_opts \
'(--existing -e)'{-e,--existing}'[import file in patch dir]' \
'(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
'(--force -f)'{-f,--force}'[overwrite existing files]' \
Brendan Cully
zsh: add revrange completion
r3550 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 '*:patch:_files'
}
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qnew() {
_arguments -s -w : $_hg_global_opts $_hg_commit_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
Brendan Cully
zsh: rewrite...
r3537 ':patch:'
}
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 _hg_cmd_qnext() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts
}
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qpop() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--all -a :)'{-a,--all}'[pop all patches]' \
'(--name -n)'{-n+,--name}'[queue name to pop]:' \
'(--force -f)'{-f,--force}'[forget any local changes]' \
Brendan Cully
zsh: rewrite...
r3537 ':patch:_hg_qapplied'
}
Brendan Cully
zsh completion: basic mq support
r3487
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 _hg_cmd_qprev() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts
}
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qpush() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--all -a :)'{-a,--all}'[apply all patches]' \
'(--list -l)'{-l,--list}'[list patch name in commit text]' \
'(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
'(--name -n)'{-n+,--name}'[merge queue name]:' \
'(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
Brendan Cully
zsh: rewrite...
r3537 ':patch:_hg_qunapplied'
}
Brendan Cully
zsh completion: basic mq support
r3487
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_qrefresh() {
_arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--git -g)'{-g,--git}'[use git extended diff format]' \
'(--short -s)'{-s,--short}'[short refresh]' \
Brendan Cully
zsh: compute repository root instead of forking hg
r3603 '*:files:_hg_files'
Brendan Cully
zsh: rewrite...
r3537 }
Brendan Cully
zsh completion: basic mq support
r3487
Brendan Cully
zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev...
r3541 _hg_cmd_qrename() {
_arguments -s -w : $_hg_global_opts \
':patch:_hg_qseries' \
':destination:'
}
_hg_cmd_qselect() {
_arguments -s -w : $_hg_global_opts \
'(--none -n :)'{-n,--none}'[disable all guards]' \
'(--series -s :)'{-s,--series}'[list all guards in series file]' \
'--pop[pop to before first guarded applied patch]' \
'--reapply[pop and reapply patches]' \
'*:guards:_hg_qguards'
}
_hg_cmd_qseries() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
'(--missing -m)'{-m,--missing}'[print patches not in series]'
}
_hg_cmd_qunapplied() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts
}
_hg_cmd_qtop() {
_arguments -s -w : $_hg_global_opts $_hg_qseries_opts
}
Brendan Cully
zsh: rewrite...
r3537 _hg_cmd_strip() {
_arguments -s -w : $_hg_global_opts \
Brendan Cully
zsh: make option lists more compact
r3539 '(--force -f)'{-f,--force}'[force multi-head removal]' \
'(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
'(--nobackup -n)'{-n,--nobackup}'[no backups]' \
Brendan Cully
zsh: rewrite...
r3537 ':revision:_hg_tags'
}
Brendan Cully
zsh: expand tags lazily
r3493
Brendan Cully
zsh: rewrite...
r3537 _hg "$@"