Sync using SSH everywhere that we push.
Every script that pushes changes over SSH needs to fetch over SSH, whether
they are using 'repo sync' or 'git remote update'. Currently,
cros_mark_as_stable.py and prebuilt.py both forget to use SSH in some
places, resulting in intermittent fast-forward errors.
To fix this issue once and for all, I've setup a new remote that fetches
from SSH, and updated all places that push to use them.
BUG=chromium-os:28282, chromium-os:20878
TEST=All unit tests. Pylint. Remote trybot run.
Change-Id: Ib6eb14ccfe64b844c111bc17bbd1e88636d83864
Reviewed-on: https://gerrit.chromium.org/gerrit/19040
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 2dfafb9..77fef0f 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -84,18 +84,18 @@
def _GetChromiteTrackingBranch():
- """Returns the current Chromite tracking_branch.
-
- If Chromite is on a detached HEAD, we assume it's the manifest branch.
- """
+ """Returns the remote branch associated with chromite."""
cwd = os.path.dirname(os.path.realpath(__file__))
- current_branch = cros_lib.GetCurrentBranch(cwd)
- if current_branch:
- (_, tracking_branch) = cros_lib.GetPushBranch(current_branch, cwd)
- else:
- tracking_branch = cros_lib.GetManifestDefaultBranch(cwd)
-
- return tracking_branch
+ branch = cros_lib.GetCurrentBranch(cwd)
+ if branch:
+ tracking_branch = cros_lib.GetTrackingBranch(branch, cwd)[1]
+ if tracking_branch.startswith('refs/heads/'):
+ return tracking_branch.replace('refs/heads/', '')
+ # If we are not on a branch, or if the tracking branch is a revision,
+ # use the default manifest branch. This only works if we are in a
+ # repo repository. TODO(davidjames): Fix this to work if we're not in a repo
+ # repository.
+ return cros_lib.GetManifestDefaultBranch(cwd)
def _CheckBuildRootBranch(buildroot, tracking_branch):