Fix some further Python 2.4 issues.

There were a few new-style exception catches (except Foo as e) and some
"a = b if c else d" logic which was breaking Python 2.4. Switch to the
old-style ways of doing these.
Release RBTools 0.4.1.
Fix handling of revisions with deleted files for SVN.

The implementation of post-review did the wrong thing when the SVN revision had
a deleted file. Posting the diff manually worked fine, so the bug was entirely
in the post-review side.

This patch has been kicking around in our bug tracker for more than a year, in
formats which made it very hard to review. Multiple posters there vouched that
it worked.

Fixes bug 1113.
Set the defaults to true for --guess-* and --publish.

Can still be overridden in the config file, and on the commandline.
Have --debug set debug level on the logging module as well.

Now we get full debug information.  Here is output using the debug
flag now.  Every line that starts with DEBUG is new as of this change.

% python rbtools/postreview.py -n -d
>>> RBTools 0.4.1
>>> Home = /home/csilvers
DEBUG:root:git rev-parse --git-dir
DEBUG:root:git config core.bare
DEBUG:root:git symbolic-ref -q HEAD
DEBUG:root:git config --get branch.master.merge
DEBUG:root:git config --get branch.master.remote
DEBUG:root:git config --get remote.origin.url
DEBUG:root:repository info: Path: https://github.com/Khan/rbtools, Base path: , Supports changesets: False
>>> HTTP GETting api/
>>> HTTP GETting http://reviews.reviewboard.org/api/info/
>>> Using the new web API
DEBUG:root:git merge-base origin/master refs/heads/master
DEBUG:root:git diff --no-color --full-index --no-ext-diff f226c46d6cd3fe76bfd8f07d3377c0aec83c0c15..refs/heads/master
DEBUG:root:git log --pretty=format:%s HEAD^..
DEBUG:root:git log --pretty=format:%s%n%n%b f226c46d6cd3fe76bfd8f07d3377c0aec83c0c15..
diff --git a/rbtools/postreview.py b/rbtools/postreview.py
index 68529ac14d1fd035738fd75da76da8643e3ff525..983e25bceb6c7a0b061788ac18f4dc52631d97b7 100755
--- a/rbtools/postreview.py
+++ b/rbtools/postreview.py
@@ -957,7 +957,7 @@ def parse_options(args):

     parser.add_option("-p", "--publish",
                       dest="publish", action="store_true",
-                      default=get_config_value(configs, 'PUBLISH', False),
+                      default=get_config_value(configs, 'PUBLISH', True),
                       help="publish the review request immediately after "
                            "submitting")
     parser.add_option("-r", "--review-request-id",
@@ -1019,13 +1019,13 @@ def parse_options(args):
     parser.add_option("--guess-summary",
                       dest="guess_summary", action="store_true",
                       default=get_config_value(configs, 'GUESS_SUMMARY',
-                                               False),
+                                               True),
                       help="guess summary from the latest commit (git/"
                            "hg/hgsubversion only)")
     parser.add_option("--guess-description",
                       dest="guess_description", action="store_true",
                       default=get_config_value(configs, 'GUESS_DESCRIPTION',
-                                               False),
+                                               True),
                       help="guess description based on commits on this branch "
                            "(git/hg/hgsubversion only)")
     parser.add_option("--testing-done",
Force people to specify reviewers on the commandline (or else not auto-publish).
Fix issues running post-review within a git-submodule with recent git versions.

On recent versions of Git, the .git directory for a submodule was
relocated to being in the top-level project instead of in the worktree
of the submodule.

This change attempts to get the top-level directory, if we can get it,
falling back on the old behavior for older versions of Git.

Fixes bug #2526
Reviewed at http://reviews.reviewboard.org/r/2960/
More sophisticated handling of --guess-* -- don't do it when running with -r

The eventual goal will be to have guessing happen by default on git,
and we never change the comment and description after the first
publish (the only one that doesn't have -r); after that we
auto-populate the per-publish comment instead.  But for now we only do
the first half of that.

In testing, noticed that --publish=false doesn't work, so added
--no-publish.
Add --rr as an alias for --target-people, since it's an option we'll use a lot.

--rr was chosen to be consistent to what we use with the kiln-review
tool (for hg reviews).
With -r --guess-description, guess the 'update description'.

Without -r, --guess-description edits the review description.  But
every time you update the review you get to add a description as
well.  --guess-description now does that (if I properly understand the
way reviewboard works).

This resolves a TODO.
Re-add .reviewboardrc, which I accidentally deleted last time.

Also fix the content to be accurate for this repository...
Get rid of extraneous blank line.
Re-instate the BRANCH var, which reviewboard had inserted automatically.

I took it out since I wasn't sure what it means, but it seems right.
Refactor the guess-to-set-fields logic into its own routine.

When adding the code to add to change_description, I had only added it
in one place but it turns out I needed to add it to three.  "That's
ridiculous!" I said.  Hence the refactoring.

I have an error-exit in here so I can continue to test.  Will take
that out in a future commit.
Add some TODOs.

I was testing against the standard-library version of git.py, rather
than my own version, so I wasn't seeing the proper output.  Now I am,
and some TODOs have resulted.

But this is good enough to go in, so I took out my testing code.
Suggest people use --rr= instead of --review-people=

Also, add a .gitignore file.
Protect the cookies file with a restrictive umask

Currently the .post-review-cookies file is created using the default
system umask. On many UNIX systems this will create a file which is
world-readable, thus potentially exposing the user's reviewboard
credentials to any other user on that system.

Setting the umask to 0077 should cause the file to be created with
permissions 0600, i.e. readable only by the current user. This will
only apply to new files and not existing ones.

Ran unit tests.

Fixes bug 2231.
Reviewed at http://reviews.reviewboard.org/r/2955/
Fix import path when running postreview.py manually ('python postreview.py').

When running postreview.py manually, the import path isn't right,
yielding errors like:
   Traceback (most recent call last):
     File "rbtools/postreview.py", line 20, in <module>
       from rbtools.api.errors import APIError

I don't know if there's a principled way to fix it, but the simple way
to fix it is just to munge the import path manually in postreview.py,
which is what I do here.
Update the path in a slightly different way, based on tom's feedback.

Also update the comments explaining why we're doing this path munging.
Don't require that we re-specify the reviewer-list when updating with -r.

We only need to specify reviewers when creating a *new* review
request, not when updating an existing one.