Teach post-review to use correct SVN remote tracking branch for git-svn repositories

Review Request #2325 — Created April 29, 2011 and submitted




When posting a diff against an SVN repository from a local git-svn repo, post-review always uses "master" as the parent branch.  This strategy breaks down in a number of cases:

1. If your master branch has any local commits (post-review fails with a mysterious error message)
2. If your master branch is behind your feature branch (e.g. you git svn rebase'd your feature branch more recently than your master branch)
3. If your master branch is git svn rebase'd to a different SVN tracking branch than your feature branch
4. If your local changes are on the master branch instead of a feature branch

This change lets post-review figure out the correct SVN remote tracking branch (using "git svn rebase -n") and uses that as the parent; this accommodates all the cases listed above.

In general it should no longer be necessary to specify --parent, though of course the option still works.
Tested uploading diffs with post-review from a local git-svn repo from several different branches (which were rebased against various SVN tracking branches).

git-svn supports the "-n" option to rebase since 1.5.6.  post-review already requires git-svn 1.5.4. "git svn rebase" will fail if passed an unknown option.  So for git-svn 1.5.4 and 1.5.5, if the user does not specify --parent, the behaviour is that post-review will print a warning:

    Failed to determine SVN tracking branch, defaulting to "master"

And continue as before, using "master" as the parent.
  1. Thanks! Committed to master (9dd0f6b).