comparison mercurial/commands.py @ 3181:725e3d3145d8

factor opts: walk options
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 29 Sep 2006 18:39:32 +0200
parents fca5ddbaa12a
children a73a785ea8e1
comparison
equal deleted inserted replaced
3180:fca5ddbaa12a 3181:725e3d3145d8
2670 ('', 'profile', None, _('print command execution profile')), 2670 ('', 'profile', None, _('print command execution profile')),
2671 ('', 'version', None, _('output version information and exit')), 2671 ('', 'version', None, _('output version information and exit')),
2672 ('h', 'help', None, _('display help and exit')), 2672 ('h', 'help', None, _('display help and exit')),
2673 ] 2673 ]
2674 2674
2675 walkopts = [
2676 ('I', 'include', [], _('include names matching the given patterns')),
2677 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2678 ]
2679
2675 table = { 2680 table = {
2676 "^add": 2681 "^add":
2677 (add, 2682 (add,
2678 [('I', 'include', [], _('include names matching the given patterns')), 2683 walkopts + \
2679 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2684 [('n', 'dry-run', None,
2680 ('n', 'dry-run', None, _('do not perform actions, just print output'))], 2685 _('do not perform actions, just print output'))],
2681 _('hg add [OPTION]... [FILE]...')), 2686 _('hg add [OPTION]... [FILE]...')),
2682 "addremove": 2687 "addremove":
2683 (addremove, 2688 (addremove,
2684 [('I', 'include', [], _('include names matching the given patterns')), 2689 walkopts + \
2685 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2690 [('n', 'dry-run', None,
2686 ('n', 'dry-run', None, 2691 _('do not perform actions, just print output'))],
2687 _('do not perform actions, just print output')), 2692 [('s', 'similarity', '',
2688 ('s', 'similarity', '',
2689 _('guess renamed files by similarity (0<=s<=100)'))], 2693 _('guess renamed files by similarity (0<=s<=100)'))],
2690 _('hg addremove [OPTION]... [FILE]...')), 2694 _('hg addremove [OPTION]... [FILE]...')),
2691 "^annotate": 2695 "^annotate":
2692 (annotate, 2696 (annotate,
2693 [('r', 'rev', '', _('annotate the specified revision')), 2697 [('r', 'rev', '', _('annotate the specified revision')),
2695 ('a', 'text', None, _('treat all files as text')), 2699 ('a', 'text', None, _('treat all files as text')),
2696 ('u', 'user', None, _('list the author')), 2700 ('u', 'user', None, _('list the author')),
2697 ('d', 'date', None, _('list the date')), 2701 ('d', 'date', None, _('list the date')),
2698 ('n', 'number', None, _('list the revision number (default)')), 2702 ('n', 'number', None, _('list the revision number (default)')),
2699 ('c', 'changeset', None, _('list the changeset')), 2703 ('c', 'changeset', None, _('list the changeset')),
2700 ('I', 'include', [], _('include names matching the given patterns')), 2704 ] + walkopts,
2701 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2702 _('hg annotate [-r REV] [-a] [-u] [-d] [-n] [-c] FILE...')), 2705 _('hg annotate [-r REV] [-a] [-u] [-d] [-n] [-c] FILE...')),
2703 "archive": 2706 "archive":
2704 (archive, 2707 (archive,
2705 [('', 'no-decode', None, _('do not pass files through decoders')), 2708 [('', 'no-decode', None, _('do not pass files through decoders')),
2706 ('p', 'prefix', '', _('directory prefix for files in archive')), 2709 ('p', 'prefix', '', _('directory prefix for files in archive')),
2707 ('r', 'rev', '', _('revision to distribute')), 2710 ('r', 'rev', '', _('revision to distribute')),
2708 ('t', 'type', '', _('type of distribution to create')), 2711 ('t', 'type', '', _('type of distribution to create')),
2709 ('I', 'include', [], _('include names matching the given patterns')), 2712 ] + walkopts,
2710 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2711 _('hg archive [OPTION]... DEST')), 2713 _('hg archive [OPTION]... DEST')),
2712 "backout": 2714 "backout":
2713 (backout, 2715 (backout,
2714 [('', 'merge', None, 2716 [('', 'merge', None,
2715 _('merge with old dirstate parent after backout')), 2717 _('merge with old dirstate parent after backout')),
2716 ('m', 'message', '', _('use <text> as commit message')), 2718 ('m', 'message', '', _('use <text> as commit message')),
2717 ('l', 'logfile', '', _('read commit message from <file>')), 2719 ('l', 'logfile', '', _('read commit message from <file>')),
2718 ('d', 'date', '', _('record datecode as commit date')), 2720 ('d', 'date', '', _('record datecode as commit date')),
2719 ('', 'parent', '', _('parent to choose when backing out merge')), 2721 ('', 'parent', '', _('parent to choose when backing out merge')),
2720 ('u', 'user', '', _('record user as committer')), 2722 ('u', 'user', '', _('record user as committer')),
2721 ('I', 'include', [], _('include names matching the given patterns')), 2723 ] + walkopts,
2722 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2723 _('hg backout [OPTION]... REV')), 2724 _('hg backout [OPTION]... REV')),
2724 "bundle": 2725 "bundle":
2725 (bundle, 2726 (bundle,
2726 [('f', 'force', None, 2727 [('f', 'force', None,
2727 _('run even when remote repository is unrelated'))], 2728 _('run even when remote repository is unrelated'))],
2728 _('hg bundle FILE DEST')), 2729 _('hg bundle FILE DEST')),
2729 "cat": 2730 "cat":
2730 (cat, 2731 (cat,
2731 [('o', 'output', '', _('print output to file with formatted name')), 2732 [('o', 'output', '', _('print output to file with formatted name')),
2732 ('r', 'rev', '', _('print the given revision')), 2733 ('r', 'rev', '', _('print the given revision')),
2733 ('I', 'include', [], _('include names matching the given patterns')), 2734 ] + walkopts,
2734 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2735 _('hg cat [OPTION]... FILE...')), 2735 _('hg cat [OPTION]... FILE...')),
2736 "^clone": 2736 "^clone":
2737 (clone, 2737 (clone,
2738 [('U', 'noupdate', None, _('do not update the new working directory')), 2738 [('U', 'noupdate', None, _('do not update the new working directory')),
2739 ('r', 'rev', [], 2739 ('r', 'rev', [],
2751 _('mark new/missing files as added/removed before committing')), 2751 _('mark new/missing files as added/removed before committing')),
2752 ('m', 'message', '', _('use <text> as commit message')), 2752 ('m', 'message', '', _('use <text> as commit message')),
2753 ('l', 'logfile', '', _('read the commit message from <file>')), 2753 ('l', 'logfile', '', _('read the commit message from <file>')),
2754 ('d', 'date', '', _('record datecode as commit date')), 2754 ('d', 'date', '', _('record datecode as commit date')),
2755 ('u', 'user', '', _('record user as commiter')), 2755 ('u', 'user', '', _('record user as commiter')),
2756 ('I', 'include', [], _('include names matching the given patterns')), 2756 ] + walkopts,
2757 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2758 _('hg commit [OPTION]... [FILE]...')), 2757 _('hg commit [OPTION]... [FILE]...')),
2759 "copy|cp": 2758 "copy|cp":
2760 (copy, 2759 (copy,
2761 [('A', 'after', None, _('record a copy that has already occurred')), 2760 [('A', 'after', None, _('record a copy that has already occurred')),
2762 ('f', 'force', None, 2761 ('f', 'force', None,
2763 _('forcibly copy over an existing managed file')), 2762 _('forcibly copy over an existing managed file')),
2764 ('I', 'include', [], _('include names matching the given patterns')),
2765 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2766 ('n', 'dry-run', None, _('do not perform actions, just print output'))], 2763 ('n', 'dry-run', None, _('do not perform actions, just print output'))],
2764 ] + walkopts,
2767 _('hg copy [OPTION]... [SOURCE]... DEST')), 2765 _('hg copy [OPTION]... [SOURCE]... DEST')),
2768 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), 2766 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
2769 "debugcomplete": 2767 "debugcomplete":
2770 (debugcomplete, 2768 (debugcomplete,
2771 [('o', 'options', None, _('show the command options'))], 2769 [('o', 'options', None, _('show the command options'))],
2781 "debugdata": (debugdata, [], _('debugdata FILE REV')), 2779 "debugdata": (debugdata, [], _('debugdata FILE REV')),
2782 "debugindex": (debugindex, [], _('debugindex FILE')), 2780 "debugindex": (debugindex, [], _('debugindex FILE')),
2783 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), 2781 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')),
2784 "debugrename": (debugrename, [], _('debugrename FILE [REV]')), 2782 "debugrename": (debugrename, [], _('debugrename FILE [REV]')),
2785 "debugwalk": 2783 "debugwalk":
2786 (debugwalk, 2784 (debugwalk, walkopts, _('debugwalk [OPTION]... [FILE]...')),
2787 [('I', 'include', [], _('include names matching the given patterns')),
2788 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2789 _('debugwalk [OPTION]... [FILE]...')),
2790 "^diff": 2785 "^diff":
2791 (diff, 2786 (diff,
2792 [('r', 'rev', [], _('revision')), 2787 [('r', 'rev', [], _('revision')),
2793 ('a', 'text', None, _('treat all files as text')), 2788 ('a', 'text', None, _('treat all files as text')),
2794 ('p', 'show-function', None, 2789 ('p', 'show-function', None,
2798 _('ignore white space when comparing lines')), 2793 _('ignore white space when comparing lines')),
2799 ('b', 'ignore-space-change', None, 2794 ('b', 'ignore-space-change', None,
2800 _('ignore changes in the amount of white space')), 2795 _('ignore changes in the amount of white space')),
2801 ('B', 'ignore-blank-lines', None, 2796 ('B', 'ignore-blank-lines', None,
2802 _('ignore changes whose lines are all blank')), 2797 _('ignore changes whose lines are all blank')),
2803 ('I', 'include', [], _('include names matching the given patterns')), 2798 ] + walkopts,
2804 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2805 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), 2799 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
2806 "^export": 2800 "^export":
2807 (export, 2801 (export,
2808 [('o', 'output', '', _('print output to file with formatted name')), 2802 [('o', 'output', '', _('print output to file with formatted name')),
2809 ('a', 'text', None, _('treat all files as text')), 2803 ('a', 'text', None, _('treat all files as text')),
2810 ('g', 'git', None, _('use git extended diff format')), 2804 ('g', 'git', None, _('use git extended diff format')),
2811 ('', 'switch-parent', None, _('diff against the second parent'))], 2805 ('', 'switch-parent', None, _('diff against the second parent'))],
2812 _('hg export [-a] [-o OUTFILESPEC] REV...')), 2806 _('hg export [-a] [-o OUTFILESPEC] REV...')),
2813 "debugforget|forget": 2807 "debugforget|forget":
2814 (forget, 2808 (forget, walkopts, _('hg forget [OPTION]... FILE...')),
2815 [('I', 'include', [], _('include names matching the given patterns')),
2816 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2817 _('hg forget [OPTION]... FILE...')),
2818 "grep": 2809 "grep":
2819 (grep, 2810 (grep,
2820 [('0', 'print0', None, _('end fields with NUL')), 2811 [('0', 'print0', None, _('end fields with NUL')),
2821 ('', 'all', None, _('print all revisions that match')), 2812 ('', 'all', None, _('print all revisions that match')),
2822 ('f', 'follow', None, 2813 ('f', 'follow', None,
2825 ('l', 'files-with-matches', None, 2816 ('l', 'files-with-matches', None,
2826 _('print only filenames and revs that match')), 2817 _('print only filenames and revs that match')),
2827 ('n', 'line-number', None, _('print matching line numbers')), 2818 ('n', 'line-number', None, _('print matching line numbers')),
2828 ('r', 'rev', [], _('search in given revision range')), 2819 ('r', 'rev', [], _('search in given revision range')),
2829 ('u', 'user', None, _('print user who committed change')), 2820 ('u', 'user', None, _('print user who committed change')),
2830 ('I', 'include', [], _('include names matching the given patterns')), 2821 ] + walkopts,
2831 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2832 _('hg grep [OPTION]... PATTERN [FILE]...')), 2822 _('hg grep [OPTION]... PATTERN [FILE]...')),
2833 "heads": 2823 "heads":
2834 (heads, 2824 (heads,
2835 [('b', 'branches', None, _('show branches')), 2825 [('b', 'branches', None, _('show branches')),
2836 ('', 'style', '', _('display using template map file')), 2826 ('', 'style', '', _('display using template map file')),
2875 [('r', 'rev', '', _('search the repository as it stood at rev')), 2865 [('r', 'rev', '', _('search the repository as it stood at rev')),
2876 ('0', 'print0', None, 2866 ('0', 'print0', None,
2877 _('end filenames with NUL, for use with xargs')), 2867 _('end filenames with NUL, for use with xargs')),
2878 ('f', 'fullpath', None, 2868 ('f', 'fullpath', None,
2879 _('print complete paths from the filesystem root')), 2869 _('print complete paths from the filesystem root')),
2880 ('I', 'include', [], _('include names matching the given patterns')), 2870 ] + walkopts,
2881 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2882 _('hg locate [OPTION]... [PATTERN]...')), 2871 _('hg locate [OPTION]... [PATTERN]...')),
2883 "^log|history": 2872 "^log|history":
2884 (log, 2873 (log,
2885 [('b', 'branches', None, _('show branches')), 2874 [('b', 'branches', None, _('show branches')),
2886 ('f', 'follow', None, 2875 ('f', 'follow', None,
2894 ('', 'style', '', _('display using template map file')), 2883 ('', 'style', '', _('display using template map file')),
2895 ('m', 'only-merges', None, _('show only merges')), 2884 ('m', 'only-merges', None, _('show only merges')),
2896 ('p', 'patch', None, _('show patch')), 2885 ('p', 'patch', None, _('show patch')),
2897 ('P', 'prune', [], _('do not display revision or any of its ancestors')), 2886 ('P', 'prune', [], _('do not display revision or any of its ancestors')),
2898 ('', 'template', '', _('display with template')), 2887 ('', 'template', '', _('display with template')),
2899 ('I', 'include', [], _('include names matching the given patterns')), 2888 ] + walkopts,
2900 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2901 _('hg log [OPTION]... [FILE]')), 2889 _('hg log [OPTION]... [FILE]')),
2902 "manifest": (manifest, [], _('hg manifest [REV]')), 2890 "manifest": (manifest, [], _('hg manifest [REV]')),
2903 "merge": 2891 "merge":
2904 (merge, 2892 (merge,
2905 [('b', 'branch', '', _('merge with head of a specific branch')), 2893 [('b', 'branch', '', _('merge with head of a specific branch')),
2957 "recover": (recover, [], _('hg recover')), 2945 "recover": (recover, [], _('hg recover')),
2958 "^remove|rm": 2946 "^remove|rm":
2959 (remove, 2947 (remove,
2960 [('A', 'after', None, _('record remove that has already occurred')), 2948 [('A', 'after', None, _('record remove that has already occurred')),
2961 ('f', 'force', None, _('remove file even if modified')), 2949 ('f', 'force', None, _('remove file even if modified')),
2962 ('I', 'include', [], _('include names matching the given patterns')), 2950 ] + walkopts,
2963 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2964 _('hg remove [OPTION]... FILE...')), 2951 _('hg remove [OPTION]... FILE...')),
2965 "rename|mv": 2952 "rename|mv":
2966 (rename, 2953 (rename,
2967 [('A', 'after', None, _('record a rename that has already occurred')), 2954 [('A', 'after', None, _('record a rename that has already occurred')),
2968 ('f', 'force', None, 2955 ('f', 'force', None,
2969 _('forcibly copy over an existing managed file')), 2956 _('forcibly copy over an existing managed file')),
2970 ('I', 'include', [], _('include names matching the given patterns')),
2971 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2972 ('n', 'dry-run', None, _('do not perform actions, just print output'))], 2957 ('n', 'dry-run', None, _('do not perform actions, just print output'))],
2958 ] + walkopts,
2973 _('hg rename [OPTION]... SOURCE... DEST')), 2959 _('hg rename [OPTION]... SOURCE... DEST')),
2974 "^revert": 2960 "^revert":
2975 (revert, 2961 (revert,
2976 [('a', 'all', None, _('revert all changes when no arguments given')), 2962 [('a', 'all', None, _('revert all changes when no arguments given')),
2977 ('r', 'rev', '', _('revision to revert to')), 2963 ('r', 'rev', '', _('revision to revert to')),
2978 ('', 'no-backup', None, _('do not save backup copies of files')), 2964 ('', 'no-backup', None, _('do not save backup copies of files')),
2979 ('I', 'include', [], _('include names matching given patterns')),
2980 ('X', 'exclude', [], _('exclude names matching given patterns')),
2981 ('n', 'dry-run', None, _('do not perform actions, just print output'))], 2965 ('n', 'dry-run', None, _('do not perform actions, just print output'))],
2966 ] + walkopts,
2982 _('hg revert [-r REV] [NAME]...')), 2967 _('hg revert [-r REV] [NAME]...')),
2983 "rollback": (rollback, [], _('hg rollback')), 2968 "rollback": (rollback, [], _('hg rollback')),
2984 "root": (root, [], _('hg root')), 2969 "root": (root, [], _('hg root')),
2985 "^serve": 2970 "^serve":
2986 (serve, 2971 (serve,
3012 ('i', 'ignored', None, _('show ignored files')), 2997 ('i', 'ignored', None, _('show ignored files')),
3013 ('n', 'no-status', None, _('hide status prefix')), 2998 ('n', 'no-status', None, _('hide status prefix')),
3014 ('C', 'copies', None, _('show source of copied files')), 2999 ('C', 'copies', None, _('show source of copied files')),
3015 ('0', 'print0', None, 3000 ('0', 'print0', None,
3016 _('end filenames with NUL, for use with xargs')), 3001 _('end filenames with NUL, for use with xargs')),
3017 ('I', 'include', [], _('include names matching the given patterns')), 3002 ] + walkopts,
3018 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
3019 _('hg status [OPTION]... [FILE]...')), 3003 _('hg status [OPTION]... [FILE]...')),
3020 "tag": 3004 "tag":
3021 (tag, 3005 (tag,
3022 [('l', 'local', None, _('make the tag local')), 3006 [('l', 'local', None, _('make the tag local')),
3023 ('m', 'message', '', _('message for tag commit log entry')), 3007 ('m', 'message', '', _('message for tag commit log entry')),