comparison mercurial/commands.py @ 32375:04baab18d60a

commands: move templates of common command options to cmdutil (API) The goal is to get rid of the debugcommands -> commands dependency. Since globalopts is the property of the commands, it's kept in the commands module.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 14 May 2017 16:19:47 +0900
parents 46ba2cdda476
children b16cb0a27377
comparison
equal deleted inserted replaced
32374:194b0f781132 32375:04baab18d60a
102 ('', 'hidden', False, _('consider hidden changesets')), 102 ('', 'hidden', False, _('consider hidden changesets')),
103 ('', 'pager', 'auto', 103 ('', 'pager', 'auto',
104 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')), 104 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
105 ] 105 ]
106 106
107 dryrunopts = [('n', 'dry-run', None, 107 dryrunopts = cmdutil.dryrunopts
108 _('do not perform actions, just print output'))] 108 remoteopts = cmdutil.remoteopts
109 109 walkopts = cmdutil.walkopts
110 remoteopts = [ 110 commitopts = cmdutil.commitopts
111 ('e', 'ssh', '', 111 commitopts2 = cmdutil.commitopts2
112 _('specify ssh command to use'), _('CMD')), 112 formatteropts = cmdutil.formatteropts
113 ('', 'remotecmd', '', 113 templateopts = cmdutil.templateopts
114 _('specify hg command to run on the remote side'), _('CMD')), 114 logopts = cmdutil.logopts
115 ('', 'insecure', None, 115 diffopts = cmdutil.diffopts
116 _('do not verify server certificate (ignoring web.cacerts config)')), 116 diffwsopts = cmdutil.diffwsopts
117 ] 117 diffopts2 = cmdutil.diffopts2
118 118 mergetoolopts = cmdutil.mergetoolopts
119 walkopts = [ 119 similarityopts = cmdutil.similarityopts
120 ('I', 'include', [], 120 subrepoopts = cmdutil.subrepoopts
121 _('include names matching the given patterns'), _('PATTERN')), 121 debugrevlogopts = cmdutil.debugrevlogopts
122 ('X', 'exclude', [],
123 _('exclude names matching the given patterns'), _('PATTERN')),
124 ]
125
126 commitopts = [
127 ('m', 'message', '',
128 _('use text as commit message'), _('TEXT')),
129 ('l', 'logfile', '',
130 _('read commit message from file'), _('FILE')),
131 ]
132
133 commitopts2 = [
134 ('d', 'date', '',
135 _('record the specified date as commit date'), _('DATE')),
136 ('u', 'user', '',
137 _('record the specified user as committer'), _('USER')),
138 ]
139
140 # hidden for now
141 formatteropts = [
142 ('T', 'template', '',
143 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
144 ]
145
146 templateopts = [
147 ('', 'style', '',
148 _('display using template map file (DEPRECATED)'), _('STYLE')),
149 ('T', 'template', '',
150 _('display with template'), _('TEMPLATE')),
151 ]
152
153 logopts = [
154 ('p', 'patch', None, _('show patch')),
155 ('g', 'git', None, _('use git extended diff format')),
156 ('l', 'limit', '',
157 _('limit number of changes displayed'), _('NUM')),
158 ('M', 'no-merges', None, _('do not show merges')),
159 ('', 'stat', None, _('output diffstat-style summary of changes')),
160 ('G', 'graph', None, _("show the revision DAG")),
161 ] + templateopts
162
163 diffopts = [
164 ('a', 'text', None, _('treat all files as text')),
165 ('g', 'git', None, _('use git extended diff format')),
166 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
167 ('', 'nodates', None, _('omit dates from diff headers'))
168 ]
169
170 diffwsopts = [
171 ('w', 'ignore-all-space', None,
172 _('ignore white space when comparing lines')),
173 ('b', 'ignore-space-change', None,
174 _('ignore changes in the amount of white space')),
175 ('B', 'ignore-blank-lines', None,
176 _('ignore changes whose lines are all blank')),
177 ]
178
179 diffopts2 = [
180 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
181 ('p', 'show-function', None, _('show which function each change is in')),
182 ('', 'reverse', None, _('produce a diff that undoes the changes')),
183 ] + diffwsopts + [
184 ('U', 'unified', '',
185 _('number of lines of context to show'), _('NUM')),
186 ('', 'stat', None, _('output diffstat-style summary of changes')),
187 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
188 ]
189
190 mergetoolopts = [
191 ('t', 'tool', '', _('specify merge tool')),
192 ]
193
194 similarityopts = [
195 ('s', 'similarity', '',
196 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
197 ]
198
199 subrepoopts = [
200 ('S', 'subrepos', None,
201 _('recurse into subrepositories'))
202 ]
203
204 debugrevlogopts = [
205 ('c', 'changelog', False, _('open changelog')),
206 ('m', 'manifest', False, _('open manifest')),
207 ('', 'dir', '', _('open directory manifest')),
208 ]
209 122
210 # Commands start here, listed alphabetically 123 # Commands start here, listed alphabetically
211 124
212 @command('^add', 125 @command('^add',
213 walkopts + subrepoopts + dryrunopts, 126 walkopts + subrepoopts + dryrunopts,