4023: `--guess-description yes` reverts to default value of `auto`

beol

What version are you running?

0.7.4

What steps will reproduce the problem?

  1. Commit a change locally, e.g. git commit -m "foo"
  2. Post a review request, e.g. rbt post
  3. Amend the commit with new description, e.g. git commit --amend
  4. Update the review request, e.g. rbt post -u --guess-description yes

What is the expected output? What do you see instead?

The expected result is review request in Review Board should have an updated description, but it doesn't.

Looking at the code, the culprit seems to be at line #249 of rbtools/commands/post.py.

        # -g implies --guess-summary and --guess-description
        if self.options.guess_fields:
            self.options.guess_fields = self.normalize_guess_value(
                self.options.guess_fields, '--guess-fields')

            self.options.guess_summary = self.options.guess_fields
            self.options.guess_description = self.options.guess_fields

Because the value of self.options.guess_fields is auto by default as declared at line #119 if rbtools/commands/post.py:

            option_list=[
                Option('-g', '--guess-fields',
                       dest='guess_fields',
                       action='store',
                       config_key='GUESS_FIELDS',
                       nargs='?',
                       default=GUESS_AUTO,
                       const=GUESS_YES,
                       choices=GUESS_CHOICES,
                       help='Equivalent to setting both --guess-summary '
                            'and --guess-description.',
                       extended_help=(
                           'This can optionally take a value to control the '
                           'guessing behavior. See :ref:`guessing-behavior` '
                           'for more information.'
                       )),

The above if statement will always be evaluated as True, and override self.options.guess_description with the value auto even though it was explicitly set to yes in the command line.

What operating system are you using?

Mac OS X

Attach the debug out from the command.

Please provide any additional information below.