contrib/zsh_completion
author Brendan Cully <brendan@kublai.com>
Thu, 26 Oct 2006 09:44:03 -0700
changeset 3548 811e6c95485c
parent 3543 fe9c1e886b5e
child 3549 3dbec3f6d3a2
permissions -rw-r--r--
zsh: use standard tags where possible
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     1
#compdef hg
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
#
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     7
# Copyright (C) 2005 Steve Borho
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
     8
# Copyright (C) 2006 Brendan Cully <brendan@kublai.com>
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
     9
#
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    10
# This is free software; you can redistribute it and/or modify it under
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    11
# the terms of the GNU General Public License as published by the Free
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    12
# Software Foundation; either version 2 of the License, or (at your
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    13
# option) any later version.
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    14
#
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    15
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
    16
local curcontext="$curcontext" state line
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    17
typeset -A _hg_cmd_globals
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    18
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    19
_hg() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    20
  local cmd
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    21
  integer i=2
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    22
  _hg_cmd_globals=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    23
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    24
  while (( i < $#words ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    25
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    26
    case "$words[$i]" in
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    27
      -R|--repository|--cwd|--config)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    28
        # pass along arguments to hg completer
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    29
        _hg_cmd_globals+="$words[$i]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    30
        _hg_cmd_globals+="$words[$i+1]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    31
        (( i += 2 ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    32
        continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    33
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    34
      -R*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    35
        _hg_cmd_globals+="$words[$i]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    36
       (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    37
       continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    38
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    39
      -*)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    40
        # skip option
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    41
        (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    42
        continue
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    43
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    44
    esac
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    45
    if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    46
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    47
      cmd="$words[$i]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    48
      words[$i]=()
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    49
      (( CURRENT-- ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    50
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    51
    (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    52
  done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    53
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    54
  if [[ -z "$cmd" ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    55
  then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    56
    _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    57
    ':mercurial command:_hg_commands'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    58
    return
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    59
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    60
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    61
  # resolve abbreviations and aliases
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    62
  if ! (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    63
  then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    64
    local cmdexp
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    65
    (( $#_hg_cmd_list )) || _hg_get_commands
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    66
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    67
    cmdexp=$_hg_cmd_list[(r)${cmd}*]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    68
    if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    69
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    70
      # might be nice to rewrite the command line with the expansion
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    71
      cmd="$cmdexp"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    72
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    73
    if [[ -n $_hg_alias_list[$cmd] ]]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    74
    then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    75
      cmd=$_hg_alias_list[$cmd]
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    76
    fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    77
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    78
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    79
  if (( $+functions[_hg_cmd_${cmd}] ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    80
  then
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    81
    curcontext="${curcontext%:*:*}:hg-${cmd}:"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    82
    _hg_cmd_${cmd}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    83
    return
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    84
  fi
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    85
}
3497
459e7cd943d4 zsh: complete according to the -R option if specified
Brendan Cully <brendan@kublai.com>
parents: 3496
diff changeset
    86
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    87
_hg_get_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    88
  typeset -ga _hg_cmd_list
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    89
  typeset -gA _hg_alias_list
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    90
  local hline cmd cmdalias
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    91
  _call_program help hg --verbose help | while read -A hline
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    92
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    93
    cmd="$hline[1]"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    94
    case $cmd in
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
        cmd=${cmd%:}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    97
        _hg_cmd_list+=($cmd)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    98
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
    99
      *,)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   100
        cmd=${cmd%,}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   101
        _hg_cmd_list+=($cmd)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   102
        integer i=2
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   103
        while (( i <= $#hline ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   104
        do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   105
          cmdalias=${hline[$i]%(:|,)}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   106
          _hg_cmd_list+=($cmdalias)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   107
          _hg_alias_list+=($cmdalias $cmd)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   108
          (( i++ ))
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   109
        done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   110
      ;;
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   111
    esac
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   112
  done
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   113
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   114
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   115
_hg_commands() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   116
  (( $#_hg_cmd_list )) || _hg_get_commands
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   117
  _describe -t commands 'mercurial command' _hg_cmd_list
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   118
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   119
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   120
_hg_tags() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   121
  typeset -a tags
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   122
  local tag rev
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   123
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   124
  _hg_cmd tags 2> /dev/null | while read tag rev
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   125
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   126
    tags+=($tag)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   127
  done
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   128
  (( $#tags )) && _describe -t tags 'tags' tags
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   129
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   130
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   131
_hg_status() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   132
  status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 .)"})
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   133
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   134
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   135
_hg_unknown() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   136
  typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   137
  _hg_status u
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   138
  (( $#status_files )) && _describe -t files 'unknown files' status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   139
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   140
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   141
_hg_missing() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   142
  typeset -a status_files
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   143
  _hg_status d
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   144
  (( $#status_files )) && _describe -t files 'missing files' status_files
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   145
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   146
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   147
_hg_addremove() {
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   148
  _alternative 'files:unknown files:_hg_unknown' \
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   149
    'files:missing files:_hg_missing'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   150
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   151
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   152
_hg_paths() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   153
  typeset -a paths pnames
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   154
  _hg_cmd paths 2> /dev/null | while read -A pnames
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   155
  do
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   156
    paths+=($pnames[1])
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   157
  done
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   158
  (( $#paths )) && _describe -t urls 'repository aliases' paths
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   159
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   160
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   161
_hg_remote() {
3548
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   162
  _alternative 'urls:repository alias:_hg_paths' \
811e6c95485c zsh: use standard tags where possible
Brendan Cully <brendan@kublai.com>
parents: 3543
diff changeset
   163
    'directories:directory:_files -/'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   164
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   165
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   166
# Common options
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   167
_hg_global_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   168
    '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   169
    '--cwd[change working directory]:new working directory:_files -/'
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   170
    '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   171
    '(--verbose -v)'{-v,--verbose}'[enable additional output]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   172
    '(--quiet -q)'{-q,--quiet}'[suppress output]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   173
    '(--help -h)'{-h,--help}'[display help and exit]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   174
    '--debug[debug mode]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   175
    '--debugger[start debugger]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   176
    '--traceback[print traceback on exception]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   177
    '--time[time how long the command takes]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   178
    '--profile[profile]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   179
    '--version[output version information and exit]'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   180
)
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   181
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   182
_hg_pat_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   183
  '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   184
  '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   185
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   186
_hg_diff_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   187
  '(--text -a)'{-a,--text}'[treat all files as text]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   188
  '(--git -g)'{-g,--git}'[use git extended diff format]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   189
  "--nodates[don't include dates in diff headers]")
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   190
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   191
_hg_dryrun_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   192
  '(--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
   193
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   194
_hg_style_opts=(
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   195
  '--style[display using template map file]:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   196
  '--template[display with template]:')
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   197
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   198
_hg_commit_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   199
  '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   200
  '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   201
  '(-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
   202
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   203
_hg_remote_opts=(
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   204
  '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   205
  '--remotecmd[specify hg command to run on the remote side]:')
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   206
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   207
_hg_cmd() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   208
  _call_program hg hg "$_hg_cmd_globals[@]" "$@"
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   209
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   210
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   211
_hg_cmd_add() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   212
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   213
  '*:unknown files:_hg_unknown'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   214
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   215
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   216
_hg_cmd_addremove() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   217
  _arguments -s -w : $_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
   218
  '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   219
  '*:unknown or missing files:_hg_addremove'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   220
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   221
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   222
_hg_cmd_annotate() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   223
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   224
  '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   225
  '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   226
  '(--text -a)'{-a,--text}'[treat all files as text]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   227
  '(--user -u)'{-u,--user}'[list the author]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   228
  '(--date -d)'{-d,--date}'[list the date]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   229
  '(--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
   230
  '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   231
  '*:files:_files -W $(_hg_cmd root)'
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_cmd_archive() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   235
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   236
  '--no-decode[do not pass files through decoders]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   237
  '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   238
  '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   239
  '(--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
   240
  '*:destination:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   241
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   242
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   243
_hg_cmd_bundle() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   244
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   245
  '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   246
  '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   247
  ':output file:_files' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   248
  ':destination repository:_files -/'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   249
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   250
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   251
_hg_cmd_cat() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   252
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   253
  '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   254
  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   255
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   256
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   257
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   258
_hg_cmd_clone() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   259
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   260
  '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   261
  '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   262
  '--uncompressed[use uncompressed transfer (fast over LAN)]' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   263
  ':source repository:_hg_remote' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   264
  ':destination:_files -/'  
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   265
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   266
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   267
_hg_cmd_commit() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   268
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   269
  '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]'
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   270
  '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   271
  '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_file -g \*.txt' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   272
  '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   273
  '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   274
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   275
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   276
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   277
_hg_cmd_copy() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   278
  _arguments -s -w : $_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
   279
  '(--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
   280
  '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   281
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   282
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   283
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   284
_hg_cmd_diff() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   285
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   286
  '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   287
  '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   288
  '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   289
  '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   290
  '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   291
  '*:file:_files -W $(_hg_cmd root)'
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   292
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   293
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   294
_hg_cmd_export() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   295
  _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   296
  '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   297
  '--switch-parent[diff against the second parent]' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   298
  '*:revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   299
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   300
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   301
_hg_cmd_grep() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   302
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   303
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   304
  '--all[print all revisions with matches]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   305
  '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   306
  '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   307
  '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   308
  '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   309
  '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   310
  '(--user -u)'{-u,--user}'[print user who committed change]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   311
  '*:search pattern:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   312
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   313
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   314
_hg_cmd_heads() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   315
  _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   316
  '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   317
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   318
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   319
_hg_cmd_help() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   320
  _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   321
  '*:mercurial command:_hg_commands'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   322
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   323
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   324
_hg_cmd_import() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   325
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   326
  '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   327
  '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   328
  '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   329
  '*:patch:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   330
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   331
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   332
_hg_cmd_incoming() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   333
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   334
  '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   335
  '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   336
  '(--patch -p)'{-p,--patch}'[show patch]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   337
  '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   338
  '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   339
  '--bundle[file to store the bundles into]:bundle file:_files' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   340
  ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   341
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   342
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   343
_hg_cmd_init() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   344
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   345
  ':dir:_files -/'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   346
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   347
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   348
_hg_cmd_locate() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   349
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   350
  '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   351
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   352
  '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   353
  '*:search pattern:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   354
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   355
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   356
_hg_cmd_log() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   357
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   358
  '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   359
  '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   360
  '(--copies -C)'{-C,--copies}'[show copied files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   361
  '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   362
  '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   363
  '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   364
  '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   365
  '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   366
  '(--patch -p)'{-p,--patch}'[show patch]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   367
  '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   368
  '*:files:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   369
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   370
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   371
_hg_cmd_manifest() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   372
  _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   373
  ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   374
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   375
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   376
_hg_cmd_outgoing() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   377
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   378
  '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   379
  '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   380
  '(--patch -p)'{-p,--patch}'[show patch]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   381
  '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   382
  '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   383
  ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   384
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   385
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   386
_hg_cmd_parents() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   387
  _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   388
  '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   389
  ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   390
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   391
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   392
_hg_cmd_paths() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   393
  _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   394
  ':path:_hg_paths'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   395
}
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   396
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   397
_hg_cmd_pull() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   398
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   399
  '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   400
  '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   401
  ':source:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   402
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   403
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   404
_hg_cmd_push() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   405
  _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   406
  '(--force -f)'{-f,--force}'[force push]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   407
  '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   408
  ':destination:_hg_remote'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   409
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   410
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   411
_hg_cmd_remove() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   412
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   413
  '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   414
  '(--force -f)'{-f,--force}'[remove file even if modified]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   415
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   416
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   417
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   418
_hg_cmd_rename() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   419
  _arguments -s -w : $_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
   420
  '(--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
   421
  '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   422
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   423
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   424
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   425
_hg_cmd_revert() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   426
  _arguments -s -w : $_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
   427
  '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   428
  '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   429
  '--no-backup[do not save backup copies of files]' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   430
  '*:file:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   431
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   432
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   433
_hg_cmd_serve() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   434
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   435
  '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   436
  '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   437
  '(--daemon -d)'{-d,--daemon}'[run server in background]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   438
  '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   439
  '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   440
  '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   441
  '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   442
  '--style[web template style]:style' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   443
  '--stdio[for remote clients]' \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   444
  '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   445
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   446
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   447
_hg_cmd_status() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   448
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   449
  '(--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
   450
  '(--modified -m)'{-m,--modified}'[show only modified files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   451
  '(--added -a)'{-a,--added}'[show only added files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   452
  '(--removed -r)'{-r,--removed}'[show only removed files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   453
  '(--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
   454
  '(--clean -c)'{-c,--clean}'[show only files without changes]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   455
  '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   456
  '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   457
  '(--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
   458
  '(--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
   459
  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   460
  '--rev[show difference from revision]:revision:_hg_tags' \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   461
  '*:files:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   462
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   463
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   464
_hg_cmd_tag() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   465
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   466
  '(--local -l)'{-l,--local}'[make the tag local]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   467
  '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   468
  '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   469
  '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   470
  '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   471
  ':tag name:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   472
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   473
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   474
_hg_cmd_tip() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   475
  _arguments -s -w : $_hg_global_opts $_hg_style_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   476
  '(--patch -p)'{-p,--patch}'[show patch]'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   477
}
1438
c22da894e4cc zsh completions: new -M, -m arguments for log, etc.
Steve Borho <steve@borho.org>
parents: 1368
diff changeset
   478
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   479
_hg_cmd_unbundle() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   480
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   481
  '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   482
  ':files:_files'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   483
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   484
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   485
_hg_cmd_update() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   486
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   487
  '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   488
  '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   489
  ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   490
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   491
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   492
# HGK
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   493
_hg_cmd_view() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   494
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   495
  '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   496
  ':revision range:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   497
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   498
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   499
# MQ
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   500
_hg_qseries() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   501
  typeset -a patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   502
  patches=($(_hg_cmd qseries))
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   503
  (( $#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
   504
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   505
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   506
_hg_qapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   507
  typeset -a patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   508
  patches=($(_hg_cmd qapplied))
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   509
  (( $#patches )) && _describe -t hg-applied-patches 'applied patches' patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   510
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   511
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   512
_hg_qunapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   513
  typeset -a patches
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   514
  patches=($(_hg_cmd qunapplied))
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   515
  (( $#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
   516
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   517
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   518
_hg_qguards() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   519
  typeset -a guards
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   520
  local guard
3543
fe9c1e886b5e zsh: complete qguard with +/- guard prefixes
Brendan Cully <brendan@kublai.com>
parents: 3541
diff changeset
   521
  compset -P "+|-"
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   522
  _hg_cmd qselect -s | while read guard
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   523
  do
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   524
    guards+=(${guard#(+|-)})
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   525
  done
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   526
  (( $#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
   527
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   528
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   529
_hg_qseries_opts=(
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   530
  '(--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
   531
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   532
_hg_cmd_qapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   533
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   534
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   535
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   536
_hg_cmd_qdelete() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   537
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   538
  '(--keep -k)'{-k,--keep}'[keep patch file]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   539
  '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   540
  '*:unapplied patch:_hg_qunapplied'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   541
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   542
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   543
_hg_cmd_qdiff() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   544
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   545
  '*:pattern:_files -W $(_hg_cmd root)'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   546
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   547
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   548
_hg_cmd_qfold() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   549
  _arguments -s -w : $_hg_global_opts $_h_commit_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   550
  '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   551
  '*:unapplied patch:_hg_qunapplied'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   552
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   553
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   554
_hg_cmd_qguard() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   555
  _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   556
  '(--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
   557
  '(--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
   558
  ':patch:_hg_qseries' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   559
  '*:guards:_hg_qguards'
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   560
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   561
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   562
_hg_cmd_qheader() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   563
  _arguments -s -w : $_hg_global_opts \
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   564
  ':patch:_hg_qseries'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   565
}
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
   566
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   567
_hg_cmd_qimport() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   568
  _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   569
  '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   570
  '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   571
  '(--force -f)'{-f,--force}'[overwrite existing files]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   572
  '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   573
  '*:patch:_files'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   574
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   575
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   576
_hg_cmd_qnew() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   577
  _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   578
  '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   579
  ':patch:'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   580
}
1368
d1d605d1e839 Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents: 1365
diff changeset
   581
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   582
_hg_cmd_qnext() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   583
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   584
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   585
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   586
_hg_cmd_qpop() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   587
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   588
  '(--all -a :)'{-a,--all}'[pop all patches]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   589
  '(--name -n)'{-n+,--name}'[queue name to pop]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   590
  '(--force -f)'{-f,--force}'[forget any local changes]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   591
  ':patch:_hg_qapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   592
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   593
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   594
_hg_cmd_qprev() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   595
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   596
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   597
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   598
_hg_cmd_qpush() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   599
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   600
  '(--all -a :)'{-a,--all}'[apply all patches]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   601
  '(--list -l)'{-l,--list}'[list patch name in commit text]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   602
  '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   603
  '(--name -n)'{-n+,--name}'[merge queue name]:' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   604
  '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   605
  ':patch:_hg_qunapplied'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   606
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   607
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   608
_hg_cmd_qrefresh() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   609
  _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   610
  '(--git -g)'{-g,--git}'[use git extended diff format]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   611
  '(--short -s)'{-s,--short}'[short refresh]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   612
  '*:files:_files -W $(_hg_cmd root)'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   613
}
3487
46958e428fcd zsh completion: basic mq support
Brendan Cully <brendan@kublai.com>
parents: 1544
diff changeset
   614
3541
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   615
_hg_cmd_qrename() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   616
  _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   617
  ':patch:_hg_qseries' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   618
  ':destination:'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   619
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   620
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   621
_hg_cmd_qselect() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   622
  _arguments -s -w : $_hg_global_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   623
  '(--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
   624
  '(--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
   625
  '--pop[pop to before first guarded applied patch]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   626
  '--reapply[pop and reapply patches]' \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   627
  '*:guards:_hg_qguards'
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   628
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   629
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   630
_hg_cmd_qseries() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   631
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   632
  '(--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
   633
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   634
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   635
_hg_cmd_qunapplied() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   636
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   637
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   638
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   639
_hg_cmd_qtop() {
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   640
  _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   641
}
ee6b8de6df3c zsh: complete qapplied, qdiff, qfold, qguard, qimport, qnext, qprev
Brendan Cully <brendan@kublai.com>
parents: 3539
diff changeset
   642
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   643
_hg_cmd_strip() {
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   644
  _arguments -s -w : $_hg_global_opts \
3539
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   645
  '(--force -f)'{-f,--force}'[force multi-head removal]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   646
  '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
a6dd7ab568cc zsh: make option lists more compact
Brendan Cully <brendan@kublai.com>
parents: 3537
diff changeset
   647
  '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   648
  ':revision:_hg_tags'
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   649
}
3493
1b9494d2b070 zsh: expand tags lazily
Brendan Cully <brendan@kublai.com>
parents: 3487
diff changeset
   650
3537
060aefba4459 zsh: rewrite
Brendan Cully <brendan@kublai.com>
parents: 3498
diff changeset
   651
_hg "$@"