Fix rbtools git client when local clone has no "origin" remote.
Review Request #10340 — Created Nov. 29, 2018 and submitted
In the case where the local clone has remotes, but none of them are
named "origin", rbtools was failing to correctly determine the most
recent upstream commit. This was the case even when a tracking branch or
parent branch associated with a remote was configured. The cause here
was a couple places where we were hardcoding "origin" instead of
attempting to detect the remote.
This change fixes that by introducing a new mechanism to try to guess
the remote. If a remote tracking branch is specified, we'll prefer that,
failing back to the remote configured for the current branch. If no
direct association can be found, we'll return either "origin" or fall
back on the first remote found, emitting a warning.
- Ran unit tests.
- Set up a clone with multiple remotes, none of which were named
"origin". Saw that I could correctly post changes when branch remotes
and/or TRACKING_BRANCH were set correctly.
These private methods are before some public methods. They should be moved further down the class.
Must be the full path to the exception.
Also, the description needs to be indented one more level.
This is kind of weirdly formatted. Should be the standard:
all_remote_branches = [ branch.strip() for branch in self._execute(['git', 'branch', '--remotes'], split_lines=True) ]
Let's specifically say "in .reviewboardrc".