Improve guess support in rbt post.

Review Request #5614 — Created March 12, 2014 and submitted — Latest diff uploaded

Information

RBTools
master
ee401fd...

Reviewers

This adds new abilities to rbt post's guess fields support. The old
guess support was a boolean state, which only supported opt-in and not
opt-out. That is, if GUESS_FIELDS was set to True in .reviewboardrc, it
couldn't be turned off when posting.

It's now a tri-state of "yes", "no", and "auto", which can be set on the
command line or .reviewboardrc.

If "yes", it behaves as before, with the fields being updated from the
commit message.

If "no", guessing will be turned off (which allows the command line to
override the config file).

If "auto", guessing will be turned on only for new review requests, but
turned off when updating.

If no --guess-* options or configuration variables are set, the
default will be "auto", making for a nicer experience when posting brand
new review requests.

If an old-style --guess-* option is passed without a value (in the form
of --guess-*=value or -gvalue), then the prior logic of forcing guessing
will be used. That is, "yes" is implied.

While "yes", "no", and "auto" are all valid values, we still support
True and False in .reviewboardrc, for backwards-compatibility.

Posted this change by doing rbt post, without any parameters.

Temporarily turned off actual publishing of the change and just outputted
the results of the guess flags. Then I did tests with all three values
in .reviewboardrc and with/without command line arguments and their possible
values. Saw the resulting values that I expected.

Turned posting back on, removed the settings from .reviewboardrc, and posted
a change without explicitly passing any guess arguments. The review request
had the fields filled in from my commit message.

Made changes to the description and summary on my review request, and updated
using -r. The changes weren't overwritten. Tested also with -u.

Then I tried with --guess-fields=no, and it didn't overwrite either.

Tried with yes and it did overwrite.

Tried again without a value and it overwrote again.

Posted a new change with --guess-fields=no and it didn't provide any defaults.

Unit tests pass.

Built the docs, read through, and verified all links.