Fix handling of the --username and --password options to match post-review.

The way that the --username and --password options were handled were a little
annoying, and worked differently between rbt and post-review. This change
pushes the username/password is None logic down into the interactive prompt
method, and adds some checks to avoid prompting if these are specified via the
command line.

Testing done:
Posted reviews with rbt when specifying --username only and saw only the
password prompt.

Reviewed at https://reviews.reviewboard.org/r/4785/
Fixes bug 3114.
Ignore stderr with 'svn propget reviewboard:url .'

On my system the local en_US.UTF-8 does not exist (I have he_IL.UTF-8).
rbutils.utils.process.execute() forces the environment to be
LC_ALL=en_US.UTF-8, LANGUAGE=en_US.UTF-8. I can't override this from outside.
This means that svn will complain to the standad error about not being able to
set LC_CTYPE.

Furthermore, by default that function (execute()) will redirect stderr with
stdout. This resulted in the reviewbord server being '<long message from
svn><the URL>'.

This fix forces not redirecting the standard error there.

Reviewed at https://reviews.reviewboard.org/r/4670/
Clean up the git diff call a little bit

In particular -M (--find-renames) and --no-renames should be mutually exclusive
and the revision range should come last in the diff command before any options
terminating dashes (--) and paths. git doesn't enforce this today, but it could
tomorrow.

Testing done: Posted a review request with rbt.

Reviewed at https://reviews.reviewboard.org/r/4823/
Make rbt and post-review consistent in their treatment of missing passwords.

The way we handled the http response wasn't the same between the postreview.py
and api/request.py. In particular, different improvements had been made to each
without porting to the other. The rbt version checked the validity of
'response', while the post-review one used httplib's constants. This change
makes the two consistent.

Based on https://reviews.reviewboard.org/r/4787/
Fix git parent diff support in diff_between_revisions

The calling contract stipulates that the parent diff should be in a
dictionary entry called 'parent_diff', not 'parent_diff_lines'.

I also snuck in a change to the git unit tests: if they don't create a
dummy .gitconfig in the new HOME, "git commit" dies later, triggering all
sorts of unhappiness in nose.

Testing done: Ran post-review with --revision-range.
Fixes bug 3125
Reviewed at https://reviews.reviewboard.org/r/4870/
Fix a missing import.

Somehow we ended up using httplib without importing it. Trivial fix.
Turn off the General Index for release notes.

The General Index page on RBTools release notes was useless, so turn it
off.
Upload RBTools releases to Amazon S3.

We're now using Amazon S3 to store all our releases. This updates our
release script to do that. It requires our new 'fabazon' module to help
interface with S3 and perform S3 uploading and directory index
regeneration.
Fix Resource bug that masked the url from ReviewBoard's Web API.

The 'url' attribute in Resource pointed to the Web API resource instead of the
web page.

Testing done: Unit tests pass.

Reviewed at https://reviews.reviewboard.org/r/4899/
Add option to rbt patch for automatically creating a Git commit

The option -c, --commit automatically creates a commit in the current local
branch with the summary, description, bugs, testing, and author information
fetched from the review request.

Testing done:
Tested with a new review request using the commands 'rbt patch -c
<review_request_id>' and 'rbt patch --commit <review_request_id>'.

Unit tests passed.

Reviewed at https://reviews.reviewboard.org/r/4865/
Make 'rbt --help' be a little more sensical.

The help output for rbt would say "the most commonly-used commands are:" and
then proceed to spit out an unordered list of every command, no matter how
commonly used.

I've replaced the "most common" commands list with a curated list of the things
that I think are actually most common, in the order that people probably care
about them. We then print out the rest of the commands in alphabetical order.

Testing done: Ran rbt --help

Reviewed at https://reviews.reviewboard.org/r/4987/
Enhance rbt post to automatically determine the existing review request

``rbt -u`` automatically determines the existing review request to update. It
suggests a pending review request by the current user in the current
repository, based on the request summary and description.

If the summary and description exactly match those of an existing request, the
request is immediately updated. Otherwise, the user is prompted to confirm a
suggestion from a ranked list of potential matches.

Testing Done:
- Tested with Git, Mercurial, and Bazaar using, with and without 'revision
  range'.
- Unit tests pass.

Reviewed at https://reviews.reviewboard.org/r/4699/
Do some trivial rearranging to the rbt docs.

This change moves 'rbt' ahead of 'post-review', changes the "beta" notice on
the rbt page, and adds a deprecation warning on the 'post-review' page. Really
I just wanted the fish.

Testing done: Built HTML and looked at it.

Reviewed at https://reviews.reviewboard.org/r/4994/
Flatten rbtools docs a bit.

The structure of the rbtools docs made it really unclear how to actually see
information about using the tools, since the table of contents just had stuff
about installation.

I've pulled the rbt/index and api/index files into index itself, under a "Using
RBTools" section. At least this way, the top-level TOC has something other than
"Installation", and there are a bunch of links visible as soon as you see the
page to the specific commands, instead of having to drill down through several
pages.

While I was doing this, I pulled in the info from "Automating post-review" in
the old tools section of the Review Board user manual, which seemed to be the
only thing present in that that wasn't here.

Testing done: Built html docs and looked through them.

Reviewed at https://reviews.reviewboard.org/r/4997/
Add command for configuring a repository to point to a Review Board server

The new command 'setup-repo' interactively creates the configuration file
.reviewboard in the user's current working directory.

Testing Done:
- Tested with Git and Subversion on two Review Board servers.
- Unit tests pass.

Reviewed at https://reviews.reviewboard.org/r/4662/
Un-escape markdown text for 'rbt patch -c'

The patching step was including escaped characters in the description and
testing done, which was annoying to look at, and made it so in the case where
the first line of the description was the same as the summary except for
escaping, we wouldn't collapse them together.

This change adds some code to do the same as markdown_unscape() from
reviewboard.reviews.markdown_utils.

Testing done:
Ran `rbt patch -c` for a few changes on reviews.reviewboard.org that had
escaped descriptions and testing done. Saw the expected results.

Reviewed at https://reviews.reviewboard.org/r/5014/
Fix post -u bug that uses the incorrect summary.

Fix post -u bug that uses the incorrect summary.

If a draft exists for the review request, post -u should use the draft's
summary and description instead of the review request's summary and description
to detect and prompt for the review request to update. This patch fixes the
issue where post -u would always use the review request’s summary and
description even if a draft exists.

Testing done:
Tested with published and draft review requests.
Unit tests passed.

Reviewed at https://reviews.reviewboard.org/r/5041/
Fix Mercurial's _set_summary() and _set_description()

I was experiencing exceptions when using `rbt diff --revision-range`:

Traceback (most recent call last):
  File "/Users/gps/src/firefox/obj-firefox.noindex/_virtualenv/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.5.2.dev', 'console_scripts', 'rbt')()
  File "/Users/gps/src/rbtools/rbtools/commands/main.py", line 113, in main
    command.run_from_argv([RB_MAIN] + args)
  File "/Users/gps/src/rbtools/rbtools/commands/__init__.py", line 157, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/Users/gps/src/rbtools/rbtools/commands/diff.py", line 95, in main
    files=args)
  File "/Users/gps/src/rbtools/rbtools/utils/diffs.py", line 13, in get_diff
    repository_info)
  File "/Users/gps/src/rbtools/rbtools/clients/mercurial.py", line 388, in diff_between_revisions
    self._set_description(revision_range)
  File "/Users/gps/src/rbtools/rbtools/clients/mercurial.py", line 379, in _set_description
    if self.options.guess_description and not self.options.description:
AttributeError: Values instance has no attribute 'guess_description'

This patch makes the exceptions go away.

Reviewed at https://reviews.reviewboard.org/r/5063/
Support hidden changesets in Mercurial

Before this patch, if hidden changesets were specified (e.g. with
--revision-range), rbtools would fail because Mercurial would complain
about changesets not being found. Mercurial "pretends" it doesn't know
about hidden changesets unless --hidden is specified.

This patch adds --hidden to all Mercurial commands that could interact
with hidden changesets. If the current Mercurial install doesn't support
hidden changesets (this is detected at run time), this argument is
stripped before command execution.

An alternative to this implementation would require the user to pass
--hidden to rbtools or would require the user to activate hidden
changeset support in the rbtools config. It is the opinion of this patch
author that things should "just work" and the user shouldn't be required
to do anything special to get rbtools to play nice with hidden
changesets.

Testing Done:
Manually testing diff --revision-range with hidden changesets.

Reviewed at https://reviews.reviewboard.org/r/5064/
Support of Perforce Brokers

Modification of Perforce client to support Perforce brokers. First check if the
P4 Info has a Broker address defined .. if so use the broker, otherwise (as
before) check the Server address.

Testing Done:
Been using this mod for over a year at Cadence on RBTools 0.5.1

Reviewed at https://reviews.reviewboard.org/r/5062/

Fixes bug 2568.