3510: Make `rbt post` automatically detect the tracking branch

fel***@cypri****** (Google Code) (Is this you? Claim this profile.)
What version are you running?
RBCommons + RBTools 0.6.2

Describe the enhancement and the motivation for it.

Based on the documentation (https://github.com/reviewboard/rbtools/blob/master/docs/rbtools/rbt/configuration.rst#tracking_branch) `rbt post` under Git assumes the closes remote branch is `master` and you need to use `--tracking-branch` to change it if the tracking branch is not master.

The way I use branches is that all feature branches come from master, I commit and push feature branches to origin/feature-branch-name so that our CI can grab the changes and run the tests; after everything is green (including code review) the branch is merged into master. So if I understood correctly TRACKING_BRANCH is `origin/feature-branch-name` and BRANCH is `master`.

My suggestion is to make `rbt post` smarter under Git. We can get the name of the tracking branch and use it:

```
git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)
```

or 

```
git rev-parse --abbrev-ref --symbolic-full-name @{u}
```

So `rbt post` could get the result from one of those commands and use it as the tracking branch if there's no --tracking-branch option nor TRACKING_BRANCH in .reviewboardrc file.
#1 fel***@cypri****** (Google Code) (Is this you? Claim this profile.)
(I'd love to edit the title and get rid of the wrong "automatically" but I can't see a way to edit an issue in Google Code. GH Issues ❤️)
david
#2 david
  • +Make `rbt post` automatically detect the tracking branch
david
#3 david
  • -reviewboard
    +rbtools
david
#4 david

As of RBTools 1.0, it will try to do a much better job of this. We still recommend setting this in .reviewboardrc, though.

  • -New
    +Fixed