Merge lp:~jelmer/brz/options-unicode into lp:brz
- options-unicode
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Merged at revision: | 6808 |
Proposed branch: | lp:~jelmer/brz/options-unicode |
Merge into: | lp:brz |
Diff against target: |
418 lines (+68/-52) 9 files modified
breezy/bugtracker.py (+1/-1) breezy/builtins.py (+30/-30) breezy/cmd_version_info.py (+1/-1) breezy/commit_signature_commands.py (+1/-1) breezy/plugins/bash_completion/bashcomp.py (+2/-2) breezy/plugins/fastimport/cmds.py (+13/-13) breezy/plugins/grep/cmds.py (+3/-3) breezy/tests/blackbox/test_commit.py (+14/-1) doc/en/release-notes/brz-3.0.txt (+3/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/options-unicode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+333586@code.launchpad.net |
Commit message
Description of the change
Mark all options as unicode. Allows using non-ASCII values in options that
support it.
To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote : | # |
Looks good with changes made.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/bugtracker.py' |
2 | --- breezy/bugtracker.py 2017-07-30 16:59:50 +0000 |
3 | +++ breezy/bugtracker.py 2017-11-11 20:42:11 +0000 |
4 | @@ -276,7 +276,7 @@ |
5 | |
6 | def _get_bug_url(self, bug_id): |
7 | """Return the URL for bug_id.""" |
8 | - return self.base_url + bug_id |
9 | + return self.base_url + str(bug_id) |
10 | |
11 | |
12 | tracker_registry.register( |
13 | |
14 | === modified file 'breezy/builtins.py' |
15 | --- breezy/builtins.py 2017-10-28 13:11:58 +0000 |
16 | +++ breezy/builtins.py 2017-11-11 20:42:11 +0000 |
17 | @@ -1418,7 +1418,7 @@ |
18 | takes_args = ['from_location', 'to_location?'] |
19 | takes_options = ['revision', |
20 | Option('hardlink', help='Hard-link working tree files where possible.'), |
21 | - Option('files-from', type=str, |
22 | + Option('files-from', type=text_type, |
23 | help="Get file contents from this tree."), |
24 | Option('no-tree', |
25 | help="Create a branch without a working-tree."), |
26 | @@ -1621,7 +1621,7 @@ |
27 | "common operations like diff and status without " |
28 | "such access, and also support local commits." |
29 | ), |
30 | - Option('files-from', type=str, |
31 | + Option('files-from', type=text_type, |
32 | help="Get file contents from this tree."), |
33 | Option('hardlink', |
34 | help='Hard-link working tree files where possible.' |
35 | @@ -2300,9 +2300,9 @@ |
36 | _see_also = ['status'] |
37 | takes_args = ['file*'] |
38 | takes_options = [ |
39 | - Option('diff-options', type=str, |
40 | + Option('diff-options', type=text_type, |
41 | help='Pass these options to the external diff program.'), |
42 | - Option('prefix', type=str, |
43 | + Option('prefix', type=text_type, |
44 | short_name='p', |
45 | help='Set prefixes added to old and new filenames, as ' |
46 | 'two values separated by a colon. (eg "old/:new/").'), |
47 | @@ -2340,15 +2340,15 @@ |
48 | from .diff import (get_trees_and_branches_to_diff_locked, |
49 | show_diff_trees) |
50 | |
51 | - if prefix == '0': |
52 | + if prefix == u'0': |
53 | # diff -p0 format |
54 | old_label = '' |
55 | new_label = '' |
56 | - elif prefix == '1' or prefix is None: |
57 | + elif prefix == u'1' or prefix is None: |
58 | old_label = 'old/' |
59 | new_label = 'new/' |
60 | - elif ':' in prefix: |
61 | - old_label, new_label = prefix.split(":") |
62 | + elif u':' in prefix: |
63 | + old_label, new_label = prefix.split(u":") |
64 | else: |
65 | raise errors.BzrCommandError(gettext( |
66 | '--prefix expects two values separated by a colon' |
67 | @@ -2670,7 +2670,7 @@ |
68 | Option('message', |
69 | help='Show revisions whose message matches this ' |
70 | 'regular expression.', |
71 | - type=str, |
72 | + type=text_type, |
73 | hidden=True), |
74 | Option('limit', |
75 | short_name='l', |
76 | @@ -2696,23 +2696,23 @@ |
77 | short_name='m', |
78 | help='Show revisions whose properties match this ' |
79 | 'expression.', |
80 | - type=str), |
81 | + type=text_type), |
82 | ListOption('match-message', |
83 | help='Show revisions whose message matches this ' |
84 | 'expression.', |
85 | - type=str), |
86 | + type=text_type), |
87 | ListOption('match-committer', |
88 | help='Show revisions whose committer matches this ' |
89 | 'expression.', |
90 | - type=str), |
91 | + type=text_type), |
92 | ListOption('match-author', |
93 | help='Show revisions whose authors match this ' |
94 | 'expression.', |
95 | - type=str), |
96 | + type=text_type), |
97 | ListOption('match-bugs', |
98 | help='Show revisions whose bugs match this ' |
99 | 'expression.', |
100 | - type=str) |
101 | + type=text_type) |
102 | ] |
103 | encoding_type = 'replace' |
104 | |
105 | @@ -3301,7 +3301,7 @@ |
106 | Option('filters', help='Apply content filters to export the ' |
107 | 'convenient form.'), |
108 | Option('root', |
109 | - type=str, |
110 | + type=text_type, |
111 | help="Name of the root directory inside the exported file."), |
112 | Option('per-file-timestamps', |
113 | help='Set modification time of files to that of the last ' |
114 | @@ -3480,7 +3480,7 @@ |
115 | _see_also = ['add', 'bugs', 'hooks', 'uncommit'] |
116 | takes_args = ['selected*'] |
117 | takes_options = [ |
118 | - ListOption('exclude', type=str, short_name='x', |
119 | + ListOption('exclude', type=text_type, short_name='x', |
120 | help="Do not consider changes made to a given path."), |
121 | Option('message', type=text_type, |
122 | short_name='m', |
123 | @@ -3488,17 +3488,17 @@ |
124 | 'verbose', |
125 | Option('unchanged', |
126 | help='Commit even if nothing has changed.'), |
127 | - Option('file', type=str, |
128 | + Option('file', type=text_type, |
129 | short_name='F', |
130 | argname='msgfile', |
131 | help='Take commit message from this file.'), |
132 | Option('strict', |
133 | help="Refuse to commit if there are unknown " |
134 | "files in the working tree."), |
135 | - Option('commit-time', type=str, |
136 | + Option('commit-time', type=text_type, |
137 | help="Manually set a commit time using commit date " |
138 | "format, e.g. '2009-10-10 08:00:00 +0100'."), |
139 | - ListOption('fixes', type=str, |
140 | + ListOption('fixes', type=text_type, |
141 | help="Mark a bug as being fixed by this revision " |
142 | "(see \"brz help bugs\")."), |
143 | ListOption('author', type=text_type, |
144 | @@ -3553,7 +3553,7 @@ |
145 | 'Unrecognized bug %s. Commit refused.') % fixed_bug) |
146 | except bugtracker.MalformedBugIdentifier as e: |
147 | raise errors.BzrCommandError(gettext( |
148 | - "%s\nCommit refused.") % (str(e),)) |
149 | + u"%s\nCommit refused.") % (e,)) |
150 | |
151 | def run(self, message=None, file=None, verbose=False, selected_list=None, |
152 | unchanged=False, strict=False, local=False, fixes=None, |
153 | @@ -4075,10 +4075,10 @@ |
154 | lazy_registry=('breezy.tests', 'parallel_registry'), |
155 | value_switches=False, |
156 | ), |
157 | - Option('randomize', type=str, argname="SEED", |
158 | + Option('randomize', type=text_type, argname="SEED", |
159 | help='Randomize the order of tests using the given' |
160 | ' seed or "now" for the current time.'), |
161 | - ListOption('exclude', type=str, argname="PATTERN", |
162 | + ListOption('exclude', type=text_type, argname="PATTERN", |
163 | short_name='x', |
164 | help='Exclude tests that match this regular' |
165 | ' expression.'), |
166 | @@ -4088,11 +4088,11 @@ |
167 | help='Output test progress via subunit v2.'), |
168 | Option('strict', help='Fail on missing dependencies or ' |
169 | 'known failures.'), |
170 | - Option('load-list', type=str, argname='TESTLISTFILE', |
171 | + Option('load-list', type=text_type, argname='TESTLISTFILE', |
172 | help='Load a test id list from a text file.'), |
173 | - ListOption('debugflag', type=str, short_name='E', |
174 | + ListOption('debugflag', type=text_type, short_name='E', |
175 | help='Turn on a selftest debug flag.'), |
176 | - ListOption('starting-with', type=str, argname='TESTID', |
177 | + ListOption('starting-with', type=text_type, argname='TESTID', |
178 | param_name='starting_with', short_name='s', |
179 | help= |
180 | 'Load only the tests starting with TESTID.'), |
181 | @@ -5506,7 +5506,7 @@ |
182 | lazy_registry=('breezy.transport', 'transport_server_registry'), |
183 | value_switches=True), |
184 | Option('listen', |
185 | - help='Listen for connections on nominated address.', type=str), |
186 | + help='Listen for connections on nominated address.', type=text_type), |
187 | Option('port', |
188 | help='Listen for connections on nominated port. Passing 0 as ' |
189 | 'the port number will result in a dynamically allocated ' |
190 | @@ -5647,9 +5647,9 @@ |
191 | diff='Normal unified diff.', |
192 | plain='No patch, just directive.'), |
193 | Option('sign', help='GPG-sign the directive.'), 'revision', |
194 | - Option('mail-to', type=str, |
195 | + Option('mail-to', type=text_type, |
196 | help='Instead of printing the directive, email to this address.'), |
197 | - Option('message', type=str, short_name='m', |
198 | + Option('message', type=text_type, short_name='m', |
199 | help='Message to use when committing this merge.') |
200 | ] |
201 | |
202 | @@ -6116,7 +6116,7 @@ |
203 | with_no_trees='Reconfigure repository to not create ' |
204 | 'working trees on branches by default.' |
205 | ), |
206 | - Option('bind-to', help='Branch to bind checkout to.', type=str), |
207 | + Option('bind-to', help='Branch to bind checkout to.', type=text_type), |
208 | Option('force', |
209 | help='Perform reconfiguration even if local changes' |
210 | ' will be lost.'), |
211 | @@ -6688,7 +6688,7 @@ |
212 | takes_options = [Option('plugin', |
213 | help='Export help text from named command '\ |
214 | '(defaults to all built in commands).', |
215 | - type=str), |
216 | + type=text_type), |
217 | Option('include-duplicates', |
218 | help='Output multiple copies of the same msgid ' |
219 | 'string if it appears more than once.'), |
220 | |
221 | === modified file 'breezy/cmd_version_info.py' |
222 | --- breezy/cmd_version_info.py 2017-05-22 00:56:52 +0000 |
223 | +++ breezy/cmd_version_info.py 2017-11-11 20:42:11 +0000 |
224 | @@ -84,7 +84,7 @@ |
225 | help='Include the revision-history.'), |
226 | Option('include-file-revisions', |
227 | help='Include the last revision for each file.'), |
228 | - Option('template', type=str, help='Template for the output.'), |
229 | + Option('template', type=text_type, help='Template for the output.'), |
230 | 'revision', |
231 | ] |
232 | takes_args = ['location?'] |
233 | |
234 | === modified file 'breezy/commit_signature_commands.py' |
235 | --- breezy/commit_signature_commands.py 2017-05-22 00:56:52 +0000 |
236 | +++ breezy/commit_signature_commands.py 2017-11-11 20:42:11 +0000 |
237 | @@ -110,7 +110,7 @@ |
238 | help='Comma separated list of GPG key patterns which are' |
239 | ' acceptable for verification.', |
240 | short_name='k', |
241 | - type=str,), |
242 | + type=text_type,), |
243 | 'revision', |
244 | 'verbose', |
245 | ] |
246 | |
247 | === modified file 'breezy/plugins/bash_completion/bashcomp.py' |
248 | --- breezy/plugins/bash_completion/bashcomp.py 2017-06-05 20:48:31 +0000 |
249 | +++ breezy/plugins/bash_completion/bashcomp.py 2017-11-11 20:42:11 +0000 |
250 | @@ -420,13 +420,13 @@ |
251 | """ |
252 | |
253 | takes_options = [ |
254 | - option.Option("function-name", short_name="f", type=str, argname="name", |
255 | + option.Option("function-name", short_name="f", type=text_type, argname="name", |
256 | help="Name of the generated function (default: _brz)"), |
257 | option.Option("function-only", short_name="o", type=None, |
258 | help="Generate only the shell function, don't enable it"), |
259 | option.Option("debug", type=None, hidden=True, |
260 | help="Enable shell code useful for debugging"), |
261 | - option.ListOption("plugin", type=str, argname="name", |
262 | + option.ListOption("plugin", type=text_type, argname="name", |
263 | # param_name="selected_plugins", # doesn't work, bug #387117 |
264 | help="Enable completions for the selected plugin" |
265 | + " (default: all plugins)"), |
266 | |
267 | === modified file 'breezy/plugins/fastimport/cmds.py' |
268 | --- breezy/plugins/fastimport/cmds.py 2017-09-26 00:55:04 +0000 |
269 | +++ breezy/plugins/fastimport/cmds.py 2017-11-11 20:42:11 +0000 |
270 | @@ -238,10 +238,10 @@ |
271 | _see_also = ['fast-export', 'fast-import-filter', 'fast-import-info'] |
272 | takes_args = ['source', 'destination?'] |
273 | takes_options = ['verbose', |
274 | - Option('user-map', type=str, |
275 | + Option('user-map', type=text_type, |
276 | help="Path to file containing a map of user-ids.", |
277 | ), |
278 | - Option('info', type=str, |
279 | + Option('info', type=text_type, |
280 | help="Path to file containing caching hints.", |
281 | ), |
282 | Option('trees', |
283 | @@ -268,10 +268,10 @@ |
284 | experimental="Enable experimental features.", |
285 | value_switches=True, enum_switch=False, |
286 | ), |
287 | - Option('import-marks', type=str, |
288 | + Option('import-marks', type=text_type, |
289 | help="Import marks from file." |
290 | ), |
291 | - Option('export-marks', type=str, |
292 | + Option('export-marks', type=text_type, |
293 | help="Export marks to file." |
294 | ), |
295 | RegistryOption('format', |
296 | @@ -422,14 +422,14 @@ |
297 | _see_also = ['fast-import'] |
298 | takes_args = ['source?'] |
299 | takes_options = ['verbose', |
300 | - ListOption('include_paths', short_name='i', type=str, |
301 | + ListOption('include_paths', short_name='i', type=text_type, |
302 | help="Only include commits affecting these paths." |
303 | " Directories should have a trailing /." |
304 | ), |
305 | - ListOption('exclude_paths', short_name='x', type=str, |
306 | + ListOption('exclude_paths', short_name='x', type=text_type, |
307 | help="Exclude these paths from commits." |
308 | ), |
309 | - Option('user-map', type=str, |
310 | + Option('user-map', type=text_type, |
311 | help="Path to file containing a map of user-ids.", |
312 | ), |
313 | Option('dont-squash-empty-commits', |
314 | @@ -543,10 +543,10 @@ |
315 | _see_also = ['fast-import', 'fast-import-filter'] |
316 | takes_args = ['source'] |
317 | takes_options = ['verbose', |
318 | - Option('commit-mark', short_name='m', type=str, |
319 | + Option('commit-mark', short_name='m', type=text_type, |
320 | help="Mark of the commit to display." |
321 | ), |
322 | - ListOption('commands', short_name='C', type=str, |
323 | + ListOption('commands', short_name='C', type=text_type, |
324 | help="Display fields for these commands." |
325 | ), |
326 | ] |
327 | @@ -666,20 +666,20 @@ |
328 | _see_also = ['fast-import', 'fast-import-filter'] |
329 | takes_args = ['source?', 'destination?'] |
330 | takes_options = ['verbose', 'revision', |
331 | - Option('git-branch', short_name='b', type=str, |
332 | + Option('git-branch', short_name='b', type=text_type, |
333 | argname='FILE', |
334 | help='Name of the git branch to create (default=master).' |
335 | ), |
336 | Option('checkpoint', type=int, argname='N', |
337 | help="Checkpoint every N revisions (default=10000)." |
338 | ), |
339 | - Option('marks', type=str, argname='FILE', |
340 | + Option('marks', type=text_type, argname='FILE', |
341 | help="Import marks from and export marks to file." |
342 | ), |
343 | - Option('import-marks', type=str, argname='FILE', |
344 | + Option('import-marks', type=text_type, argname='FILE', |
345 | help="Import marks from file." |
346 | ), |
347 | - Option('export-marks', type=str, argname='FILE', |
348 | + Option('export-marks', type=text_type, argname='FILE', |
349 | help="Export marks to file." |
350 | ), |
351 | Option('plain', |
352 | |
353 | === modified file 'breezy/plugins/grep/cmds.py' |
354 | --- breezy/plugins/grep/cmds.py 2017-05-22 00:56:52 +0000 |
355 | +++ breezy/plugins/grep/cmds.py 2017-11-11 20:42:11 +0000 |
356 | @@ -105,13 +105,13 @@ |
357 | takes_options = [ |
358 | 'verbose', |
359 | 'revision', |
360 | - Option('color', type=str, argname='when', |
361 | + Option('color', type=text_type, argname='when', |
362 | help='Show match in color. WHEN is never, always or auto.'), |
363 | Option('diff', short_name='p', |
364 | help='Grep for pattern in changeset for each revision.'), |
365 | - ListOption('exclude', type=str, argname='glob', short_name='X', |
366 | + ListOption('exclude', type=text_type, argname='glob', short_name='X', |
367 | help="Skip files whose base name matches GLOB."), |
368 | - ListOption('include', type=str, argname='glob', short_name='I', |
369 | + ListOption('include', type=text_type, argname='glob', short_name='I', |
370 | help="Search only files whose base name matches GLOB."), |
371 | Option('files-with-matches', short_name='l', |
372 | help='Print only the name of each input file in ' |
373 | |
374 | === modified file 'breezy/tests/blackbox/test_commit.py' |
375 | --- breezy/tests/blackbox/test_commit.py 2017-06-10 00:17:06 +0000 |
376 | +++ breezy/tests/blackbox/test_commit.py 2017-11-11 20:42:11 +0000 |
377 | @@ -533,6 +533,19 @@ |
378 | 'added hello\.txt\n' |
379 | 'Committed revision 1\.\n') |
380 | |
381 | + def test_fixes_bug_unicode(self): |
382 | + """commit --fixes=lp:unicode succeeds without output.""" |
383 | + tree = self.make_branch_and_tree('tree') |
384 | + self.build_tree(['tree/hello.txt']) |
385 | + tree.add('hello.txt') |
386 | + output, err = self.run_bzr( |
387 | + ['commit', '-m', 'hello', |
388 | + u'--fixes=generic:\u20ac', 'tree/hello.txt'], |
389 | + encoding='utf-8', retcode=3) |
390 | + self.assertEqual(b'', output) |
391 | + self.assertContainsRe(err, |
392 | + b'brz: ERROR: Unrecognized bug generic:\xe2\x82\xac\\. Commit refused.\n') |
393 | + |
394 | def test_no_bugs_no_properties(self): |
395 | """If no bugs are fixed, the bugs property is not set. |
396 | |
397 | @@ -541,7 +554,7 @@ |
398 | tree = self.make_branch_and_tree('tree') |
399 | self.build_tree(['tree/hello.txt']) |
400 | tree.add('hello.txt') |
401 | - self.run_bzr( 'commit -m hello tree/hello.txt') |
402 | + self.run_bzr('commit -m hello tree/hello.txt') |
403 | # Get the revision properties, ignoring the branch-nick property, which |
404 | # we don't care about for this test. |
405 | last_rev = tree.branch.repository.get_revision(tree.last_revision()) |
406 | |
407 | === modified file 'doc/en/release-notes/brz-3.0.txt' |
408 | --- doc/en/release-notes/brz-3.0.txt 2017-10-07 13:27:26 +0000 |
409 | +++ doc/en/release-notes/brz-3.0.txt 2017-11-11 20:42:11 +0000 |
410 | @@ -140,6 +140,9 @@ |
411 | Thanks to Augie Fackler for reporting. |
412 | (Jelmer Vernooij, #1710979) |
413 | |
414 | +* Mark all options as unicode. Allows using non-ASCII values in most |
415 | + options. (Jelmer Vernooij, #563692) |
416 | + |
417 | Documentation |
418 | ************* |
419 |
You want `type=text_type` as the spelling to make Python 3 happy.