Merge lp:~gagern/bzr/bug387117 into lp:bzr
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrew Bennetts | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~gagern/bzr/bug387117 | ||||
Merge into: | lp:bzr | ||||
Diff against target: |
44 lines (+11/-1) 3 files modified
NEWS (+3/-0) bzrlib/option.py (+1/-1) bzrlib/tests/test_options.py (+7/-0) |
||||
To merge this branch: | bzr merge lp:~gagern/bzr/bug387117 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | Approve | ||
Vincent Ladeuil | Approve | ||
Review via email: mp+23750@code.launchpad.net |
Commit message
Properly handle param_name attribute for ListOption.
Description of the change
Currently a ListOption with a custom param_name will cause an AttributeError when the value is set. The reason is that the optparse infrastructure doesn't know about the custom name, therefore doesn't use it to store the empty list default.
This is particularly annoying as for list options, a single option denotes a single list entry, while the parameter passed to the function denotes the list as a whole. Therefore the two are likely to differ in singular/plural formulations, at least if you use proper English.
I assume this falls well within the realm of bug #387117, even though I couldn't find any problems with the ListOption.
I've added a test exposing the issue in current bzr, as well as a fix setting the dest parameter of the optparse option.
I wonder whether the same approach would be advisable for all occurrences of parser.
Personally I'd also consider it more consistent if the argument wouldn't get included in kwargs of the executed command unless the user actually specified at least one list option, perhaps with the special value of -. But I assume that such a change could break plugins out there, so I'll leave it for now. And in any case, this would be a different issue.
@Martin, can you please use more meaningful branch names HACKING. txt) to ease Patch Pilot work ? :-)
(see Making a Merge Proposal in doc/developers/
The fix looks fine to me, but you may want to raise the other issues you mentioned directly to the mailing list to get a broader feedback (including plugins authors).