Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/zsh_completion @ 3536:ef80b13df85a
zsh: add revrange completion
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Thu, 26 Oct 2006 10:06:12 -0700 |
parents | 3dbec3f6d3a2 |
children | 733835602365 |
comparison
equal
deleted
inserted
replaced
3535:3dbec3f6d3a2 | 3536:ef80b13df85a |
---|---|
115 _hg_commands() { | 115 _hg_commands() { |
116 (( $#_hg_cmd_list )) || _hg_get_commands | 116 (( $#_hg_cmd_list )) || _hg_get_commands |
117 _describe -t commands 'mercurial command' _hg_cmd_list | 117 _describe -t commands 'mercurial command' _hg_cmd_list |
118 } | 118 } |
119 | 119 |
120 _hg_revrange() { | |
121 compset -P 1 '*:' | |
122 _hg_tags "$@" | |
123 } | |
124 | |
120 _hg_tags() { | 125 _hg_tags() { |
121 typeset -a tags | 126 typeset -a tags |
122 local tag rev | 127 local tag rev |
123 | 128 |
124 _hg_cmd tags 2> /dev/null | while read tag rev | 129 _hg_cmd tags 2> /dev/null | while read tag rev |
281 '*:file:_files -W $(_hg_cmd root)' | 286 '*:file:_files -W $(_hg_cmd root)' |
282 } | 287 } |
283 | 288 |
284 _hg_cmd_diff() { | 289 _hg_cmd_diff() { |
285 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ | 290 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ |
286 '*'{-r,--rev}'+[revision]:revision:_hg_tags ' \ | 291 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ |
287 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ | 292 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ |
288 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ | 293 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ |
289 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ | 294 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ |
290 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ | 295 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ |
291 '*:file:_files -W $(_hg_cmd root)' | 296 '*:file:_files -W $(_hg_cmd root)' |
304 '--all[print all revisions with matches]' \ | 309 '--all[print all revisions with matches]' \ |
305 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ | 310 '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ |
306 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ | 311 '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ |
307 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ | 312 '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ |
308 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ | 313 '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ |
309 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_tags' \ | 314 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ |
310 '(--user -u)'{-u,--user}'[print user who committed change]' \ | 315 '(--user -u)'{-u,--user}'[print user who committed change]' \ |
311 '*:search pattern:_files -W $(_hg_cmd root)' | 316 '*:search pattern:_files -W $(_hg_cmd root)' |
312 } | 317 } |
313 | 318 |
314 _hg_cmd_heads() { | 319 _hg_cmd_heads() { |
358 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ | 363 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ |
359 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ | 364 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ |
360 '(--copies -C)'{-C,--copies}'[show copied files]' \ | 365 '(--copies -C)'{-C,--copies}'[show copied files]' \ |
361 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ | 366 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ |
362 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | 367 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
363 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_tags' \ | 368 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \ |
364 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ | 369 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ |
365 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ | 370 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ |
366 '(--patch -p)'{-p,--patch}'[show patch]' \ | 371 '(--patch -p)'{-p,--patch}'[show patch]' \ |
367 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ | 372 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ |
368 '*:files:_files -W $(_hg_cmd root)' | 373 '*:files:_files -W $(_hg_cmd root)' |
538 } | 543 } |
539 | 544 |
540 _hg_cmd_qdelete() { | 545 _hg_cmd_qdelete() { |
541 _arguments -s -w : $_hg_global_opts \ | 546 _arguments -s -w : $_hg_global_opts \ |
542 '(--keep -k)'{-k,--keep}'[keep patch file]' \ | 547 '(--keep -k)'{-k,--keep}'[keep patch file]' \ |
543 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_qapplied' \ | 548 '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ |
544 '*:unapplied patch:_hg_qunapplied' | 549 '*:unapplied patch:_hg_qunapplied' |
545 } | 550 } |
546 | 551 |
547 _hg_cmd_qdiff() { | 552 _hg_cmd_qdiff() { |
548 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ | 553 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ |
571 _hg_cmd_qimport() { | 576 _hg_cmd_qimport() { |
572 _arguments -s -w : $_hg_global_opts \ | 577 _arguments -s -w : $_hg_global_opts \ |
573 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ | 578 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ |
574 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ | 579 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ |
575 '(--force -f)'{-f,--force}'[overwrite existing files]' \ | 580 '(--force -f)'{-f,--force}'[overwrite existing files]' \ |
576 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_tags' \ | 581 '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \ |
577 '*:patch:_files' | 582 '*:patch:_files' |
578 } | 583 } |
579 | 584 |
580 _hg_cmd_qnew() { | 585 _hg_cmd_qnew() { |
581 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ | 586 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ |