##// 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 typeset -A _hg_cmd_globals
159
159
160 _hg_revrange() {
160 _hg_revrange() {
161 compset -P 1 '*:'
161 compset -P 1 '*:'
162 _hg_labels "$@"
163 }
164
165 _hg_labels() {
162 _hg_tags "$@"
166 _hg_tags "$@"
167 _hg_bookmarks "$@"
163 }
168 }
164
169
165 _hg_tags() {
170 _hg_tags() {
@@ -173,6 +178,19 typeset -A _hg_cmd_globals
173 (( $#tags )) && _describe -t tags 'tags' tags
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 # likely merge candidates
194 # likely merge candidates
177 _hg_mergerevs() {
195 _hg_mergerevs() {
178 typeset -a heads
196 typeset -a heads
@@ -393,7 +411,7 typeset -A _hg_cmd_globals
393
411
394 _hg_cmd_annotate() {
412 _hg_cmd_annotate() {
395 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
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 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
415 '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
398 '(--text -a)'{-a,--text}'[treat all files as text]' \
416 '(--text -a)'{-a,--text}'[treat all files as text]' \
399 '(--user -u)'{-u,--user}'[list the author]' \
417 '(--user -u)'{-u,--user}'[list the author]' \
@@ -407,7 +425,7 typeset -A _hg_cmd_globals
407 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
425 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
408 '--no-decode[do not pass files through decoders]' \
426 '--no-decode[do not pass files through decoders]' \
409 '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
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 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
429 '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
412 '*:destination:_files'
430 '*:destination:_files'
413 }
431 }
@@ -418,7 +436,7 typeset -A _hg_cmd_globals
418 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
436 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
419 '--parent[parent to choose when backing out merge]' \
437 '--parent[parent to choose when backing out merge]' \
420 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
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 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
440 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
423 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
441 '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
424 }
442 }
@@ -426,13 +444,22 typeset -A _hg_cmd_globals
426 _hg_cmd_bisect() {
444 _hg_cmd_bisect() {
427 _arguments -s -w : $_hg_global_opts \
445 _arguments -s -w : $_hg_global_opts \
428 '(-)'{-r,--reset}'[reset bisect state]' \
446 '(-)'{-r,--reset}'[reset bisect state]' \
429 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
447 '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_labels \
430 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \
448 '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_labels \
431 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
449 '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
432 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
450 '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
433 '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
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 _hg_cmd_branch() {
463 _hg_cmd_branch() {
437 _arguments -s -w : $_hg_global_opts \
464 _arguments -s -w : $_hg_global_opts \
438 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
465 '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
@@ -447,7 +474,7 typeset -A _hg_cmd_globals
447 _hg_cmd_bundle() {
474 _hg_cmd_bundle() {
448 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
475 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
449 '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
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 ':output file:_files' \
478 ':output file:_files' \
452 ':destination repository:_files -/'
479 ':destination repository:_files -/'
453 }
480 }
@@ -455,7 +482,7 typeset -A _hg_cmd_globals
455 _hg_cmd_cat() {
482 _hg_cmd_cat() {
456 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
483 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
457 '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
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 '*:file:_hg_files'
486 '*:file:_hg_files'
460 }
487 }
461
488
@@ -510,7 +537,7 typeset -A _hg_cmd_globals
510 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
537 _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
511 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
538 '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
512 '--switch-parent[diff against the second parent]' \
539 '--switch-parent[diff against the second parent]' \
513 '*:revision:_hg_tags'
540 '*:revision:_hg_labels'
514 }
541 }
515
542
516 _hg_cmd_grep() {
543 _hg_cmd_grep() {
@@ -529,7 +556,7 typeset -A _hg_cmd_globals
529
556
530 _hg_cmd_heads() {
557 _hg_cmd_heads() {
531 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
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 _hg_cmd_help() {
562 _hg_cmd_help() {
@@ -539,7 +566,7 typeset -A _hg_cmd_globals
539
566
540 _hg_cmd_identify() {
567 _hg_cmd_identify() {
541 _arguments -s -w : $_hg_global_opts \
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 '(--num -n)'{-n+,--num}'[show local revision number]' \
570 '(--num -n)'{-n+,--num}'[show local revision number]' \
544 '(--id -i)'{-i+,--id}'[show global revision id]' \
571 '(--id -i)'{-i+,--id}'[show global revision id]' \
545 '(--branch -b)'{-b+,--branch}'[show branch]' \
572 '(--branch -b)'{-b+,--branch}'[show branch]' \
@@ -572,7 +599,7 typeset -A _hg_cmd_globals
572
599
573 _hg_cmd_locate() {
600 _hg_cmd_locate() {
574 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
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 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
603 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
577 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
604 '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
578 '*:search pattern:_hg_files'
605 '*:search pattern:_hg_files'
@@ -589,13 +616,13 typeset -A _hg_cmd_globals
589 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
616 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
590 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
617 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
591 '(--patch -p)'{-p,--patch}'[show patch]' \
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 '*:files:_hg_files'
620 '*:files:_hg_files'
594 }
621 }
595
622
596 _hg_cmd_manifest() {
623 _hg_cmd_manifest() {
597 _arguments -s -w : $_hg_global_opts \
624 _arguments -s -w : $_hg_global_opts \
598 ':revision:_hg_tags'
625 ':revision:_hg_labels'
599 }
626 }
600
627
601 _hg_cmd_merge() {
628 _hg_cmd_merge() {
@@ -618,7 +645,7 typeset -A _hg_cmd_globals
618
645
619 _hg_cmd_parents() {
646 _hg_cmd_parents() {
620 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
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 ':last modified file:_hg_files'
649 ':last modified file:_hg_files'
623 }
650 }
624
651
@@ -638,7 +665,7 typeset -A _hg_cmd_globals
638 _hg_cmd_push() {
665 _hg_cmd_push() {
639 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
666 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
640 '(--force -f)'{-f,--force}'[force push]' \
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 ':destination:_hg_remote'
669 ':destination:_hg_remote'
643 }
670 }
644
671
@@ -679,7 +706,7 typeset -A _hg_cmd_globals
679
706
680 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
707 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
681 '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
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 '--no-backup[do not save backup copies of files]' \
710 '--no-backup[do not save backup copies of files]' \
684 '*:file:->diff_files'
711 '*:file:->diff_files'
685
712
@@ -729,7 +756,7 typeset -A _hg_cmd_globals
729 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
756 '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
730 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
757 '(--copies -C)'{-C,--copies}'[show source of copied files]' \
731 '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
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 '*:files:_files'
760 '*:files:_files'
734 }
761 }
735
762
@@ -744,7 +771,7 typeset -A _hg_cmd_globals
744 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
771 '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
745 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
772 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
746 '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
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 ':tag name:'
775 ':tag name:'
749 }
776 }
750
777
@@ -762,35 +789,12 typeset -A _hg_cmd_globals
762 _hg_cmd_update() {
789 _hg_cmd_update() {
763 _arguments -s -w : $_hg_global_opts \
790 _arguments -s -w : $_hg_global_opts \
764 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
791 '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
765 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
792 '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_labels' \
766 ':revision:_hg_tags'
793 ':revision:_hg_labels'
767 }
794 }
768
795
769 ## extensions ##
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 # HGK
798 # HGK
795 _hg_cmd_view() {
799 _hg_cmd_view() {
796 _arguments -s -w : $_hg_global_opts \
800 _arguments -s -w : $_hg_global_opts \
@@ -970,7 +974,7 typeset -A _hg_cmd_globals
970 '(--force -f)'{-f,--force}'[force multi-head removal]' \
974 '(--force -f)'{-f,--force}'[force multi-head removal]' \
971 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
975 '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
972 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
976 '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
973 ':revision:_hg_tags'
977 ':revision:_hg_labels'
974 }
978 }
975
979
976 # Patchbomb
980 # Patchbomb
@@ -983,7 +987,7 typeset -A _hg_cmd_globals
983 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
987 '--bundlename[name of the bundle attachment file (default: bundle)]:' \
984 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
988 '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
985 '--force[run even when remote repository is unrelated (with -b/--bundle)]' \
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 '--intro[send an introduction email for a single patch]' \
991 '--intro[send an introduction email for a single patch]' \
988 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
992 '(--inline -i --attach -a)'{-a,--attach}'[send patches as attachments]' \
989 '(--attach -a --inline -i)'{-i,--inline}'[send patches as inline attachments]' \
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