contrib/zsh_completion
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Tue, 10 May 2022 20:30:26 +0100
changeset 49190 4ff4e23de7df
parent 42526 0c0e54bcea9b
permissions -rw-r--r--
clone: use better names for temp files Before this commit, the file names are /tmp/tmpn8smvlr8 After this commit, they are more like /tmp/hg-clone-n8smvlr8/00manifest.ndb3qj52v6, which makes it much clearer what these files correspond to. Differential Revision: https://phab.mercurial-scm.org/D12623
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42526
0c0e54bcea9b zsh: enable completion support for chg as well
Kyle Lippincott <spectral@google.com>
parents: 41681
diff changeset
     1
#compdef hg chg
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     2
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     3
# Zsh completion script for mercurial.  Rename this file to _hg and copy
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     4
# it into your zsh function path (/usr/share/zsh/site-functions for
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     5
# instance)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     6
#
8616
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
     7
# If you do not want to install it globally, you can copy it somewhere
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
     8
# else and add that directory to $fpath. This must be done before
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
     9
# compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    10
# file could look like this:
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    11
#
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    12
# fpath=("$HOME/.zsh.d" $fpath)
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    13
# autoload -U compinit
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    14
# compinit
704833724ff6 zsh-comp: explain how to use for non-global install
Martin Geisler <mg@lazybytes.net>
parents: 7510
diff changeset
    15
#
8961
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    16
# Copyright (C) 2005, 2006 Steve Borho <steve@borho.org>
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
    17
# Copyright (C) 2006-10 Brendan Cully <brendan@kublai.com>
8961
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    18
#
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    19
# Permission is hereby granted, without written agreement and without
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    20
# licence or royalty fees, to use, copy, modify, and distribute this
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    21
# software and to distribute modified versions of this software for any
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    22
# purpose, provided that the above copyright notice and the following
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    23
# two paragraphs appear in all copies of this software.
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    24
#
8961
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    25
# In no event shall the authors be liable to any party for direct,
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    26
# indirect, special, incidental, or consequential damages arising out of
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    27
# the use of this software and its documentation, even if the authors
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    28
# have been advised of the possibility of such damage.
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    29
#
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    30
# The authors specifically disclaim any warranties, including, but not
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    31
# limited to, the implied warranties of merchantability and fitness for
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    32
# a particular purpose.  The software provided hereunder is on an "as
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    33
# is" basis, and the authors have no obligation to provide maintenance,
c963d49ac7a1 Relicense zsh completion script under zsh license.
Brendan Cully <brendan@kublai.com>
parents: 8616
diff changeset
    34
# support, updates, enhancements, or modifications.
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    35
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
    36
emulate -LR zsh
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
    37
setopt extendedglob
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
    38
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    39
local curcontext="$curcontext" state line
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    40
typeset -A _hg_cmd_globals
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    41
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    42
_hg() {
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    43
  local cmd _hg_root
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    44
  integer i=2
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    45
  _hg_cmd_globals=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    46
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    47
  while (( i < $#words ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    48
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    49
    case "$words[$i]" in
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    50
      -R|--repository)
3605
9d815b074dcb zsh: perform ~ expansion on _hg_root
Brendan Cully <brendan@kublai.com>
parents: 3603
diff changeset
    51
        eval _hg_root="$words[$i+1]"
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    52
        _hg_cmd_globals+=("$words[$i]" "$_hg_root")
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    53
        (( i += 2 ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    54
        continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    55
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    56
      -R*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    57
        _hg_cmd_globals+="$words[$i]"
3605
9d815b074dcb zsh: perform ~ expansion on _hg_root
Brendan Cully <brendan@kublai.com>
parents: 3603
diff changeset
    58
        eval _hg_root="${words[$i]#-R}"
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    59
       (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    60
       continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    61
      ;;
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    62
      --cwd|--config)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    63
        # pass along arguments to hg completer
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    64
        _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    65
        (( i += 2 ))
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    66
        continue
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
    67
      ;;
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    68
      -*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    69
        # skip option
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    70
        (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    71
        continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    72
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    73
    esac
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    74
    if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    75
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    76
      cmd="$words[$i]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    77
      words[$i]=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    78
      (( CURRENT-- ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    79
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    80
    (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    81
  done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    82
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    83
  if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    84
  then
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
    85
    _arguments -s -S : $_hg_global_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    86
    ':mercurial command:_hg_commands'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    87
    return
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    88
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    89
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    90
  # resolve abbreviations and aliases
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    91
  if ! (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    92
  then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    93
    local cmdexp
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    94
    (( $#_hg_cmd_list )) || _hg_get_commands
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    95
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    96
    cmdexp=$_hg_cmd_list[(r)${cmd}*]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    97
    if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    98
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    99
      # might be nice to rewrite the command line with the expansion
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   100
      cmd="$cmdexp"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   101
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   102
    if [[ -n $_hg_alias_list[$cmd] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   103
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   104
      cmd=$_hg_alias_list[$cmd]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   105
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   106
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   107
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   108
  curcontext="${curcontext%:*:*}:hg-${cmd}:"
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   109
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   110
  zstyle -s ":completion:$curcontext:" cache-policy update_policy
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   111
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   112
  if [[ -z "$update_policy" ]]
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   113
  then
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   114
    zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   115
  fi
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   116
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   117
  if (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   118
  then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   119
    _hg_cmd_${cmd}
3597
0d253ec988a6 zsh: complete unknown commands normally
Brendan Cully <brendan@kublai.com>
parents: 3587
diff changeset
   120
  else
0d253ec988a6 zsh: complete unknown commands normally
Brendan Cully <brendan@kublai.com>
parents: 3587
diff changeset
   121
    # complete unknown commands normally
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   122
    _arguments -s -S : $_hg_global_opts \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   123
      '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   124
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   125
}
3497
459e7cd943d4 zsh: complete according to the -R option if specified
Brendan Cully <brendan@kublai.com>
parents: 3496
diff changeset
   126
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   127
_hg_cache_policy() {
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   128
  typeset -a old
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   129
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   130
  # cache for a minute
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   131
  old=( "$1"(mm+10) )
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   132
  (( $#old )) && return 0
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   133
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   134
  return 1
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   135
}
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   136
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   137
_hg_get_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   138
  typeset -ga _hg_cmd_list
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   139
  typeset -gA _hg_alias_list
7510
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   140
  local hline cmd cmdalias
7466
05010666fb19 Update zsh completion for new help format
Brendan Cully <brendan@kublai.com>
parents: 7386
diff changeset
   141
39207
f625e457f43a zsh_completion: run hg with HGPLAINEXCEPT=alias to list commands
Anton Shestakov <av6@dwimlabs.net>
parents: 39206
diff changeset
   142
  _call_program hg HGPLAINEXCEPT=alias hg debugcomplete -v | while read -A hline
7510
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   143
  do
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   144
    cmd=$hline[1]
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   145
    _hg_cmd_list+=($cmd)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   146
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   147
    for cmdalias in $hline[2,-1]
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   148
    do
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   149
      _hg_cmd_list+=($cmdalias)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   150
      _hg_alias_list+=($cmdalias $cmd)
21009e85ee78 Update zsh completion to use debugcomplete -v instead of parsing help
Brendan Cully <brendan@kublai.com>
parents: 7466
diff changeset
   151
    done
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   152
  done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   153
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   154
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   155
_hg_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   156
  (( $#_hg_cmd_list )) || _hg_get_commands
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   157
  _describe -t commands 'mercurial command' _hg_cmd_list
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   158
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   159
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
   160
_hg_revrange() {
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
   161
  compset -P 1 '*:'
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   162
  _hg_labels "$@"
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   163
}
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   164
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   165
_hg_labels() {
23762
0390cc327dd5 debugnamecomplete: rename from debuglabelcomplete
Sean Farley <sean.michael.farley@gmail.com>
parents: 23091
diff changeset
   166
  labels=("${(f)$(_hg_cmd debugnamecomplete)}")
18903
5df602551eea zsh_completion: make use of `debuglabelcomplete` command
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 18843
diff changeset
   167
  (( $#labels )) && _describe -t labels 'labels' labels
3550
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
   168
}
ef80b13df85a zsh: add revrange completion
Brendan Cully <brendan@kublai.com>
parents: 3549
diff changeset
   169
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   170
_hg_bookmarks() {
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   171
  typeset -a bookmark bookmarks
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   172
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   173
  _hg_cmd bookmarks | while read -A bookmark
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   174
  do
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   175
    if test -z ${bookmark[-1]:#[0-9]*}
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   176
    then
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   177
      bookmarks+=($bookmark[-2])
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   178
    fi
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   179
  done
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   180
  (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   181
}
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   182
15100
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   183
_hg_branches() {
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   184
  typeset -a branches
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   185
  local branch
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   186
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   187
  _hg_cmd branches | while read branch
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   188
  do
18419
45bb5df43b81 zsh_completion: fix issue with overlong branch/tag names
Johannes Schlatow <johannes@schlatow.name>
parents: 17403
diff changeset
   189
    branches+=(${branch/ #[0-9]#:*})
15100
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   190
  done
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   191
  (( $#branches )) && _describe -t branches 'branches' branches
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   192
}
a051f8a6a7cc contrib: some support for named branches in zsh_completion (issue2988)
Ben Hockey <neonstalwart@gmail.com>
parents: 13562
diff changeset
   193
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   194
# likely merge candidates
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   195
_hg_mergerevs() {
39443
2815e0db4c54 zsh_completion: use revsets to exclude this rev from suggestions to hg merge
Anton Shestakov <av6@dwimlabs.net>
parents: 39394
diff changeset
   196
  typeset -a heads branches
2815e0db4c54 zsh_completion: use revsets to exclude this rev from suggestions to hg merge
Anton Shestakov <av6@dwimlabs.net>
parents: 39394
diff changeset
   197
  local revset='sort(head() and not ., -rev)'
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   198
39443
2815e0db4c54 zsh_completion: use revsets to exclude this rev from suggestions to hg merge
Anton Shestakov <av6@dwimlabs.net>
parents: 39394
diff changeset
   199
  heads=(${(f)"$(_hg_cmd log -r '$revset' --template '{rev}:{branch}\\n')"})
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   200
  (( $#heads )) && _describe -t heads 'heads' heads
18420
c2792fe15025 zsh_completion: add completion of branch names
Johannes Schlatow <johannes@schlatow.name>
parents: 18419
diff changeset
   201
39443
2815e0db4c54 zsh_completion: use revsets to exclude this rev from suggestions to hg merge
Anton Shestakov <av6@dwimlabs.net>
parents: 39394
diff changeset
   202
  branches=(${(S)heads/#*:/})
18420
c2792fe15025 zsh_completion: add completion of branch names
Johannes Schlatow <johannes@schlatow.name>
parents: 18419
diff changeset
   203
  (( $#branches )) && _describe -t branches 'branches' branches
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   204
}
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   205
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   206
_hg_files() {
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   207
  if [[ -n "$_hg_root" ]]
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   208
  then
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   209
    [[ -d "$_hg_root/.hg" ]] || return
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   210
    case "$_hg_root" in
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   211
      /*)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   212
        _files -W $_hg_root
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   213
      ;;
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   214
      *)
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   215
        _files -W $PWD/$_hg_root
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   216
      ;;
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   217
    esac
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   218
  else
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   219
    _files
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   220
  fi
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   221
}
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   222
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   223
_hg_status() {
3878
729f354f3f09 zsh: better fix for partial completions
Steve Borho <steve@borho.org>
parents: 3817
diff changeset
   224
  [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   225
  status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   226
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   227
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   228
_hg_unknown() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   229
  typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   230
  _hg_status u
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   231
  _wanted files expl 'unknown files' _multi_parts / status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   232
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   233
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   234
_hg_missing() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   235
  typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   236
  _hg_status d
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   237
  _wanted files expl 'missing files' _multi_parts / status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   238
}
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   239
39204
8ff14f8fe2d3 zsh_completion: complete files from `hg st -mar` for commit and diff
Anton Shestakov <av6@dwimlabs.net>
parents: 39203
diff changeset
   240
_hg_committable() {
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   241
  typeset -a status_files
39204
8ff14f8fe2d3 zsh_completion: complete files from `hg st -mar` for commit and diff
Anton Shestakov <av6@dwimlabs.net>
parents: 39203
diff changeset
   242
  _hg_status mar
8ff14f8fe2d3 zsh_completion: complete files from `hg st -mar` for commit and diff
Anton Shestakov <av6@dwimlabs.net>
parents: 39203
diff changeset
   243
  _wanted files expl 'modified, added or removed files' _multi_parts / status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   244
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   245
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   246
_hg_resolve() {
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   247
  local rstate rpath
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   248
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   249
  [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   250
41681
61415361e906 zsh: fix `hg resolve` completion when in a subdirectory (issue6067)
Kyle Lippincott <spectral@google.com>
parents: 40336
diff changeset
   251
  _hg_cmd resolve -l ./$PREFIX -T '{mergestatus}\ {relpath\(path\)}\\n' | while read rstate rpath
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   252
  do
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   253
    [[ $rstate == 'R' ]] && resolved_files+=($rpath)
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   254
    [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   255
  done
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   256
}
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   257
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   258
_hg_resolved() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   259
  typeset -a resolved_files unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   260
  _hg_resolve
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   261
  _wanted files expl 'resolved files' _multi_parts / resolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   262
}
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   263
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   264
_hg_unresolved() {
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   265
  typeset -a resolved_files unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   266
  _hg_resolve
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   267
  _wanted files expl 'unresolved files' _multi_parts / unresolved_files
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   268
}
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   269
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   270
_hg_config() {
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   271
    typeset -a items
6804
694223a29ad4 Added missing --config global option to zsh_completion.
byron@base2.cc
parents: 5868
diff changeset
   272
    items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   273
    (( $#items )) && _describe -t config 'config item' items
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   274
}
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   275
39377
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   276
_hg_internal_merge_tools=(
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   277
  \\:dump \\:fail \\:forcedump \\:local \\:merge \\:merge-local \\:merge-other
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   278
  \\:merge3 \\:other \\:prompt \\:tagmerge \\:union
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   279
)
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   280
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   281
_hg_merge_tools() {
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   282
  typeset -a external_tools
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   283
  _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   284
  external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   285
  (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   286
}
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   287
39444
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
   288
_hg_shelves() {
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
   289
  shelves=("${(f)$(_hg_cmd shelve -ql)}")
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
   290
  (( $#shelves )) && _describe -t shelves 'shelves' shelves
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
   291
}
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
   292
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   293
_hg_addremove() {
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   294
  _alternative 'files:unknown files:_hg_unknown' \
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   295
    'files:missing files:_hg_missing'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   296
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   297
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   298
_hg_ssh_urls() {
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   299
  if [[ -prefix */ ]]
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   300
  then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   301
    if zstyle -T ":completion:${curcontext}:files" remote-access
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   302
    then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   303
      local host=${PREFIX%%/*}
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   304
      typeset -a remdirs
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   305
      compset -p $(( $#host + 1 ))
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   306
      local rempath=${(M)PREFIX##*/}
3602
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   307
      local cacheid="hg:${host}-${rempath//\//_}"
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   308
      cacheid=${cacheid%[-_]}
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   309
      compset -P '*/'
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   310
      if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   311
      then
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   312
        remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
3600
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   313
        _store_cache "$cacheid" remdirs
932dadd2e614 zsh: add optional remote directory cache
Brendan Cully <brendan@kublai.com>
parents: 3598
diff changeset
   314
      fi
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   315
      _describe -t directories 'remote directory' remdirs -S/
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   316
    else
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   317
      _message 'remote directory'
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   318
    fi
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   319
  else
3602
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   320
    if compset -P '*@'
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   321
    then
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   322
      _hosts -S/
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   323
    else
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   324
      _alternative 'hosts:remote host name:_hosts -S/' \
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   325
        'users:user:_users -S@'
ec221317e018 zsh: complete users in ssh URLS
Brendan Cully <brendan@kublai.com>
parents: 3601
diff changeset
   326
    fi
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   327
  fi
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   328
}
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   329
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   330
_hg_urls() {
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   331
  if compset -P bundle://
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   332
  then
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   333
    _files
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   334
  elif compset -P ssh://
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   335
  then
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   336
    _hg_ssh_urls
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   337
  elif [[ -prefix *: ]]
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   338
  then
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   339
    _urls
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   340
  else
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   341
    local expl
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   342
    compset -S '[^:]*'
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   343
    _wanted url-schemas expl 'URL schema' compadd -S '' - \
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   344
      http:// https:// ssh:// bundle://
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   345
  fi
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   346
}
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   347
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   348
_hg_paths() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   349
  typeset -a paths pnames
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   350
  _hg_cmd paths | while read -A pnames
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   351
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   352
    paths+=($pnames[1])
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   353
  done
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   354
  (( $#paths )) && _describe -t path-aliases 'repository alias' paths
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   355
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   356
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   357
_hg_remote() {
3560
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   358
  _alternative 'path-aliases:repository alias:_hg_paths' \
6106236bc4eb zsh: support remote URLs
Brendan Cully <brendan@kublai.com>
parents: 3559
diff changeset
   359
    'directories:directory:_files -/' \
3598
27121416f9a8 zsh: complete SSH directories
Brendan Cully <brendan@kublai.com>
parents: 3597
diff changeset
   360
    'urls:URL:_hg_urls'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   361
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   362
3601
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   363
_hg_clone_dest() {
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   364
  _alternative 'directories:directory:_files -/' \
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   365
    'urls:URL:_hg_urls'
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   366
}
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   367
17396
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   368
_hg_add_help_topics=(
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   369
    config dates diffs environment extensions filesets glossary hgignore hgweb
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   370
    merge-tools multirevs obsolescence patterns phases revisions revsets
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   371
    subrepos templating urls
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   372
)
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   373
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   374
_hg_help_topics() {
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   375
    local topics
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   376
    (( $#_hg_cmd_list )) || _hg_get_commands
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   377
    topics=($_hg_cmd_list $_hg_add_help_topics)
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   378
    _describe -t help_topics 'help topics' topics
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   379
}
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   380
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   381
# Common options
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   382
_hg_global_opts=(
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   383
    '(--repository -R)'{-R+,--repository=}'[repository root directory or name of overlay bundle file]:repository:_files -/'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   384
    '--cwd=[change working directory]:new working directory:_files -/'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   385
    '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, automatically pick the first choice for all prompts]'
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   386
    '(--verbose -v)'{-v,--verbose}'[enable additional output]'
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   387
    '*--config=[set/override config option]:defined config items:_hg_config'
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   388
    '(--quiet -q)'{-q,--quiet}'[suppress output]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   389
    '(--help -h)'{-h,--help}'[display help and exit]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   390
    '--debug[enable debugging output]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   391
    '--debugger[start debugger]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   392
    '--encoding=[set the charset encoding]:encoding'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   393
    '--encodingmode=[set the charset encoding mode]:encoding mode'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   394
    '--traceback[always print a traceback on exception]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   395
    '--time[time how long the command takes]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   396
    '--profile[print command execution profile]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   397
    '--version[output version information and exit]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   398
    '--hidden[consider hidden changesets]'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   399
    '--color=[when to colorize]:when:(true false yes no always auto never debug)'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   400
    '--pager=[when to paginate (default: auto)]:when:(true false yes no always auto never)'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   401
)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   402
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   403
_hg_pat_opts=(
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   404
  '*'{-I+,--include=}'[include names matching the given patterns]:pattern:_files -W $(_hg_cmd root) -/'
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   405
  '*'{-X+,--exclude=}'[exclude names matching the given patterns]:pattern:_files -W $(_hg_cmd root) -/')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   406
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   407
_hg_date_user_opts=(
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   408
  '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]'
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   409
  '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   410
  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   411
  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user')
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   412
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   413
_hg_gitlike_opts=(
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   414
  '(--git -g)'{-g,--git}'[use git extended diff format]')
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   415
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   416
_hg_diff_opts=(
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   417
  $_hg_gitlike_opts
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   418
  '(--text -a)'{-a,--text}'[treat all files as text]'
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   419
  '--binary[generate binary diffs in git mode (default)]'
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   420
  '--nodates[omit dates from diff headers]'
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   421
)
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   422
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   423
_hg_mergetool_opts=(
39377
b4e7e1f09c09 zsh_completion: complete merge tools for -t/--tool
Anton Shestakov <av6@dwimlabs.net>
parents: 39347
diff changeset
   424
  '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   425
)
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   426
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   427
_hg_dryrun_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   428
  '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   429
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   430
_hg_ignore_space_opts=(
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   431
  '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   432
  '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   433
  '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   434
  '(--ignore-space-at-eol -Z)'{-Z,--ignore-space-at-eol}'[ignore changes in whitespace at EOL]'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   435
)
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   436
39202
27bbd62e9957 zsh_completion: rename _hg_style_opts to _hg_template_opts
Anton Shestakov <av6@dwimlabs.net>
parents: 33434
diff changeset
   437
_hg_template_opts=(
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   438
  '(--template -T)'{-T+,--template=}'[display with template]:template'
39202
27bbd62e9957 zsh_completion: rename _hg_style_opts to _hg_template_opts
Anton Shestakov <av6@dwimlabs.net>
parents: 33434
diff changeset
   439
)
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   440
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   441
_hg_log_opts=(
39202
27bbd62e9957 zsh_completion: rename _hg_style_opts to _hg_template_opts
Anton Shestakov <av6@dwimlabs.net>
parents: 33434
diff changeset
   442
  $_hg_global_opts $_hg_template_opts $_hg_gitlike_opts
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   443
  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit'
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   444
  '(--no-merges -M)'{-M,--no-merges}'[do not show merges]'
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   445
  '(--patch -p)'{-p,--patch}'[show patch]'
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   446
  '--stat[output diffstat-style summary of changes]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   447
  '(--graph -G)'{-G,--graph}'[show the revision DAG]'
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   448
)
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   449
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   450
_hg_commit_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   451
  '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   452
  '(-e --edit -l --logfile --message -m)'{-m+,--message=}'[use <text> as commit message]:message'
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   453
  '(-e --edit -m --message --logfile -l)'{-l+,--logfile=}'[read the commit message from <file>]:log file:_files')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   454
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   455
_hg_remote_opts=(
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   456
  '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:command'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   457
  '--remotecmd=[specify hg command to run on the remote side]:remote command'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   458
  '--insecure[do not verify server certificate (ignoring web.cacerts config)]'
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   459
)
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   460
40334
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   461
_hg_clone_opts=(
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   462
  $_hg_remote_opts
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   463
  '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]'
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   464
  '--pull[use pull protocol to copy metadata]'
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   465
  '--stream[clone with minimal data processing]'
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   466
)
4c9418e3a7d3 zsh_completion: use $_hg_remote_opts after it is defined
Anton Shestakov <av6@dwimlabs.net>
parents: 39669
diff changeset
   467
17399
dbff625679a1 zsh completion: add subrepos options for all supporting commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17398
diff changeset
   468
_hg_subrepos_opts=(
dbff625679a1 zsh completion: add subrepos options for all supporting commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17398
diff changeset
   469
  '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]')
dbff625679a1 zsh completion: add subrepos options for all supporting commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17398
diff changeset
   470
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   471
_hg_cmd() {
11646
91af149b5cd7 bash/zsh completion: use HGPLAIN when invoking hg (issue2297)
Brodie Rao <brodie@bitheap.org>
parents: 10456
diff changeset
   472
  _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   473
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   474
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   475
_hg_cmd_add() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   476
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   477
  '*:unknown files:_hg_unknown'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   478
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   479
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   480
_hg_cmd_addremove() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
   481
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   482
  '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   483
  '*:unknown or missing files:_hg_addremove'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   484
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   485
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   486
_hg_cmd_annotate() {
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   487
  _arguments -s -S : $_hg_global_opts $_hg_ignore_space_opts $_hg_pat_opts \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   488
  '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_labels' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   489
  "--no-follow[don't follow copies and renames]" \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   490
  '(--text -a)'{-a,--text}'[treat all files as text]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   491
  '(--user -u)'{-u,--user}'[list the author (long with -v)]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   492
  '(--file -f)'{-f,--file}'[list the filename]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   493
  '(--date -d)'{-d,--date}'[list the date (short with -q)]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   494
  '(--number -n)'{-n,--number}'[list the revision number (default)]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   495
  '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   496
  '(--line-number -l)'{-l,--line-number}'[show line number at the first appearance]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   497
  '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   498
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   499
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   500
_hg_cmd_archive() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   501
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   502
  '--no-decode[do not pass files through decoders]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   503
  '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   504
  '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_labels' \
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   505
  '(--type -t)'{-t+,--type=}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   506
  '*:destination:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   507
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   508
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   509
_hg_cmd_backout() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   510
  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   511
    '--merge[merge with old dirstate parent after backout]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   512
    '--no-commit[do not commit]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   513
    '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   514
    '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   515
    '(--rev -r 1)'{-r+,--rev=}'[revision to backout]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   516
    '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   517
    '(--logfile -l)'{-l+,--logfile=}'[read commit message from <file>]:log file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   518
    ':revision:_hg_labels'
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   519
}
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   520
8986
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   521
_hg_cmd_bisect() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   522
  _arguments -s -S : $_hg_global_opts \
8986
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   523
  '(-)'{-r,--reset}'[reset bisect state]' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   524
  '(--extend -e)'{-e,--extend}'[extend the bisect range]' \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   525
  '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   526
  '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
8986
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   527
  '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   528
  '(--command -c --noupdate -U)'{-c+,--command=}'[use command to check changeset state]':commands:_command_names \
8986
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   529
  '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   530
}
7f349588665f zsh completion: update bisect for builtin syntax
Brendan Cully <brendan@kublai.com>
parents: 8985
diff changeset
   531
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   532
_hg_cmd_bookmarks() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   533
  _arguments -s -S : $_hg_global_opts \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   534
  '(--force -f)'{-f,--force}'[force]' \
40336
d365e2b7aa2a zsh_completion: add -l/--list flag for hg bookmarks completion
Anton Shestakov <av6@dwimlabs.net>
parents: 40335
diff changeset
   535
  '(--inactive -i --delete -d --list -l)'{-i,--inactive}'[mark a bookmark inactive]' \
d365e2b7aa2a zsh_completion: add -l/--list flag for hg bookmarks completion
Anton Shestakov <av6@dwimlabs.net>
parents: 40335
diff changeset
   536
  '(--rev -r --delete -d --rename -m --list -l)'{-r+,--rev=}'[revision]:revision:_hg_labels' \
d365e2b7aa2a zsh_completion: add -l/--list flag for hg bookmarks completion
Anton Shestakov <av6@dwimlabs.net>
parents: 40335
diff changeset
   537
  '(--rev -r --delete -d --rename -m --list -l --inactive -i)'{-d,--delete}'[delete a given bookmark]' \
d365e2b7aa2a zsh_completion: add -l/--list flag for hg bookmarks completion
Anton Shestakov <av6@dwimlabs.net>
parents: 40335
diff changeset
   538
  '(--rev -r --delete -d --rename -m --list -l)'{-m+,--rename=}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
d365e2b7aa2a zsh_completion: add -l/--list flag for hg bookmarks completion
Anton Shestakov <av6@dwimlabs.net>
parents: 40335
diff changeset
   539
  '(--inactive -i --delete -d --list -l)'{-l,--list}'[list existing bookmarks]' \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   540
  ':bookmark:_hg_bookmarks'
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   541
}
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   542
8985
a04c1ab282fe zsh completion: add hg branch
Brendan Cully <brendan@kublai.com>
parents: 8984
diff changeset
   543
_hg_cmd_branch() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   544
  _arguments -s -S : $_hg_global_opts \
8985
a04c1ab282fe zsh completion: add hg branch
Brendan Cully <brendan@kublai.com>
parents: 8984
diff changeset
   545
  '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
a04c1ab282fe zsh completion: add hg branch
Brendan Cully <brendan@kublai.com>
parents: 8984
diff changeset
   546
  '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
a04c1ab282fe zsh completion: add hg branch
Brendan Cully <brendan@kublai.com>
parents: 8984
diff changeset
   547
}
a04c1ab282fe zsh completion: add hg branch
Brendan Cully <brendan@kublai.com>
parents: 8984
diff changeset
   548
8984
67389a94825a zsh completion: add hg branches
Brendan Cully <brendan@kublai.com>
parents: 8983
diff changeset
   549
_hg_cmd_branches() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   550
  _arguments -s -S : $_hg_global_opts \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   551
  '(--closed -c)'{-c,--closed}'[show normal and closed branches]'
8984
67389a94825a zsh completion: add hg branches
Brendan Cully <brendan@kublai.com>
parents: 8983
diff changeset
   552
}
67389a94825a zsh completion: add hg branches
Brendan Cully <brendan@kublai.com>
parents: 8983
diff changeset
   553
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   554
_hg_cmd_bundle() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   555
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   556
  '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \
40335
01bdf7294274 zsh_completion: fix a couple of flags still not being perfect
Anton Shestakov <av6@dwimlabs.net>
parents: 40334
diff changeset
   557
  '(2)*--base=[a base changeset assumed to be available at the destination]:revision:_hg_labels' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   558
  '*'{-b+,--branch=}'[a specific branch you would like to bundle]:branch:_hg_branches' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   559
  '*'{-r+,--rev=}'[a changeset intended to be added to the destination]:revision:_hg_labels' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   560
  '(--all -a)'{-a,--all}'[bundle all changesets in the repository]' \
40335
01bdf7294274 zsh_completion: fix a couple of flags still not being perfect
Anton Shestakov <av6@dwimlabs.net>
parents: 40334
diff changeset
   561
  '(--type -t)'{-t+,--type=}'[bundle compression type to use (default: bzip2)]:bundle type' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   562
  ':output file:_files' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   563
  ':destination repository:_files -/'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   564
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   565
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   566
_hg_cmd_cat() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   567
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   568
  '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   569
  '(--rev -r)'{-r+,--rev=}'[print the given revision]:revision:_hg_labels' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   570
  '--decode[apply any matching decode filter]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   571
  '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   572
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   573
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   574
_hg_cmd_clone() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   575
  _arguments -s -S : $_hg_global_opts $_hg_clone_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   576
  '*'{-r+,--rev=}'[do not clone everything, but include this changeset and its ancestors]:revision' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   577
  '(--updaterev -u)'{-u+,--updaterev=}'[revision, tag, or branch to check out]:revision' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   578
  '*'{-b+,--branch=}"[do not clone everything, but include this branch's changesets and their ancestors]:branch" \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   579
  ':source repository:_hg_remote' \
3601
cedf056bb723 zsh: support remote cloning
Brendan Cully <brendan@kublai.com>
parents: 3600
diff changeset
   580
  ':destination:_hg_clone_dest'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   581
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   582
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   583
_hg_cmd_commit() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   584
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
3666
adbf440a81e0 zsh: typo in commit completion
Brendan Cully <brendan@kublai.com>
parents: 3605
diff changeset
   585
  '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   586
  '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   587
  '(--logfile -l)'{-l+,--logfile=}'[read commit message from <file>]:log file:_files' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   588
  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   589
  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   590
  '--amend[amend the parent of the working directory]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   591
  '--close-branch[mark a branch head as closed]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   592
  '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   593
  '(--secret -s)'{-s,--secret}'[use the secret phase for committing]' \
39204
8ff14f8fe2d3 zsh_completion: complete files from `hg st -mar` for commit and diff
Anton Shestakov <av6@dwimlabs.net>
parents: 39203
diff changeset
   594
  '*:file:_hg_committable'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   595
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   596
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   597
_hg_cmd_copy() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   598
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   599
  '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   600
  '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   601
  '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   602
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   603
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   604
_hg_cmd_diff() {
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   605
  local context state state_descr line ret=1
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   606
  typeset -A opt_args
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   607
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   608
  _arguments -s -S : $_hg_global_opts $_hg_diff_opts $_hg_ignore_space_opts \
17399
dbff625679a1 zsh completion: add subrepos options for all supporting commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17398
diff changeset
   609
                     $_hg_pat_opts $_hg_subrepos_opts \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   610
  '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   611
  '--noprefix[omit a/ and b/ prefixes from filenames]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   612
  '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   613
  '(--change -c)'{-c+,--change=}'[change made by revision]:revision:_hg_labels' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   614
  '--reverse[produce a diff that undoes the changes]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   615
  '(--unified -U)'{-U+,--unified=}'[number of lines of context to show]:count' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   616
  '--stat[output diffstat-style summary of changes]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   617
  '--root=[produce diffs relative to subdirectory]:directory:_files -/' \
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   618
  '*:file:->diff_files' && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   619
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   620
  if [[ $state == 'diff_files' ]]
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   621
  then
39394
09f23b4f1be3 zsh_completion: handle --rev as well as -r for diff and revert
Anton Shestakov <av6@dwimlabs.net>
parents: 39377
diff changeset
   622
    if [[ -n ${opt_args[(I)-r|--rev]} ]]
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   623
    then
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   624
      _hg_files && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   625
    else
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   626
      _hg_committable && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   627
    fi
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   628
  fi
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   629
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   630
  return ret
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   631
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   632
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   633
_hg_cmd_export() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   634
  _arguments -s -S : $_hg_global_opts $_hg_diff_opts \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   635
  '(--bookmark -B)'{-B+,--bookmark=}'[export changes only reachable by given bookmark]:bookmark:_hg_bookmarks' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   636
  '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   637
  '--switch-parent[diff against the second parent]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   638
  '*'{-r+,--rev=}'[revisions to export]:revision:_hg_labels' \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   639
  '*:revision:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   640
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   641
39347
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   642
_hg_cmd_files() {
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   643
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   644
  '(--rev -r)'{-r+,--rev=}'[search the repository as it is in revision]:revision:_hg_labels' \
39347
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   645
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   646
  '*:file:_hg_files'
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   647
}
ad1c6bd3c676 zsh_completion: complete hg files
Anton Shestakov <av6@dwimlabs.net>
parents: 39346
diff changeset
   648
17397
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   649
_hg_cmd_forget() {
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   650
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   651
  '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \
17397
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   652
  '*:file:_hg_files'
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   653
}
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   654
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   655
_hg_cmd_graft() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   656
  _arguments -s -S : $_hg_global_opts $_hg_dryrun_opts \
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
   657
                     $_hg_date_user_opts $_hg_mergetool_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   658
  '*'{-r+,--rev=}'[revisions to graft]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   659
  '(--continue -c --abort -a)'{-c,--continue}'[resume interrupted graft]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   660
  '(--continue -c --abort -a)'{-a,--abort}'[abort interrupted graft]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   661
  '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   662
  '--log[append graft info to log message]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   663
  "--no-commit[don't commit, just apply the changes in working directory]" \
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   664
  '(--force -f)'{-f,--force}'[force graft]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   665
  '*:revision:_hg_labels'
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   666
}
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   667
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   668
_hg_cmd_grep() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   669
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   670
  '(--print0 -0)'{-0,--print0}'[end fields with NUL]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   671
  '--diff[print all revisions when the term was introduced or removed]' \
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   672
  '(--text -a)'{-a,--text}'[treat all files as text]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   673
  '(--follow -f)'{-f,--follow}'[follow changeset history, or file history across copies and renames]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   674
  '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   675
  '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revisions that match]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   676
  '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   677
  '*'{-r+,--rev=}'[only search files changed within revision range]:revision:_hg_revrange' \
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   678
  '(--user -u)'{-u,--user}'[list the author (long with -v)]' \
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   679
  '(--date -d)'{-d,--date}'[list the date (short with -q)]' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   680
  '1:search pattern:' \
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   681
  '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   682
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   683
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   684
_hg_cmd_heads() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   685
  _arguments -s -S : $_hg_global_opts $_hg_template_opts \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   686
  '(--topo -t)'{-t,--topo}'[show topological heads only]' \
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   687
  '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   688
  '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of revision]:revision:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   689
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   690
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   691
_hg_cmd_help() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   692
  _arguments -s -S : $_hg_global_opts \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   693
  '(--extension -e)'{-e,--extension}'[show only help for extensions]' \
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   694
  '(--command -c)'{-c,--command}'[show only help for commands]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   695
  '(--keyword -k)'{-k,--keyword}'[show topics matching keyword]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   696
  '*'{-s+,--system=}'[show help for specific platform(s)]:platform:(windows vms plan9 unix)' \
17396
aaaeea31482a zsh completion: complete additional topics for `help`, not commands only
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17004
diff changeset
   697
  '*:mercurial help topic:_hg_help_topics'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   698
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   699
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   700
_hg_cmd_identify() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   701
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   702
  '(--rev -r)'{-r+,--rev=}'[identify the specified revision]:revision:_hg_labels' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   703
  '(--num -n)'{-n,--num}'[show local revision number]' \
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   704
  '(--id -i)'{-i,--id}'[show global revision id]' \
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   705
  '(--branch -b)'{-b,--branch}'[show branch]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   706
  '(--bookmarks -B)'{-B,--bookmarks}'[show bookmarks]' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   707
  '(--tags -t)'{-t,--tags}'[show tags]'
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   708
}
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   709
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   710
_hg_cmd_import() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   711
  _arguments -s -S : $_hg_global_opts $_hg_commit_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   712
  '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   713
  '--bypass[apply patch without touching the working directory]' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   714
  '--no-commit[do not commit, just update the working directory]' \
33434
9212fd003993 zsh_completion: add '--partial' flag to completions for 'import' (issue5618)
Martin Tietze <mtietze@gmx.com>
parents: 30080
diff changeset
   715
  '--partial[commit even if some hunks fail]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   716
  '--exact[abort if patch would apply lossily]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   717
  '--prefix=[apply patch to subdirectory]:directory:_files -/' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   718
  '--import-branch[use any branch information in patch (implied by --exact)]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   719
  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   720
  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   721
  '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   722
  '*:patch:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   723
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   724
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   725
_hg_cmd_incoming() {
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   726
  _arguments -s -S : $_hg_log_opts $_hg_remote_opts $_hg_subrepos_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   727
  '(--force -f)'{-f,--force}'[run even if remote repository is unrelated]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   728
  '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_labels' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   729
  '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   730
  '--bundle=[file to store the bundles into]:bundle file:_files' \
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   731
  '(--bookmarks -B)'{-B,--bookmarks}'[compare bookmarks]' \
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   732
  '*'{-b+,--branch=}'[a specific branch you would like to pull]:branch:_hg_branches' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   733
  ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   734
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   735
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   736
_hg_cmd_init() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   737
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   738
  ':directory:_files -/'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   739
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   740
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   741
_hg_cmd_locate() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   742
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   743
  '(--rev -r)'{-r+,--rev=}'[search the repository as it is in revision]:revision:_hg_labels' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   744
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   745
  '(--fullpath -f)'{-f,--fullpath}'[print complete paths from the filesystem root]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   746
  '*:search pattern:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   747
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   748
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   749
_hg_cmd_log() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   750
  _arguments -s -S : $_hg_log_opts $_hg_pat_opts \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   751
  '(--follow -f)'{-f,--follow}'[follow changeset history, or file history across copies and renames]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   752
  '(--copies -C)'{-C,--copies}'[show copied files]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   753
  '*'{-k+,--keyword=}'[search for a keyword]:keyword' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   754
  '*'{-r+,--rev=}'[show the specified revision or revset]:revision:_hg_revrange' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   755
  '--removed[include revisions where files were removed]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   756
  '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   757
  '*'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   758
  '*'{-b+,--branch=}'[show changesets within the given named branch]:branch:_hg_branches' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   759
  '*'{-u+,--user=}'[revisions committed by user]:user' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   760
  '(--date -d)'{-d+,--date=}'[show revisions matching date spec]:date' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   761
  '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   762
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   763
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   764
_hg_cmd_manifest() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   765
  _arguments -s -S : $_hg_global_opts \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   766
  '--all[list files from all revisions]' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   767
  '(--rev -r)'{-r+,--rev=}'[revision to display]:revision:_hg_labels' \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   768
  ':revision:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   769
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   770
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   771
_hg_cmd_merge() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   772
  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   773
  '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   774
  '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
   775
  '(- :)--abort[abort the ongoing merge]' \
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   776
  ':revision:_hg_mergerevs'
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   777
}
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   778
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   779
_hg_cmd_outgoing() {
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   780
  _arguments -s -S : $_hg_log_opts $_hg_remote_opts $_hg_subrepos_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   781
  '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   782
  '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_revrange' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   783
  '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   784
  '(--bookmarks -B)'{-B,--bookmarks}'[compare bookmarks]' \
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   785
  '*'{-b+,--branch=}'[a specific branch you would like to push]:branch:_hg_branches' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   786
  ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   787
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   788
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   789
_hg_cmd_parents() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   790
  _arguments -s -S : $_hg_global_opts $_hg_template_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   791
  '(--rev -r)'{-r+,--rev=}'[show parents of the specified revision]:revision:_hg_labels' \
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   792
  ':last modified file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   793
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   794
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   795
_hg_cmd_paths() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   796
  _arguments -s -S : $_hg_global_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   797
  ':path:_hg_paths'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   798
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   799
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   800
_hg_cmd_phase() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   801
  _arguments -s -S : $_hg_global_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   802
  '(--public -p --draft -d --secret -s)'{-p,--public}'[set changeset phase to public]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   803
  '(--public -p --draft -d --secret -s)'{-d,--draft}'[set changeset phase to draft]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   804
  '(--public -p --draft -d --secret -s)'{-s,--secret}'[set changeset phase to secret]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   805
  '(--force -f)'{-f,--force}'[allow to move boundary backward]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   806
  '*'{-r+,--rev=}'[target revision]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   807
  '*:revision:_hg_labels'
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   808
}
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   809
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   810
_hg_cmd_pull() {
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   811
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   812
  '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   813
  '(--update -u)'{-u,--update}'[update to new branch head if new descendants were pulled]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   814
  '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_labels' \
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   815
  '*'{-B+,--bookmark=}'[bookmark to pull]:bookmark:_hg_bookmarks' \
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   816
  '*'{-b+,--branch=}'[a specific branch you would like to pull]:branch:_hg_branches' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   817
  ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   818
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   819
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   820
_hg_cmd_push() {
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   821
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   822
  '(--force -f)'{-f,--force}'[force push]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   823
  '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_labels' \
39669
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   824
  '*'{-B+,--bookmark=}'[bookmark to push]:bookmark:_hg_bookmarks' \
3f11cb1aeb90 zsh_completion: add -b/--branch and -B/--bookmark(s) flags properly
Anton Shestakov <av6@dwimlabs.net>
parents: 39574
diff changeset
   825
  '*'{-b+,--branch=}'[a specific branch you would like to push]:branch:_hg_branches' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   826
  '--new-branch[allow pushing a new branch]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   827
  ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   828
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   829
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   830
_hg_cmd_remove() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
   831
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   832
  '(--after -A)'{-A,--after}'[record delete for missing files]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   833
  '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   834
  '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   835
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   836
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   837
_hg_cmd_rename() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   838
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   839
  '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   840
  '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
   841
  '*:file:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   842
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   843
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   844
_hg_cmd_resolve() {
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   845
  local context state state_descr line ret=1
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   846
  typeset -A opt_args
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   847
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   848
  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   849
  '(--all -a)'{-a,--all}'[select all unresolved files]' \
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   850
  '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   851
  '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   852
  '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   853
  '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[mark files as unresolved]:*:resolved files:_hg_resolved' \
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   854
  '*:file:_hg_unresolved' && ret=0
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   855
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   856
  if [[ $state == 'resolve_files' ]]
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   857
  then
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   858
    _alternative 'files:resolved files:_hg_resolved' \
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   859
      'files:unresolved files:_hg_unresolved' && ret=0
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   860
  fi
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   861
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   862
  return ret
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   863
}
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   864
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   865
_hg_cmd_revert() {
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   866
  local context state state_descr line ret=1
7384
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   867
  typeset -A opt_args
62b75d73c33d zsh: support for resolve
Brendan Cully <brendan@kublai.com>
parents: 6804
diff changeset
   868
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   869
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   870
  '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   871
  '(--rev -r)'{-r+,--rev=}'[revert to the specified revision]:revision:_hg_labels' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
   872
  '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   873
  '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   874
  '(--interactive -i)'{-i,--interactive}'[interactively select the changes]' \
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   875
  '*:file:->revert_files' && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   876
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   877
  if [[ $state == 'revert_files' ]]
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   878
  then
39394
09f23b4f1be3 zsh_completion: handle --rev as well as -r for diff and revert
Anton Shestakov <av6@dwimlabs.net>
parents: 39377
diff changeset
   879
    if [[ -n ${opt_args[(I)-r|--rev]} ]]
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   880
    then
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   881
      _hg_files && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   882
    else
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   883
      typeset -a status_files
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   884
      _hg_status mard
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   885
      _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files && ret=0
3587
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   886
    fi
c8494fcc9d39 zsh: tab-complete status results by directory
Brendan Cully <brendan@kublai.com>
parents: 3560
diff changeset
   887
  fi
39205
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   888
69876534caf2 zsh_completion: declare appropriate local parameters for ->string form
Anton Shestakov <av6@dwimlabs.net>
parents: 39204
diff changeset
   889
  return ret
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   890
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   891
17397
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   892
_hg_cmd_rollback() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   893
  _arguments -s -S : $_hg_global_opts $_hg_dryrun_opts \
17397
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   894
  '(--force -f)'{-f,--force}'[ignore safety measures]' \
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   895
}
c785bb3ace29 zsh completion: add `forget` and `rollback` commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17396
diff changeset
   896
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   897
_hg_cmd_serve() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
   898
  _arguments -s -S : $_hg_global_opts $_hg_subrepos_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   899
  '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   900
  '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   901
  '(--daemon -d)'{-d,--daemon}'[run server in background]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   902
  '(--port -p)'{-p+,--port=}'[port to listen on (default: 8000)]:listen port' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   903
  '(--address -a)'{-a+,--address=}'[address to listen on (default: all interfaces)]:interface address' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   904
  '--prefix=[prefix path to serve from (default: server root)]:directory:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   905
  '(--name -n)'{-n+,--name=}'[name to show in web pages (default: working directory)]:repository name' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   906
  '--web-conf=[name of the hgweb config file]:config file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   907
  '--pid-file=[name of file to write process ID to]:pid file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   908
  '--cmdserver[for remote clients]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   909
  '(--templates -t)'{-t+,--templates=}'[web template directory]:template dir:_files -/' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   910
  '--style=[template style to use]:style' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   911
  '--stdio[for remote clients]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   912
  '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   913
  '--certificate=[SSL certificate file]:certificate file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   914
  '--print-url[start and print only the URL]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   915
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   916
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   917
_hg_cmd_showconfig() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   918
  _arguments -s -S : $_hg_global_opts \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   919
  '(--untrusted -u)'{-u,--untrusted}'[show untrusted configuration options]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   920
  '(--edit -e)'{-e,--edit}'[edit user config]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   921
  '(--local -l --global -g)'{-l,--local}'[edit repository config]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   922
  '(--local -l --global -g)'{-g,--global}'[edit global config]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   923
  '*:config item:_hg_config'
5309
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   924
}
e21644bbf01e Updated zsh completion from issue722.
Brendan Cully <brendan@kublai.com>
parents: 4441
diff changeset
   925
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   926
_hg_cmd_status() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   927
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   928
  '(--all -A)'{-A,--all}'[show status of all files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   929
  '(--modified -m)'{-m,--modified}'[show only modified files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   930
  '(--added -a)'{-a,--added}'[show only added files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   931
  '(--removed -r)'{-r,--removed}'[show only removed files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   932
  '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   933
  '(--clean -c)'{-c,--clean}'[show only files without changes]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   934
  '(--unknown -u)'{-u,--unknown}'[show only unknown (not tracked) files]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   935
  '(--ignored -i)'{-i,--ignored}'[show only ignored files]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   936
  '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   937
  '(--copies -C)'{-C,--copies}'[show source of copied files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   938
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   939
  '*--rev=[show difference from revision]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   940
  '--change=[list the changed files of a revision]:revision:_hg_labels' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   941
  '*:files:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   942
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   943
9923
c0b79fdfd214 zsh completion: add summary
Brendan Cully <brendan@kublai.com>
parents: 8986
diff changeset
   944
_hg_cmd_summary() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   945
  _arguments -s -S : $_hg_global_opts \
9923
c0b79fdfd214 zsh completion: add summary
Brendan Cully <brendan@kublai.com>
parents: 8986
diff changeset
   946
  '--remote[check for push and pull]'
c0b79fdfd214 zsh completion: add summary
Brendan Cully <brendan@kublai.com>
parents: 8986
diff changeset
   947
}
c0b79fdfd214 zsh completion: add summary
Brendan Cully <brendan@kublai.com>
parents: 8986
diff changeset
   948
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   949
_hg_cmd_tag() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   950
  _arguments -s -S : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   951
  '(--local -l)'{-l,--local}'[make the tag local]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   952
  '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   953
  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   954
  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
   955
  '(--rev -r)'{-r+,--rev=}'[revision to tag]:revision:_hg_labels' \
17401
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   956
  '(--force -f)'{-f,--force}'[force tag]' \
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   957
  '--remove[remove a tag]' \
a826b1d7f5b2 zsh completion: add new options for existing commands
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17400
diff changeset
   958
  '(--edit -e)'{-e,--edit}'[edit commit message]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   959
  ':tag name:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   960
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   961
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   962
_hg_cmd_tip() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   963
  _arguments -s -S : $_hg_global_opts $_hg_gitlike_opts $_hg_template_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   964
  '(--patch -p)'{-p,--patch}'[show patch]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   965
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   966
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   967
_hg_cmd_unbundle() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   968
  _arguments -s -S : $_hg_global_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
   969
  '(--update -u)'{-u,--update}'[update to new branch head if changesets were unbundled]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   970
  '*:files:_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   971
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   972
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   973
_hg_cmd_update() {
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   974
  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   975
  '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   976
  '(--check -c)'{-c,--check}'[require clean working directory]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   977
  '(--merge -m)'{-m,--merge}'[merge uncommitted changes]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   978
  '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   979
  '(--rev -r 1)'{-r+,--rev=}'[revision]:revision:_hg_labels' \
13511
392b5684d0b4 zsh completion: complete bookmarks where they are accepted
Augie Fackler <durin42@gmail.com>
parents: 12169
diff changeset
   980
  ':revision:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   981
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   982
12169
b62276658844 zsh completion: bookmarks support
Brendan Cully <brendan@kublai.com>
parents: 12168
diff changeset
   983
## extensions ##
b62276658844 zsh completion: bookmarks support
Brendan Cully <brendan@kublai.com>
parents: 12168
diff changeset
   984
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   985
# HGK
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   986
_hg_cmd_view() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
   987
  _arguments -s -S : $_hg_global_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
   988
  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \
18903
5df602551eea zsh_completion: make use of `debuglabelcomplete` command
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 18843
diff changeset
   989
  ':revision range:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   990
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   991
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   992
# MQ
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   993
_hg_qseries() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   994
  typeset -a patches
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
   995
  patches=(${(f)"$(_hg_cmd qseries)"})
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   996
  (( $#patches )) && _describe -t hg-patches 'patches' patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   997
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   998
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   999
_hg_qapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1000
  typeset -a patches
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
  1001
  patches=(${(f)"$(_hg_cmd qapplied)"})
3549
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
  1002
  if (( $#patches ))
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
  1003
  then
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
  1004
    patches+=(qbase qtip)
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
  1005
    _describe -t hg-applied-patches 'applied patches' patches
3dbec3f6d3a2 zsh: add qbase and qtip to qapplied completions
Brendan Cully <brendan@kublai.com>
parents: 3548
diff changeset
  1006
  fi
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1007
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1008
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1009
_hg_qunapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1010
  typeset -a patches
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
  1011
  patches=(${(f)"$(_hg_cmd qunapplied)"})
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1012
  (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1013
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1014
8980
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1015
# unapplied, including guarded patches
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1016
_hg_qdeletable() {
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1017
  typeset -a unapplied
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
  1018
  unapplied=(${(f)"$(_hg_cmd qseries)"})
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
  1019
  for p in $(_hg_cmd qapplied)
8980
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1020
  do
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1021
    unapplied=(${unapplied:#$p})
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1022
  done
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1023
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1024
  (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1025
}
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1026
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1027
_hg_qguards() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1028
  typeset -a guards
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1029
  local guard
3543
fe9c1e886b5e zsh: complete qguard with +/- guard prefixes
Brendan Cully <brendan@kublai.com>
parents: 3541
diff changeset
  1030
  compset -P "+|-"
8983
0701044ad156 zsh completion: basic merge support
Brendan Cully <brendan@kublai.com>
parents: 8982
diff changeset
  1031
  _hg_cmd qselect -s | while read guard
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1032
  do
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1033
    guards+=(${guard#(+|-)})
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1034
  done
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1035
  (( $#guards )) && _describe -t hg-guards 'guards' guards
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1036
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1037
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1038
_hg_qseries_opts=(
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1039
  '(--summary -s)'{-s,--summary}'[print first line of patch header]')
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1040
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1041
_hg_cmd_qapplied() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1042
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1043
  '(--last -1)'{-1,--last}'[show only the preceding applied patch]' \
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1044
  '*:patch:_hg_qapplied'
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1045
}
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1046
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1047
_hg_cmd_qclone() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1048
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_clone_opts \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1049
  '(--patches -p)'{-p+,--patches=}'[location of source patch repository]:' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1050
  ':source repository:_hg_remote' \
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1051
  ':destination:_hg_clone_dest'
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1052
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1053
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1054
_hg_cmd_qdelete() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1055
  _arguments -s -S : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
  1056
  '(--keep -k)'{-k,--keep}'[keep patch file]' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1057
  '*'{-r+,--rev=}'[stop managing a revision]:applied patch:_hg_revrange' \
8980
6d5dca8737b9 zsh completion: include guarded patches in qdelete
Brendan Cully <brendan@kublai.com>
parents: 8961
diff changeset
  1058
  '*:unapplied patch:_hg_qdeletable'
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1059
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1060
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1061
_hg_cmd_qdiff() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1062
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
17398
b290d3b1c1b8 zsh completion: add new option groups for options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17397
diff changeset
  1063
                     $_hg_ignore_space_opts \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
  1064
  '*:pattern:_hg_files'
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1065
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1066
15645
88a82069be4a zsh completion: add support for qfinish
Augie Fackler <durin42@gmail.com>
parents: 15100
diff changeset
  1067
_hg_cmd_qfinish() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1068
  _arguments -s -S : $_hg_global_opts \
16330
a5a3af000e0d zsh completion: fix error in qfinish completions from 88a82069be4a
Augie Fackler <durin42@gmail.com>
parents: 15645
diff changeset
  1069
  '(--applied -a)'{-a,--applied}'[finish all applied patches]' \
15645
88a82069be4a zsh completion: add support for qfinish
Augie Fackler <durin42@gmail.com>
parents: 15100
diff changeset
  1070
  '*:patch:_hg_qapplied'
88a82069be4a zsh completion: add support for qfinish
Augie Fackler <durin42@gmail.com>
parents: 15100
diff changeset
  1071
}
88a82069be4a zsh completion: add support for qfinish
Augie Fackler <durin42@gmail.com>
parents: 15100
diff changeset
  1072
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1073
_hg_cmd_qfold() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
  1074
  _arguments -s -S : $_hg_global_opts $_hg_commit_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1075
  '(--keep -k)'{-k,--keep}'[keep folded patch files]' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1076
  '(--force -f)'{-f,--force}'[overwrite any local changes]' \
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1077
  '--no-backup[do not save backup copies of files]' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1078
  '*:unapplied patch:_hg_qunapplied'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1079
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1080
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
  1081
_hg_cmd_qgoto() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1082
  _arguments -s -S : $_hg_global_opts \
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
  1083
  '(--force -f)'{-f,--force}'[overwrite any local changes]' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1084
  '--keep-changes[tolerate non-conflicting local changes]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
  1085
  '--no-backup[do not save backup copies of files]' \
5868
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
  1086
  ':patch:_hg_qseries'
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
  1087
}
838fa52abcc1 [PATCH] zsh_completion tag/mq fixes
Nicholas Riley <njriley@uiuc.edu>
parents: 5309
diff changeset
  1088
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1089
_hg_cmd_qguard() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1090
  _arguments -s -S : $_hg_global_opts \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1091
  '(--list -l)'{-l,--list}'[list all patches and guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1092
  '(--none -n)'{-n,--none}'[drop all guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1093
  ':patch:_hg_qseries' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1094
  '*:guards:_hg_qguards'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1095
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
  1096
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1097
_hg_cmd_qheader() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1098
  _arguments -s -S : $_hg_global_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1099
  ':patch:_hg_qseries'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1100
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
  1101
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1102
_hg_cmd_qimport() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1103
  _arguments -s -S : $_hg_global_opts $_hg_gitlike_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1104
  '(--existing -e)'{-e,--existing}'[import file in patch directory]' \
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1105
  '(--name -n 2)'{-n+,--name=}'[name of patch file]:name' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1106
  '(--force -f)'{-f,--force}'[overwrite existing files]' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1107
  '*'{-r+,--rev=}'[place existing revisions under mq control]:revision:_hg_revrange' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1108
  '(--push -P)'{-P,--push}'[qpush after importing]' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1109
  '*:patch:_files'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1110
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1111
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1112
_hg_cmd_qnew() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
  1113
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1114
  ':patch:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1115
}
1368
d1d605d1e839 Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents: 1365
diff changeset
  1116
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1117
_hg_cmd_qnext() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1118
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1119
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1120
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1121
_hg_cmd_qpop() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1122
  _arguments -s -S : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
  1123
  '(--all -a :)'{-a,--all}'[pop all patches]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1124
  '(--force -f)'{-f,--force}'[forget any local changes to patched files]' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1125
  '--keep-changes[tolerate non-conflicting local changes]' \
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1126
  '--no-backup[do not save backup copies of files]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1127
  ':patch:_hg_qapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1128
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
  1129
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1130
_hg_cmd_qprev() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1131
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1132
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1133
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1134
_hg_cmd_qpush() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1135
  _arguments -s -S : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
  1136
  '(--all -a :)'{-a,--all}'[apply all patches]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
  1137
  '(--list -l)'{-l,--list}'[list patch name in commit text]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1138
  '(--force -f)'{-f,--force}'[apply on top of local changes]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1139
  '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \
11760
46039b2af349 zsh completions: add qpush --move option
Yuya Nishihara <yuya@tcha.org>
parents: 11646
diff changeset
  1140
  '--move[reorder patch series and apply only the patch]' \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1141
  '--keep-changes[tolerate non-conflicting local changes]' \
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1142
  '--no-backup[do not save backup copies of files]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1143
  ':patch:_hg_qunapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1144
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
  1145
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1146
_hg_cmd_qrefresh() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
  1147
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1148
  '(--short -s)'{-s,--short}'[refresh only files already in the patch and specified files]' \
3603
ef9c515836ae zsh: compute repository root instead of forking hg
Brendan Cully <brendan@kublai.com>
parents: 3602
diff changeset
  1149
  '*:files:_hg_files'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1150
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
  1151
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1152
_hg_cmd_qrename() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1153
  _arguments -s -S : $_hg_global_opts \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1154
  ':patch:_hg_qunapplied' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1155
  ':destination:'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1156
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1157
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1158
_hg_cmd_qselect() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1159
  _arguments -s -S : $_hg_global_opts \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1160
  '(--none -n :)'{-n,--none}'[disable all guards]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1161
  '(--series -s :)'{-s,--series}'[list all guards in series file]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1162
  '--pop[pop to before first guarded applied patch]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1163
  '--reapply[pop, then reapply patches]' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1164
  '*:guards:_hg_qguards'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1165
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1166
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1167
_hg_cmd_qseries() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1168
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1169
  '(--missing -m)'{-m,--missing}'[print patches not in series]'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1170
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1171
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1172
_hg_cmd_qunapplied() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1173
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \
17402
f6851cd94211 zsh completion: update mq commands completion
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17401
diff changeset
  1174
  '(--first -1)'{-1,--first}'[show only the first patch]'
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1175
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1176
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1177
_hg_cmd_qtop() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1178
  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1179
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
  1180
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1181
_hg_cmd_strip() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1182
  _arguments -s -S : $_hg_global_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1183
  '(--force -f)'{-f,--force}'[force removal of changesets, discard uncommitted changes (no backup)]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1184
  '--no-backup[do not save backup bundle]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1185
  '(--keep -k)'{-k,--keep}'[do not modify working directory during strip]' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1186
  '*'{-B+,--bookmark=}'[remove revisions only reachable from given bookmark]:bookmark:_hg_bookmarks' \
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1187
  '*'{-r+,--rev=}'[strip specified revision]:revision:_hg_labels' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1188
  '*:revision:_hg_labels'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1189
}
3493
1b9494d2b070 zsh: expand tags lazily
Brendan Cully <brendan@kublai.com>
parents: 3487
diff changeset
  1190
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1191
# Patchbomb
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1192
_hg_cmd_email() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1193
  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_gitlike_opts \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1194
  '--plain[omit hg patch header]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1195
  '--body[send patches as inline message text (default)]' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1196
  '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1197
  '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
  1198
  '(--bookmark -B)'{-B+,--bookmark=}'[send changes only reachable by given bookmark]:bookmark:_hg_bookmarks' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1199
  '--bundlename=[name of the bundle attachment file (default: bundle)]:name' \
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1200
  '*'{-r+,--rev=}'[a revision to send]:revision:_hg_revrange' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1201
  '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1202
  '*--base=[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1203
  '--intro[send an introduction email for a single patch]' \
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1204
  '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1205
  '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1206
  '*--bcc=[email addresses of blind carbon copy recipients]:email' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1207
  '*'{-c+,--cc=}'[email addresses of copy recipients]:email' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
  1208
  '--confirm[ask for confirmation before sending]' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1209
  '(--diffstat -d)'{-d,--diffstat}'[add diffstat output to messages]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1210
  '--date=[use the given date as the sending date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1211
  '--desc=[use the given file as the series description]:files:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1212
  '(--from -f)'{-f+,--from=}'[email address of sender]:email' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1213
  '(--test -n)'{-n,--test}'[print messages that would be sent]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1214
  '(--mbox -m)'{-m+,--mbox=}'[write messages to mbox file instead of sending them]:file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1215
  '*--reply-to=[email addresses replies should be sent to]:email' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1216
  '(--subject -s)'{-s+,--subject=}'[subject of first message (intro or single patch)]:subject' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1217
  '--in-reply-to=[message identifier to reply to]:msgid' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1218
  '*--flag=[flags to add in subject prefixes]:flag' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1219
  '*'{-t+,--to=}'[email addresses of recipients]:email' \
12168
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1220
  ':revision:_hg_revrange'
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1221
}
ff4597f521a4 zsh completion: patchbomb support
Brendan Cully <brendan@kublai.com>
parents: 11760
diff changeset
  1222
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1223
# Rebase
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1224
_hg_cmd_rebase() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
  1225
  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts $_hg_dryrun_opts  \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1226
  '*'{-r+,--rev=}'[rebase these revisions]:revision:_hg_revrange' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1227
  '(--source -s --base -b)'{-s+,--source=}'[rebase the specified changeset and descendants]:revision:_hg_labels' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1228
  '(--source -s --base -b)'{-b+,--base=}'[rebase everything from branching point of specified changeset]:revision:_hg_labels' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1229
  '(--dest -d)'{-d+,--dest=}'[rebase onto the specified changeset]:revision:_hg_labels' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1230
  '--collapse[collapse the rebased changesets]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1231
  '(--keep -k)'{-k,--keep}'[keep original changesets]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1232
  '--keepbranches[keep original branch names]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1233
  '(--continue -c --abort -a)'{-c,--continue}'[continue an interrupted rebase]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1234
  '(--continue -c --abort -a)'{-a,--abort}'[abort an interrupted rebase]' \
17004
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1235
}
a1d86396d8c1 zsh completion: catch up with 2.2 commands and options
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 16330
diff changeset
  1236
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1237
# Record
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1238
_hg_cmd_record() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1239
  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_pat_opts \
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1240
                     $_hg_ignore_space_opts $_hg_subrepos_opts \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1241
  '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1242
  '--close-branch[mark a branch as closed, hiding it from the branch list]' \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1243
  '--amend[amend the parent of the working dir]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1244
  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1245
  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user'
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1246
}
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1247
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1248
_hg_cmd_qrecord() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1249
  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts $_hg_gitlike_opts \
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1250
                     $_hg_pat_opts $_hg_ignore_space_opts $_hg_subrepos_opts
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1251
}
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1252
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1253
# Convert
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1254
_hg_cmd_convert() {
39203
fd17590655cf zsh_completion: drop -w, add -S to _arguments
Anton Shestakov <av6@dwimlabs.net>
parents: 39202
diff changeset
  1255
_arguments -s -S : $_hg_global_opts \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1256
  '(--source-type -s)'{-s+,--source-type=}'[source repository type]:type:(hg cvs darcs git svn mtn gnuarch bzr p4)' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1257
  '(--dest-type -d)'{-d+,--dest-type=}'[destination repository type]:type:(hg svn)' \
39573
5f06c21d37de zsh_completion: update various arguments, descriptions, metavariables
Anton Shestakov <av6@dwimlabs.net>
parents: 39444
diff changeset
  1258
  '*'{-r+,--rev=}'[import up to source revision]:revision' \
30080
33e8a5a00007 zsh_completion: update some option usage flags ('+', '=' and ':')
Anton Shestakov <av6@dwimlabs.net>
parents: 23762
diff changeset
  1259
  '(--authormap -A)'{-A+,--authormap=}'[remap usernames using this file]:file:_files' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1260
  '--filemap=[remap file names using contents of file]:file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1261
  '--full[apply filemap changes by converting all files again]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1262
  '--splicemap=[splice synthesized history into place]:file:_files' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1263
  '--branchmap=[change branch names while converting]:file:_files' \
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1264
  '--branchsort[try to sort changesets by branches]' \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1265
  '--datesort[try to sort changesets by date]' \
39208
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1266
  '--sourcesort[preserve source changesets order]' \
362c4603602d zsh_completion: update all options
Anton Shestakov <av6@dwimlabs.net>
parents: 39207
diff changeset
  1267
  '--closesort[try to reorder closed revisions]'
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1268
}
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1269
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1270
# Purge
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1271
_hg_cmd_purge() {
39346
d0dfdf263a20 zsh_completion: adjust usage of common options
Anton Shestakov <av6@dwimlabs.net>
parents: 39208
diff changeset
  1272
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1273
  '(--abort-on-err -a)'{-a,--abort-on-err}'[abort if an error occurs]' \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1274
  '--all[purge ignored files too]' \
39574
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
  1275
  '--dirs[purge empty directories]' \
a2d17b699628 zsh_completion: add new and remove deprecated flags
Anton Shestakov <av6@dwimlabs.net>
parents: 39573
diff changeset
  1276
  '--files[purge files]' \
17400
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1277
  '(--print -p)'{-p,--print}'[print filenames instead of deleting them]' \
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1278
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs (implies -p/--print)]'
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1279
}
3ae4da1c362a zsh completion: add support for convert, graphlog, purge, record extensions
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 17399
diff changeset
  1280
39444
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1281
# Shelve
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1282
_hg_cmd_shelve() {
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1283
  local context state state_descr line ret=1
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1284
  typeset -A opt_args
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1285
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1286
  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1287
  '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before shelving]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1288
  '(--unknown -u)'{-u,--unknown}'[store unknown files in the shelve]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1289
  '(--name -n :)--cleanup[delete all shelved changes]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1290
  '--date=[shelve with the specified commit date]:date' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1291
  '(--delete -d)'{-d,--delete}'[delete the named shelved change(s)]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1292
  '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1293
  '(--list -l)'{-l,--list}'[list current shelves]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1294
  '(--message -m)'{-m+,--message=}'[use text as shelve message]:text' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1295
  '(--name -n)'{-n+,--name=}'[use the given name for the shelved commit]:name' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1296
  '(--patch -p)'{-p,--patch}'[output patches for changes]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1297
  '(--interactive -i)'{-i,--interactive}'[interactive mode, only works while creating a shelve]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1298
  '--stat[output diffstat-style summary of changes]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1299
  '*:file:->shelve_files' && ret=0
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1300
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1301
  if [[ $state == 'shelve_files' ]]
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1302
  then
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1303
    if [[ -n ${opt_args[(I)-d|--delete|-l|--list|-p|--patch|--stat]} ]]
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1304
    then
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1305
      _hg_shelves && ret=0
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1306
    else
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1307
      typeset -a status_files
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1308
      _hg_status mard
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1309
      _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files && ret=0
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1310
    fi
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1311
  fi
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1312
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1313
  return ret
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1314
}
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1315
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1316
_hg_cmd_unshelve() {
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1317
  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1318
  '(--abort -a --continue -c --name -n :)'{-a,--abort}'[abort an incomplete unshelve operation]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1319
  '(--abort -a --continue -c --name -n :)'{-c,--continue}'[continue an incomplete unshelve operation]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1320
  '(--keep -k)'{-k,--keep}'[keep shelve after unshelving]' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1321
  '(--name -n :)'{-n+,--name=}'[restore shelved change with given name]:shelve:_hg_shelves' \
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1322
  ':shelve:_hg_shelves'
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1323
}
45d12c49c3f3 zsh_completion: complete shelve and unshelve
Anton Shestakov <av6@dwimlabs.net>
parents: 39443
diff changeset
  1324
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
  1325
_hg "$@"