[PATCH] zsh completion: catch up with 2.2 commands and options

Nikolaj Sjujskij sterkrig at myopera.com
Wed Jun 20 08:43:54 CDT 2012


# HG changeset patch
# User Nikolaj Sjujskij <sterkrig at myopera.com>
# Date 1340199619 -14400
# Node ID 3f301301994f09d8108929de1ed4845ce7792630
# Parent  132ea1736751cb02b16992cf421e7de8bad888a1
zsh completion: catch up with 2.2 commands and options

 * add completion for phase and graft core commands
 * add completion for rebase extension
 * add new options for already defined commands:
   * commit --amend
   * import --bypass
   * manifest --all
   * merge --tool
   * revert -C (short for --no-backup)
   * qpush --exact [mq]
   * email --body [patchbomb]

diff --git a/contrib/zsh_completion b/contrib/zsh_completion
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -514,6 +514,7 @@
   '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
   '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
   '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
+  '--amend[amend the parent of the working dir]' \
   '*:file:_hg_files'
 }
 
@@ -552,6 +553,20 @@
   '*:revision:_hg_labels'
 }
 
+_hg_cmd_graft() {
+  _arguments -s -w : $_hg_global_opts \
+  '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \
+  '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
+  '--log[append graft info to log message]' \
+  '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' \
+  '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' \
+  '(--date -d)'{-d,--date}'[record the specified date as commit date]' \
+  '(--user -u)'{-u,--user}'[record the specified user as committer]' \
+  '(--tool -t)'{-t,--tool}'[specify merge tool]' \
+  '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]' \
+  '*:revision:_hg_labels'
+}
+
 _hg_cmd_grep() {
   _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
@@ -590,6 +605,7 @@
   '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
   '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
   '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
+  '--bypass[apply patch without touching the working directory]' \
   '*:patch:_files'
 }
 
@@ -635,6 +651,7 @@
 
 _hg_cmd_manifest() {
   _arguments -s -w : $_hg_global_opts \
+  '--all[list files from all revisions]' \
   ':revision:_hg_labels'
 }
 
@@ -643,6 +660,7 @@
   '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
   '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
   '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
+  '(--tool -t)'{-t,--tool}'[specify merge tool]' \
   ':revision:_hg_mergerevs'
 }
 
@@ -667,6 +685,16 @@
   ':path:_hg_paths'
 }
 
+_hg_cmd_phase() {
+  _arguments -s -w : $_hg_global_opts \
+  '(--public -p)'{-p,--public}'[set changeset phase to public]' \
+  '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \
+  '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \
+  '(--force -f)'{-f,--force}'[allow to move boundary backward]' \
+  '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \
+  ':revision:_hg_labels'
+}
+
 _hg_cmd_pull() {
   _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
@@ -720,7 +748,7 @@
   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
-  '--no-backup[do not save backup copies of files]' \
+  '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
   '*:file:->diff_files'
 
   if [[ $state == 'diff_files' ]]
@@ -949,6 +977,7 @@
   '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
   '(--name -n)'{-n+,--name}'[merge queue name]:' \
   '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
+  '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \
   '--move[reorder patch series and apply only the patch]' \
   ':patch:_hg_qunapplied'
 }
@@ -1001,6 +1030,7 @@
   _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
   '(--git -g)'{-g,--git}'[use git extended diff format]' \
   '--plain[omit hg patch header]' \
+  '--body[send patches as inline message text (default)]' \
   '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
   '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \
   '--bundlename[name of the bundle attachment file (default: bundle)]:' \
@@ -1026,4 +1056,22 @@
   ':revision:_hg_revrange'
 }
 
+# Rebase
+_hg_cmd_rebase() {
+  _arguments -s -w : $_hg_global_opts \
+  '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \
+  '(--source -s)'{-s,--source}'[rebase from the specified changeset]:revision:_hg_labels' \
+  '(--base -b)'{-b,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \
+  '(--dest -d)'{-d,--dest}'[rebase onto the specified changeset]' \
+  '--collapse[collapse the rebased changeset]' \
+  '(--message -m)'{-m+,--message}'[use <text> as collapse commit message]:text:' \
+  '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
+  '(--logfile -l)'{-l+,--logfile}'[read collapse commit message from <file>]:log file:_files -g \*.txt' \
+  '--keep[keep original changeset]' \
+  '--keepbranches[keep original branch name]' \
+  '(--tool -t)'{-t,--tool}'[specify merge tool]' \
+  '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \
+  '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \
+}
+
 _hg "$@"


More information about the Mercurial-devel mailing list