/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-01 08:31:05 UTC
  • mfrom: (3669.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080901083105-x0h6ocy17ktfc9s4
(vila) Fix bug #263249 by setting valid default _param_name

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
            argname = 'ARG'
186
186
        self.argname = argname
187
187
        if param_name is None:
188
 
            self._param_name = self.name
 
188
            self._param_name = self.name.replace('-', '_')
189
189
        else:
190
190
            self._param_name = param_name
191
191
        self.custom_callback = custom_callback
210
210
            option_strings.append('-%s' % short_name)
211
211
        optargfn = self.type
212
212
        if optargfn is None:
213
 
            parser.add_option(action='callback', 
214
 
                              callback=self._optparse_bool_callback, 
 
213
            parser.add_option(action='callback',
 
214
                              callback=self._optparse_bool_callback,
215
215
                              callback_args=(True,),
216
216
                              help=self.help,
217
217
                              *option_strings)
218
218
            negation_strings = ['--%s' % self.get_negation_name()]
219
 
            parser.add_option(action='callback', 
220
 
                              callback=self._optparse_bool_callback, 
 
219
            parser.add_option(action='callback',
 
220
                              callback=self._optparse_bool_callback,
221
221
                              callback_args=(False,),
222
222
                              help=optparse.SUPPRESS_HELP, *negation_strings)
223
223
        else:
224
 
            parser.add_option(action='callback', 
225
 
                              callback=self._optparse_callback, 
 
224
            parser.add_option(action='callback',
 
225
                              callback=self._optparse_callback,
226
226
                              type='string', metavar=self.argname.upper(),
227
227
                              help=self.help,
228
 
                              default=OptionParser.DEFAULT_VALUE, 
 
228
                              default=OptionParser.DEFAULT_VALUE,
229
229
                              *option_strings)
230
230
 
231
231
    def _optparse_bool_callback(self, option, opt_str, value, parser, bool_v):