post-review: yet another attempt to improve git support

Review Request #1144 — Created Oct. 4, 2009 and submitted — Latest diff uploaded

Information

djs
RBTools

Reviewers

This is refresh of review 985. I've refactored the change to be more intelligent, and I didn't touch git-svn behavior.

The general idea is to try to detect the merge base of your current head, or gracefully fall back to defaults. You can optionally specify a tracking branch if you need to.

* Try to detect the tracking branch for the current HEAD, if possible
* If a tracking branch doesn't exist, or is not remote, fall back to origin/master
* If --tracking-branch is specified, use this branch instead of origin/master
* Determine the merge base with the git merge-base command. This makes it okay to specify a tracking branch even when its head no longer points to the original branching point.
* No longer mucks with the current git-svn behavior.
* Add unit tests for pure git. The tests are limited to pure git GitClient right now and aren't comprehensive, but cover the scenarios I changed.

http://github.com/djs/rbtools/tree/review1144-r5
Tested with rbtools repo and local server with following scenarios:

* Remote tracking branch available
* Local tracking branch available (ignored)
* No tracking branch available (default to origin/master)
* No tracking branch available, with --tracking specified
* No tracking branch available with --parent specified
* Revision range specified

$ nosetests
..........
----------------------------------------------------------------------
Ran 10 tests in 12.420s
    Loading...