##// END OF EJS Templates
zsh completion: complete bookmarks where they are accepted...
Augie Fackler -
r13511:392b5684 stable
parent child Browse files
Show More
@@ -159,7 +159,12 b' typeset -A _hg_cmd_globals'
159 159
160 160 _hg_revrange() {
161 161 compset -P 1 '*:'
162 _hg_labels "$@"
163 }
164
165 _hg_labels() {
162 166 _hg_tags "$@"
167 _hg_bookmarks "$@"
163 168 }
164 169
165 170 _hg_tags() {
@@ -173,6 +178,19 b' typeset -A _hg_cmd_globals'
173 178 (( $#tags )) && _describe -t tags 'tags' tags
174 179 }
175 180
181 _hg_bookmarks() {
182 typeset -a bookmark bookmarks
183
184 _hg_cmd bookmarks | while read -A bookmark
185 do
186 if test -z ${bookmark[-1]:#[0-9]*}
187 then
188 bookmarks+=($bookmark[-2])
189 fi
190 done
191 (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
192 }
193
176 194 # likely merge candidates
177 195 _hg_mergerevs() {
178 196 typeset -a heads
@@ -393,7 +411,7 b' typeset -A _hg_cmd_globals'
393 411
394 412 _hg_cmd_annotate() {
395 413 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
396 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
414 '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_labels' \
397 415 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
398 416 '(--text -a)'{-a,--text}'[treat all files as text]' \
399 417 '(--user -u)'{-u,--user}'[list the author]' \
@@ -407,7 +425,7 b' typeset -A _hg_cmd_globals'
407 425 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
408 426 '--no-decode[do not pass files through decoders]' \
409 427 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
410 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
428 '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_labels' \
411 429 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
412 430 '*:destination:_files'
413 431 }
@@ -418,7 +436,7 b' typeset -A _hg_cmd_globals'
418 436 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
419 437 '--parent[parent to choose when backing out merge]' \
420 438 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
421 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
439 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
422 440 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
423 441 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
424 442 }
@@ -426,13 +444,22 b' typeset -A _hg_cmd_globals'
426 444 _hg_cmd_bisect() {
427 445 _arguments -s -w : $_hg_global_opts \
428 446 '(-)'{-r,--reset}'[reset bisect state]' \
429 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
430 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \
447 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
448 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
431 449 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
432 450 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
433 451 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
434 452 }
435 453
454 _hg_cmd_bookmarks() {
455 _arguments -s -w : $_hg_global_opts \
456 '(--force -f)'{-f,--force}'[force]' \
457 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_labels' \
458 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
459 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
460 ':bookmark:_hg_bookmarks'
461 }
462
436 463 _hg_cmd_branch() {
437 464 _arguments -s -w : $_hg_global_opts \
438 465 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
@@ -447,7 +474,7 b' typeset -A _hg_cmd_globals'
447 474 _hg_cmd_bundle() {
448 475 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
449 476 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
450 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
477 '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_labels' \
451 478 ':output file:_files' \
452 479 ':destination repository:_files -/'
453 480 }
@@ -455,7 +482,7 b' typeset -A _hg_cmd_globals'
455 482 _hg_cmd_cat() {
456 483 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
457 484 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
458 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
485 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
459 486 '*:file:_hg_files'
460 487 }
461 488
@@ -510,7 +537,7 b' typeset -A _hg_cmd_globals'
510 537 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
511 538 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
512 539 '--switch-parent[diff against the second parent]' \
513 '*:revision:_hg_tags'
540 '*:revision:_hg_labels'
514 541 }
515 542
516 543 _hg_cmd_grep() {
@@ -529,7 +556,7 b' typeset -A _hg_cmd_globals'
529 556
530 557 _hg_cmd_heads() {
531 558 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
532 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
559 '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_labels'
533 560 }
534 561
535 562 _hg_cmd_help() {
@@ -539,7 +566,7 b' typeset -A _hg_cmd_globals'
539 566
540 567 _hg_cmd_identify() {
541 568 _arguments -s -w : $_hg_global_opts \
542 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_tags' \
569 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
543 570 '(--num -n)'{-n+,--num}'[show local revision number]' \
544 571 '(--id -i)'{-i+,--id}'[show global revision id]' \
545 572 '(--branch -b)'{-b+,--branch}'[show branch]' \
@@ -572,7 +599,7 b' typeset -A _hg_cmd_globals'
572 599
573 600 _hg_cmd_locate() {
574 601 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
575 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
602 '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_labels' \
576 603 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
577 604 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
578 605 '*:search pattern:_hg_files'
@@ -589,13 +616,13 b' typeset -A _hg_cmd_globals'
589 616 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
590 617 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
591 618 '(--patch -p)'{-p,--patch}'[show patch]' \
592 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
619 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
593 620 '*:files:_hg_files'
594 621 }
595 622
596 623 _hg_cmd_manifest() {
597 624 _arguments -s -w : $_hg_global_opts \
598 ':revision:_hg_tags'
625 ':revision:_hg_labels'
599 626 }
600 627
601 628 _hg_cmd_merge() {
@@ -618,7 +645,7 b' typeset -A _hg_cmd_globals'
618 645
619 646 _hg_cmd_parents() {
620 647 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
621 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
648 '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_labels' \
622 649 ':last modified file:_hg_files'
623 650 }
624 651
@@ -638,7 +665,7 b' typeset -A _hg_cmd_globals'
638 665 _hg_cmd_push() {
639 666 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
640 667 '(--force -f)'{-f,--force}'[force push]' \
641 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \
668 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
642 669 ':destination:_hg_remote'
643 670 }
644 671
@@ -679,7 +706,7 b' typeset -A _hg_cmd_globals'
679 706
680 707 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
681 708 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
682 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
709 '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \
683 710 '--no-backup[do not save backup copies of files]' \
684 711 '*:file:->diff_files'
685 712
@@ -729,7 +756,7 b' typeset -A _hg_cmd_globals'
729 756 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
730 757 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
731 758 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
732 '--rev[show difference from revision]:revision:_hg_tags' \
759 '--rev[show difference from revision]:revision:_hg_labels' \
733 760 '*:files:_files'
734 761 }
735 762
@@ -744,7 +771,7 b' typeset -A _hg_cmd_globals'
744 771 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
745 772 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
746 773 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
747 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
774 '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_labels' \
748 775 ':tag name:'
749 776 }
750 777
@@ -762,35 +789,12 b' typeset -A _hg_cmd_globals'
762 789 _hg_cmd_update() {
763 790 _arguments -s -w : $_hg_global_opts \
764 791 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
765 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
766 ':revision:_hg_tags'
792 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
793 ':revision:_hg_labels'
767 794 }
768 795
769 796 ## extensions ##
770 797
771 # bookmarks
772 _hg_bookmarks() {
773 typeset -a bookmark bookmarks
774
775 _hg_cmd bookmarks | while read -A bookmark
776 do
777 if test -z ${bookmark[-1]:#[0-9]*}
778 then
779 bookmarks+=($bookmark[-2])
780 fi
781 done
782 (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
783 }
784
785 _hg_cmd_bookmarks() {
786 _arguments -s -w : $_hg_global_opts \
787 '(--force -f)'{-f,--force}'[force]' \
788 '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_tags' \
789 '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
790 '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
791 ':bookmark:_hg_bookmarks'
792 }
793
794 798 # HGK
795 799 _hg_cmd_view() {
796 800 _arguments -s -w : $_hg_global_opts \
@@ -970,7 +974,7 b' typeset -A _hg_cmd_globals'
970 974 '(--force -f)'{-f,--force}'[force multi-head removal]' \
971 975 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
972 976 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
973 ':revision:_hg_tags'
977 ':revision:_hg_labels'
974 978 }
975 979
976 980 # Patchbomb
@@ -983,7 +987,7 b' typeset -A _hg_cmd_globals'
983 987 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
984 988 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
985 989 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
986 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_tags' \
990 '*--base[a base changeset to specify instead of a destination (with -b/--bundle)]:revision:_hg_labels' \
987 991 '--intro[send an introduction email for a single patch]' \
988 992 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
989 993 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
General Comments 0
You need to be logged in to leave comments. Login now