##// END OF EJS Templates
wix: functionality to automate building WiX installers...
wix: functionality to automate building WiX installers Like we did for Inno Setup, we want to make it easier to produce WiX installers. This commit does that. We introduce a new hgpackaging.wix module for performing all the high-level tasks required to produce WiX installers. This required miscellaneous enhancements to existing code in hgpackaging, including support for signing binaries. A new build.py script for calling into the module APIs has been created. It behaves very similarly to the Inno Setup build.py script. Unlike Inno Setup, we didn't have code in the repo previously to generate WiX installers. It appears that all existing automation for building WiX installers lives in the https://bitbucket.org/tortoisehg/thg-winbuild repository - most notably in its setup.py file. My strategy for inventing the code in this commit was to step through the code in that repo's setup.py and observe what it was doing. Despite the length of setup.py in that repository, the actual amount of steps required to produce a WiX installer is actually quite low. It consists of a basic py2exe build plus invocations of candle.exe and light.exe to produce the MSI. One rabbit hole that gave me fits was locating the Visual Studio 9 C Runtime merge modules. These merge modules are only present on your system if you have a full Visual Studio 2008 installation. Fortunately, I have a copy of Visual Studio 2008 and was able to install all the required updates. I then uploaded these merge modules to a personal repository on GitHub. That is where the added code references them from. We probably don't need to ship the merge modules. But that is for another day. The installs from the MSIs produced with the new automation differ from the last official MSI in the following ways: * Our HTML manual pages have UNIX line endings instead of Windows. * We ship modules in the mercurial.pure package. It appears the upstream packaging code is not including this package due to omission (they supply an explicit list of packages that has drifted out of sync with our setup.py). * We do not ship various distutils.* modules. This is because virtualenvs have a custom distutils/__init__.py that automagically imports distutils from its original location and py2exe gets confused by this. We don't use distutils in core Mercurial and don't provide a usable python.exe, so this omission should be acceptable. * The version of the enum package is different and we ship an enum.pyc instead of an enum/__init__.py. * The version of the docutils package is different and we ship a different set of files. * The version of Sphinx is drastically newer and we ship a number of files the old version did not. (I'm not sure why we ship Sphinx - I think it is a side-effect of the way the THG code was installing dependencies.) * We ship the idna package (dependent of requests which is a dependency of newer versions of Sphinx). * The version of imagesize is different and we ship an imagesize.pyc instead of an imagesize/__init__.pyc. * The version of the jinja2 package is different and the sets of files differs. * We ship the packaging package, which is a dependency for Sphinx. * The version of the pygments package is different and the sets of files differs. * We ship the requests package, which is a dependency for Sphinx. * We ship the snowballstemmer package, which is a dependency for Sphinx. * We ship the urllib3 package, which is a dependency for requests, which is a dependency for Sphinx. * We ship a newer version of the futures package, which includes a handful of extra modules that match Python 3 module names. # no-check-commit because foo_bar naming Differential Revision: https://phab.mercurial-scm.org/D6097

File last commit:

r39436:c54d4607 default
r42087:4371f543 default
Show More
bash_completion
656 lines | 14.8 KiB | application/x-sh | BashLexer
Bryan O'Sullivan
bash_completion: tell an editor what type of file this is
r18769 # bash completion for the Mercurial distributed SCM -*- sh -*-
Martin Geisler
setup: backout 68964567e406...
r10028
# Docs:
#
# If you source this file from your .bashrc, bash should be able to
# complete a command line that uses hg with all the available commands
# and options and sometimes even arguments.
#
# Mercurial allows you to define additional commands through extensions.
# Bash should be able to automatically figure out the name of these new
# commands and their options. See below for how to define _hg_opt_foo
# and _hg_cmd_foo functions to fine-tune the completion for option and
# non-option arguments, respectively.
#
#
# Notes about completion for specific commands:
#
# - the completion function for the email command from the patchbomb
# extension will try to call _hg_emails to get a list of e-mail
# addresses. It's up to the user to define this function. For
# example, put the addresses of the lists that you usually patchbomb
# in ~/.patchbomb-to and the addresses that you usually use to send
# the patchbombs in ~/.patchbomb-from and use something like this:
#
# _hg_emails()
# {
# if [ -r ~/.patchbomb-$1 ]; then
# cat ~/.patchbomb-$1
# fi
# }
#
#
# Writing completion functions for additional commands:
#
# If it exists, the function _hg_cmd_foo will be called without
# arguments to generate the completion candidates for the hg command
# "foo". If the command receives some arguments that aren't options
# even though they start with a "-", you can define a function called
# _hg_opt_foo to generate the completion candidates. If _hg_opt_foo
# doesn't return 0, regular completion for options is attempted.
#
# In addition to the regular completion variables provided by bash,
# the following variables are also set:
# - $hg - the hg program being used (e.g. /usr/bin/hg)
# - $cmd - the name of the hg command being completed
# - $cmd_index - the index of $cmd in $COMP_WORDS
# - $cur - the current argument being completed
# - $prev - the argument before $cur
# - $global_args - "|"-separated list of global options that accept
# an argument (e.g. '--cwd|-R|--repository')
# - $canonical - 1 if we canonicalized $cmd before calling the function
# 0 otherwise
#
shopt -s extglob
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 _hg_cmd()
{
HGPLAIN=1 "$hg" "$@" 2>/dev/null
}
Martin Geisler
setup: backout 68964567e406...
r10028 _hg_commands()
{
local commands
"Yann E. MORIN"
bash_completion: enable alias auto-complete...
r14374 commands="$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete "$cur")" || commands=""
Martin Geisler
setup: backout 68964567e406...
r10028 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur"))
}
_hg_paths()
{
Thomas Arendsen Hein
bash_completion: Use "hg paths -q" instead of piping through sed
r14332 local paths="$(_hg_cmd paths -q)"
Martin Geisler
setup: backout 68964567e406...
r10028 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur"))
}
_hg_repos()
{
local i
for i in $(compgen -d -- "$cur"); do
Sean Farley
bash_completion: untabify
r20123 test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
Martin Geisler
setup: backout 68964567e406...
r10028 done
}
Bryan O'Sullivan
completion: selectively use debugpathcomplete in bash_completion...
r18793 _hg_debugpathcomplete()
{
local files="$(_hg_cmd debugpathcomplete $1 "$cur")"
local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
}
Martin Geisler
setup: backout 68964567e406...
r10028 _hg_status()
{
Mathias De Maré
bashcompletion: allow skipping completion for 'hg status'...
r30199 if [ -z "$HGCOMPLETE_NOSTATUS" ]; then
local files="$(_hg_cmd status -n$1 "glob:$cur**")"
local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
fi
Martin Geisler
setup: backout 68964567e406...
r10028 }
Sean Farley
bash_completion: add _hg_branches for list of branches
r20131 _hg_branches()
{
local branches="$(_hg_cmd branches -q)"
local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
}
Kevin Bullock
bash_completion: complete bookmarks...
r13509 _hg_bookmarks()
{
local bookmarks="$(_hg_cmd bookmarks -q)"
local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur"))
}
_hg_labels()
{
Sean Farley
debugnamecomplete: rename from debuglabelcomplete...
r23762 local labels="$(_hg_cmd debugnamecomplete "$cur")"
Bryan O'Sullivan
completion: add a debuglabelcomplete command...
r18790 local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur"))
Kevin Bullock
bash_completion: complete bookmarks...
r13509 }
Martin Geisler
setup: backout 68964567e406...
r10028 # this is "kind of" ugly...
_hg_count_non_option()
{
local i count=0
local filters="$1"
for ((i=1; $i<=$COMP_CWORD; i++)); do
Sean Farley
bash_completion: untabify
r20123 if [[ "${COMP_WORDS[i]}" != -* ]]; then
if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
continue
fi
count=$(($count + 1))
fi
Martin Geisler
setup: backout 68964567e406...
r10028 done
echo $(($count - 1))
}
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist()
{
local LASTCHAR=' '
if [ ${#COMPREPLY[@]} = 1 ]; then
[ -d "$COMPREPLY" ] && LASTCHAR=/
COMPREPLY=$(printf %q%s "$COMPREPLY" "$LASTCHAR")
else
for ((i=0; i < ${#COMPREPLY[@]}; i++)); do
[ -d "${COMPREPLY[$i]}" ] && COMPREPLY[$i]=${COMPREPLY[$i]}/
done
fi
}
Martin Geisler
setup: backout 68964567e406...
r10028 _hg()
{
Sean Farley
bash_completion: determine root executable in case of alias...
r20125 local cur prev cmd cmd_index opts i aliashg
Martin Geisler
setup: backout 68964567e406...
r10028 # global options that receive an argument
av6
bash_completion: add more global options that receive an argument
r39435 local global_args='--cwd|-R|--repository|--color|--config|--encoding|--encodingmode|--pager'
Martin Geisler
setup: backout 68964567e406...
r10028 local hg="$1"
local canonical=0
Sean Farley
bash_completion: determine root executable in case of alias...
r20125 aliashg=$(alias $hg 2>/dev/null)
if [[ -n "$aliashg" ]]; then
aliashg=${aliashg#"alias $hg='"}
aliashg=${aliashg%"'"}
hg=$aliashg
fi
Martin Geisler
setup: backout 68964567e406...
r10028 COMPREPLY=()
cur="$2"
prev="$3"
# searching for the command
# (first non-option argument that doesn't follow a global option that
# receives an argument)
for ((i=1; $i<=$COMP_CWORD; i++)); do
Sean Farley
bash_completion: untabify
r20123 if [[ ${COMP_WORDS[i]} != -* ]]; then
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
cmd="${COMP_WORDS[i]}"
cmd_index=$i
break
fi
fi
Martin Geisler
setup: backout 68964567e406...
r10028 done
if [[ "$cur" == -* ]]; then
Sean Farley
bash_completion: untabify
r20123 if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
fi
Martin Geisler
setup: backout 68964567e406...
r10028
Martijn Pieters
bashcompletion: show available command-line switches for aliases...
r29386 opts=$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete --options "$cmd")
Martin Geisler
setup: backout 68964567e406...
r10028
Sean Farley
bash_completion: untabify
r20123 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
# global options
case "$prev" in
Sean Farley
bash_completion: untabify
r20123 -R|--repository)
_hg_paths
_hg_repos
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
;;
--cwd)
# Stick with default bash completion
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
;;
av6
bash_completion: complete arguments for --color and --pager
r39436 --color)
local choices='true false yes no always auto never debug'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur"))
_hg_fix_wordlist
return
;;
--pager)
local choices='true false yes no always auto never'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$choices' -- "$cur"))
_hg_fix_wordlist
return
;;
Martin Geisler
setup: backout 68964567e406...
r10028 esac
if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then
Sean Farley
bash_completion: untabify
r20123 _hg_commands
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
# try to generate completion candidates for whatever command the user typed
local help
if _hg_command_specific; then
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Sean Farley
bash_completion: untabify
r20123 return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
# canonicalize the command name and try again
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 help=$(_hg_cmd help "$cmd")
Martin Geisler
setup: backout 68964567e406...
r10028 if [ $? -ne 0 ]; then
Sean Farley
bash_completion: untabify
r20123 # Probably either the command doesn't exist or it's ambiguous
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
cmd=${help#hg }
cmd=${cmd%%[$' \n']*}
canonical=1
_hg_command_specific
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 _hg_fix_wordlist
Martin Geisler
setup: backout 68964567e406...
r10028 }
_hg_command_specific()
{
if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then
Sean Farley
bash_completion: untabify
r20123 "_hg_cmd_$cmd"
return 0
Martin Geisler
setup: backout 68964567e406...
r10028 fi
Sean Farley
bash_completion: change --rev if-else block into a case...
r20133 if [ "$cmd" != status ]; then
case "$prev" in
-r|--rev)
if [[ $canonical = 1 || status != "$cmd"* ]]; then
_hg_labels
return 0
fi
return 1
;;
Sean Farley
bash_completion: add global support for -B|--bookmark...
r20134 -B|--bookmark)
if [[ $canonical = 1 || status != "$cmd"* ]]; then
_hg_bookmarks
return 0
fi
return 1
;;
Sean Farley
bash_completion: add global support for -b|--branch...
r20135 -b|--branch)
if [[ $canonical = 1 || status != "$cmd"* ]]; then
_hg_branches
return 0
fi
return 1
;;
Sean Farley
bash_completion: change --rev if-else block into a case...
r20133 esac
Martin Geisler
setup: backout 68964567e406...
r10028 fi
Sean Farley
bash_completion: expand aliased commands
r20124 local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}')
[ -n "$aliascmd" ] && cmd=$aliascmd
Martin Geisler
setup: backout 68964567e406...
r10028 case "$cmd" in
Sean Farley
bash_completion: untabify
r20123 help)
_hg_commands
;;
export)
if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
return 0
fi
_hg_labels
;;
manifest|update|up|checkout|co)
_hg_labels
;;
pull|push|outgoing|incoming)
_hg_paths
_hg_repos
;;
paths)
_hg_paths
;;
add)
_hg_status "u"
;;
merge)
_hg_labels
;;
Martin von Zweigbergk
completion: add support for new "amend" command...
r35473 commit|ci|record|amend)
Sean Farley
bash_completion: untabify
r20123 _hg_status "mar"
;;
remove|rm)
_hg_debugpathcomplete -n
;;
forget)
_hg_debugpathcomplete -fa
;;
diff)
_hg_status "mar"
;;
revert)
Martin von Zweigbergk
completion: don't suggest clean files to revert...
r35472 _hg_status "mard"
Sean Farley
bash_completion: untabify
r20123 ;;
clone)
local count=$(_hg_count_non_option)
if [ $count = 1 ]; then
_hg_paths
fi
_hg_repos
;;
debugindex|debugindexdot)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur"))
;;
debugdata)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur"))
;;
*)
return 1
;;
Martin Geisler
setup: backout 68964567e406...
r10028 esac
return 0
}
Sean Farley
bash_completion: fix issue with subdirectories not being completed...
r20126 complete -o bashdefault -o default -o nospace -F _hg hg \
|| complete -o default -o nospace -F _hg hg
Martin Geisler
setup: backout 68964567e406...
r10028
# Completion for commands provided by extensions
# bookmarks
_hg_cmd_bookmarks()
{
Sean Farley
bash_completion: remove restriction on bookmark completion...
r20127 _hg_bookmarks
return
Martin Geisler
setup: backout 68964567e406...
r10028 }
# mq
_hg_ext_mq_patchlist()
{
local patches
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 patches=$(_hg_cmd $1)
Martin Geisler
setup: backout 68964567e406...
r10028 if [ $? -eq 0 ] && [ "$patches" ]; then
Sean Farley
bash_completion: untabify
r20123 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur"))
return 0
Martin Geisler
setup: backout 68964567e406...
r10028 fi
return 1
}
_hg_ext_mq_queues()
{
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 local root=$(_hg_cmd root)
Martin Geisler
setup: backout 68964567e406...
r10028 local n
for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do
Sean Farley
bash_completion: untabify
r20123 # I think we're usually not interested in the regular "patches" queue
# so just filter it.
if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then
COMPREPLY=(${COMPREPLY[@]:-} "$n")
fi
Martin Geisler
setup: backout 68964567e406...
r10028 done
}
_hg_cmd_qpop()
{
if [[ "$prev" = @(-n|--name) ]]; then
Sean Farley
bash_completion: untabify
r20123 _hg_ext_mq_queues
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_ext_mq_patchlist qapplied
}
_hg_cmd_qpush()
{
if [[ "$prev" = @(-n|--name) ]]; then
Sean Farley
bash_completion: untabify
r20123 _hg_ext_mq_queues
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_ext_mq_patchlist qunapplied
}
_hg_cmd_qgoto()
{
if [[ "$prev" = @(-n|--name) ]]; then
Sean Farley
bash_completion: untabify
r20123 _hg_ext_mq_queues
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_ext_mq_patchlist qseries
}
_hg_cmd_qdelete()
{
local qcmd=qunapplied
if [[ "$prev" = @(-r|--rev) ]]; then
Sean Farley
bash_completion: untabify
r20123 qcmd=qapplied
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_ext_mq_patchlist $qcmd
}
_hg_cmd_qfinish()
{
if [[ "$prev" = @(-a|--applied) ]]; then
Sean Farley
bash_completion: untabify
r20123 return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_ext_mq_patchlist qapplied
}
_hg_cmd_qsave()
{
if [[ "$prev" = @(-n|--name) ]]; then
Sean Farley
bash_completion: untabify
r20123 _hg_ext_mq_queues
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
}
Kevin Bullock
bash_completion: add rebase rev completion
r17463 _hg_cmd_rebase() {
if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then
_hg_labels
return
fi
}
Martin Geisler
setup: backout 68964567e406...
r10028 _hg_cmd_strip()
{
Sean Farley
bash_completion: add -B|--bookmark support for strip
r20130 if [[ "$prev" = @(-B|--bookmark) ]]; then
_hg_bookmarks
return
fi
Kevin Bullock
bash_completion: complete bookmarks...
r13509 _hg_labels
Martin Geisler
setup: backout 68964567e406...
r10028 }
_hg_cmd_qcommit()
{
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 local root=$(_hg_cmd root)
Martin Geisler
setup: backout 68964567e406...
r10028 # this is run in a sub-shell, so we can't use _hg_status
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 local files=$(cd "$root/.hg/patches" && _hg_cmd status -nmar)
Martin Geisler
setup: backout 68964567e406...
r10028 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
}
_hg_cmd_qfold()
{
_hg_ext_mq_patchlist qunapplied
}
_hg_cmd_qrename()
{
_hg_ext_mq_patchlist qseries
}
_hg_cmd_qheader()
{
_hg_ext_mq_patchlist qseries
}
_hg_cmd_qclone()
{
local count=$(_hg_count_non_option)
if [ $count = 1 ]; then
Sean Farley
bash_completion: untabify
r20123 _hg_paths
Martin Geisler
setup: backout 68964567e406...
r10028 fi
_hg_repos
}
_hg_ext_mq_guards()
{
Brodie Rao
bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
r11646 _hg_cmd qselect --series | sed -e 's/^.//'
Martin Geisler
setup: backout 68964567e406...
r10028 }
_hg_cmd_qselect()
{
local guards=$(_hg_ext_mq_guards)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur"))
}
_hg_cmd_qguard()
{
local prefix=''
if [[ "$cur" == +* ]]; then
Sean Farley
bash_completion: untabify
r20123 prefix=+
Martin Geisler
setup: backout 68964567e406...
r10028 elif [[ "$cur" == -* ]]; then
Sean Farley
bash_completion: untabify
r20123 prefix=-
Martin Geisler
setup: backout 68964567e406...
r10028 fi
local ncur=${cur#[-+]}
if ! [ "$prefix" ]; then
Sean Farley
bash_completion: untabify
r20123 _hg_ext_mq_patchlist qseries
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
local guards=$(_hg_ext_mq_guards)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur"))
}
_hg_opt_qguard()
{
local i
for ((i=cmd_index+1; i<=COMP_CWORD; i++)); do
Sean Farley
bash_completion: untabify
r20123 if [[ ${COMP_WORDS[i]} != -* ]]; then
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
_hg_cmd_qguard
return 0
fi
elif [ "${COMP_WORDS[i]}" = -- ]; then
_hg_cmd_qguard
return 0
fi
Martin Geisler
setup: backout 68964567e406...
r10028 done
return 1
}
"Yann E. MORIN"
mq/qqueue: enable bash completion...
r11768 _hg_cmd_qqueue()
{
local q
local queues
"Yann E. MORIN"
mq/qqueue: update bash completion
r11968 local opts="--list --create --rename --delete --purge"
"Yann E. MORIN"
mq/qqueue: enable bash completion...
r11768
queues=$( _hg_cmd qqueue --quiet )
COMPREPLY=( $( compgen -W "${opts} ${queues}" "${cur}" ) )
}
Martin Geisler
setup: backout 68964567e406...
r10028
# hbisect
_hg_cmd_bisect()
{
local i subcmd
# find the sub-command
for ((i=cmd_index+1; i<=COMP_CWORD; i++)); do
Sean Farley
bash_completion: untabify
r20123 if [[ ${COMP_WORDS[i]} != -* ]]; then
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
subcmd="${COMP_WORDS[i]}"
break
fi
fi
Martin Geisler
setup: backout 68964567e406...
r10028 done
if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then
Sean Farley
bash_completion: untabify
r20123 COMPREPLY=(${COMPREPLY[@]:-}
$(compgen -W 'bad good help init next reset' -- "$cur"))
return
Martin Geisler
setup: backout 68964567e406...
r10028 fi
case "$subcmd" in
Sean Farley
bash_completion: untabify
r20123 good|bad)
_hg_labels
;;
Martin Geisler
setup: backout 68964567e406...
r10028 esac
return
}
# patchbomb
_hg_cmd_email()
{
case "$prev" in
Sean Farley
bash_completion: untabify
r20123 -c|--cc|-t|--to|-f|--from|--bcc)
# we need an e-mail address. let the user provide a function
# to get them
if [ "$(type -t _hg_emails)" = function ]; then
local arg=to
if [[ "$prev" == @(-f|--from) ]]; then
arg=from
fi
local addresses=$(_hg_emails $arg)
COMPREPLY=(${COMPREPLY[@]:-}
$(compgen -W '$addresses' -- "$cur"))
fi
return
;;
-m|--mbox)
# fallback to standard filename completion
return
;;
-s|--subject)
# free form string
return
;;
Martin Geisler
setup: backout 68964567e406...
r10028 esac
Kevin Bullock
bash_completion: complete bookmarks...
r13509 _hg_labels
Martin Geisler
setup: backout 68964567e406...
r10028 return
}
# gpg
_hg_cmd_sign()
{
Kevin Bullock
bash_completion: complete bookmarks...
r13509 _hg_labels
Martin Geisler
setup: backout 68964567e406...
r10028 }
# transplant
_hg_cmd_transplant()
{
case "$prev" in
Sean Farley
bash_completion: untabify
r20123 -s|--source)
_hg_paths
_hg_repos
return
;;
--filter)
# standard filename completion
return
;;
Martin Geisler
setup: backout 68964567e406...
r10028 esac
# all other transplant options values and command parameters are revisions
Kevin Bullock
bash_completion: complete bookmarks...
r13509 _hg_labels
Martin Geisler
setup: backout 68964567e406...
r10028 return
}
# shelve
_hg_shelves()
{
Sean Farley
bash_completion: use correct command for listing shelves...
r20128 local shelves="$(_hg_cmd shelve -ql)"
Martin Geisler
setup: backout 68964567e406...
r10028 local IFS=$'\n'
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur"))
}
_hg_cmd_shelve()
{
av6
bash_completion: add -p|--patch|--stat support for shelve
r26904 if [[ "$prev" = @(-d|--delete|-l|--list|-p|--patch|--stat) ]]; then
Sean Farley
bash_completion: add completion for deleting a shelve
r20129 _hg_shelves
else
_hg_status "mard"
fi
Martin Geisler
setup: backout 68964567e406...
r10028 }
_hg_cmd_unshelve()
{
_hg_shelves
}