Fix rbtools git client when local clone has no "origin" remote.
Review Request #10340 — Created Nov. 29, 2018 and submitted — Latest diff uploaded
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.