##// END OF EJS Templates
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein -
r6192:cd65a67a default
parent child Browse files
Show More
@@ -8,6 +8,7 b''
8 # of the GNU General Public License, incorporated herein by reference.
8 # of the GNU General Public License, incorporated herein by reference.
9
9
10 from mercurial import cmdutil
10 from mercurial import cmdutil
11 from mercurial.commands import templateopts
11 from mercurial.i18n import _
12 from mercurial.i18n import _
12
13
13
14
@@ -35,7 +36,6 b' cmdtable = {'
35 "children":
36 "children":
36 (children,
37 (children,
37 [('r', 'rev', '', _('show children of the specified rev')),
38 [('r', 'rev', '', _('show children of the specified rev')),
38 ('', 'style', '', _('display using template map file')),
39 ] + templateopts,
39 ('', 'template', '', _('display with template'))],
40 _('hg children [-r REV] [FILE]')),
40 _('hg children [-r REV] [FILE]')),
41 }
41 }
@@ -8,6 +8,7 b''
8 import os
8 import os
9 import sys
9 import sys
10 from mercurial.cmdutil import revrange, show_changeset
10 from mercurial.cmdutil import revrange, show_changeset
11 from mercurial.commands import templateopts
11 from mercurial.i18n import _
12 from mercurial.i18n import _
12 from mercurial.node import nullid, nullrev
13 from mercurial.node import nullid, nullrev
13 from mercurial.util import Abort, canonpath
14 from mercurial.util import Abort, canonpath
@@ -320,7 +321,6 b' cmdtable = {'
320 [('l', 'limit', '', _('limit number of changes displayed')),
321 [('l', 'limit', '', _('limit number of changes displayed')),
321 ('p', 'patch', False, _('show patch')),
322 ('p', 'patch', False, _('show patch')),
322 ('r', 'rev', [], _('show the specified revision or range')),
323 ('r', 'rev', [], _('show the specified revision or range')),
323 ('', 'style', '', _('display using template map file')),
324 ] + templateopts,
324 ('', 'template', '', _('display with template'))],
325 _('hg glog [OPTION]... [FILE]')),
325 _('hg glog [OPTION]... [FILE]')),
326 }
326 }
@@ -2772,6 +2772,17 b' commitopts2 = ['
2772 ('u', 'user', '', _('record user as committer')),
2772 ('u', 'user', '', _('record user as committer')),
2773 ]
2773 ]
2774
2774
2775 templateopts = [
2776 ('', 'style', '', _('display using template map file')),
2777 ('', 'template', '', _('display with template')),
2778 ]
2779
2780 logopts = [
2781 ('p', 'patch', None, _('show patch')),
2782 ('l', 'limit', '', _('limit number of changes displayed')),
2783 ('M', 'no-merges', None, _('do not show merges')),
2784 ] + templateopts
2785
2775 table = {
2786 table = {
2776 "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
2787 "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
2777 "addremove":
2788 "addremove":
@@ -2948,9 +2959,8 b' table = {'
2948 _('hg grep [OPTION]... PATTERN [FILE]...')),
2959 _('hg grep [OPTION]... PATTERN [FILE]...')),
2949 "heads":
2960 "heads":
2950 (heads,
2961 (heads,
2951 [('', 'style', '', _('display using template map file')),
2962 [('r', 'rev', '', _('show only heads which are descendants of rev')),
2952 ('r', 'rev', '', _('show only heads which are descendants of rev')),
2963 ] + templateopts,
2953 ('', 'template', '', _('display with template'))],
2954 _('hg heads [-r REV] [REV]...')),
2964 _('hg heads [-r REV] [REV]...')),
2955 "help": (help_, [], _('hg help [COMMAND]')),
2965 "help": (help_, [], _('hg help [COMMAND]')),
2956 "identify|id":
2966 "identify|id":
@@ -2978,17 +2988,12 b' table = {'
2978 _('hg import [OPTION]... PATCH...')),
2988 _('hg import [OPTION]... PATCH...')),
2979 "incoming|in":
2989 "incoming|in":
2980 (incoming,
2990 (incoming,
2981 [('M', 'no-merges', None, _('do not show merges')),
2991 [('f', 'force', None,
2982 ('f', 'force', None,
2983 _('run even when remote repository is unrelated')),
2992 _('run even when remote repository is unrelated')),
2984 ('', 'style', '', _('display using template map file')),
2985 ('n', 'newest-first', None, _('show newest record first')),
2993 ('n', 'newest-first', None, _('show newest record first')),
2986 ('', 'bundle', '', _('file to store the bundles into')),
2994 ('', 'bundle', '', _('file to store the bundles into')),
2987 ('p', 'patch', None, _('show patch')),
2988 ('l', 'limit', '', _('limit number of changes displayed')),
2989 ('r', 'rev', [], _('a specific revision up to which you would like to pull')),
2995 ('r', 'rev', [], _('a specific revision up to which you would like to pull')),
2990 ('', 'template', '', _('display with template')),
2996 ] + logopts + remoteopts,
2991 ] + remoteopts,
2992 _('hg incoming [-p] [-n] [-M] [-f] [-r REV]...'
2997 _('hg incoming [-p] [-n] [-M] [-f] [-r REV]...'
2993 ' [--bundle FILENAME] [SOURCE]')),
2998 ' [--bundle FILENAME] [SOURCE]')),
2994 "^init":
2999 "^init":
@@ -3013,18 +3018,13 b' table = {'
3013 ('d', 'date', '', _('show revs matching date spec')),
3018 ('d', 'date', '', _('show revs matching date spec')),
3014 ('C', 'copies', None, _('show copied files')),
3019 ('C', 'copies', None, _('show copied files')),
3015 ('k', 'keyword', [], _('do case-insensitive search for a keyword')),
3020 ('k', 'keyword', [], _('do case-insensitive search for a keyword')),
3016 ('l', 'limit', '', _('limit number of changes displayed')),
3017 ('r', 'rev', [], _('show the specified revision or range')),
3021 ('r', 'rev', [], _('show the specified revision or range')),
3018 ('', 'removed', None, _('include revs where files were removed')),
3022 ('', 'removed', None, _('include revs where files were removed')),
3019 ('M', 'no-merges', None, _('do not show merges')),
3020 ('', 'style', '', _('display using template map file')),
3021 ('m', 'only-merges', None, _('show only merges')),
3023 ('m', 'only-merges', None, _('show only merges')),
3022 ('b', 'only-branch', [],
3024 ('b', 'only-branch', [],
3023 _('show only changesets within the given named branch')),
3025 _('show only changesets within the given named branch')),
3024 ('p', 'patch', None, _('show patch')),
3025 ('P', 'prune', [], _('do not display revision or any of its ancestors')),
3026 ('P', 'prune', [], _('do not display revision or any of its ancestors')),
3026 ('', 'template', '', _('display with template')),
3027 ] + logopts + walkopts,
3027 ] + walkopts,
3028 _('hg log [OPTION]... [FILE]')),
3028 _('hg log [OPTION]... [FILE]')),
3029 "manifest":
3029 "manifest":
3030 (manifest,
3030 (manifest,
@@ -3038,22 +3038,16 b' table = {'
3038 _('hg merge [-f] [[-r] REV]')),
3038 _('hg merge [-f] [[-r] REV]')),
3039 "outgoing|out":
3039 "outgoing|out":
3040 (outgoing,
3040 (outgoing,
3041 [('M', 'no-merges', None, _('do not show merges')),
3041 [('f', 'force', None,
3042 ('f', 'force', None,
3043 _('run even when remote repository is unrelated')),
3042 _('run even when remote repository is unrelated')),
3044 ('p', 'patch', None, _('show patch')),
3045 ('', 'style', '', _('display using template map file')),
3046 ('l', 'limit', '', _('limit number of changes displayed')),
3047 ('r', 'rev', [], _('a specific revision you would like to push')),
3043 ('r', 'rev', [], _('a specific revision you would like to push')),
3048 ('n', 'newest-first', None, _('show newest record first')),
3044 ('n', 'newest-first', None, _('show newest record first')),
3049 ('', 'template', '', _('display with template')),
3045 ] + logopts + remoteopts,
3050 ] + remoteopts,
3051 _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
3046 _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
3052 "^parents":
3047 "^parents":
3053 (parents,
3048 (parents,
3054 [('r', 'rev', '', _('show parents from the specified rev')),
3049 [('r', 'rev', '', _('show parents from the specified rev')),
3055 ('', 'style', '', _('display using template map file')),
3050 ] + templateopts,
3056 ('', 'template', '', _('display with template'))],
3057 _('hg parents [-r REV] [FILE]')),
3051 _('hg parents [-r REV] [FILE]')),
3058 "paths": (paths, [], _('hg paths [NAME]')),
3052 "paths": (paths, [], _('hg paths [NAME]')),
3059 "^pull":
3053 "^pull":
@@ -3150,9 +3144,8 b' table = {'
3150 "tags": (tags, [], _('hg tags')),
3144 "tags": (tags, [], _('hg tags')),
3151 "tip":
3145 "tip":
3152 (tip,
3146 (tip,
3153 [('', 'style', '', _('display using template map file')),
3147 [('p', 'patch', None, _('show patch')),
3154 ('p', 'patch', None, _('show patch')),
3148 ] + templateopts,
3155 ('', 'template', '', _('display with template'))],
3156 _('hg tip [-p]')),
3149 _('hg tip [-p]')),
3157 "unbundle":
3150 "unbundle":
3158 (unbundle,
3151 (unbundle,
General Comments 0
You need to be logged in to leave comments. Login now