summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Hobbs <phobbs@google.com>2015-10-21 17:24:23 -0700
committerDavid James <davidjames@chromium.org>2015-10-30 18:42:03 +0000
commitf52ea8f4f2cd3a4b0381a45e243394e59a549147 (patch)
tree1a5a2903002a023af459a98ee67381cedc7b014e
parente6c578e5c00a4bff28999370af0ce3eef4b417e8 (diff)
downloadchromite-f52ea8f4f2cd3a4b0381a45e243394e59a549147.tar.gz
cros_mark_as_stable: checkout stablizing_branch
In order to make the commit on stabilizing_branch we have to actually be *on* stablizing_branch. BUG=chromium:547541 TEST=unit tests. Change-Id: I2c64b0c8c4f0061ee90a6e154a182239fd0208b2 Reviewed-on: https://chromium-review.googlesource.com/308731 Reviewed-by: Paul Hobbs <phobbs@google.com> Tested-by: Paul Hobbs <phobbs@google.com> Commit-Queue: Paul Hobbs <phobbs@google.com>
-rw-r--r--scripts/cros_mark_as_stable.py4
-rw-r--r--scripts/cros_mark_as_stable_unittest.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/scripts/cros_mark_as_stable.py b/scripts/cros_mark_as_stable.py
index 6039a575f..fd02f6aab 100644
--- a/scripts/cros_mark_as_stable.py
+++ b/scripts/cros_mark_as_stable.py
@@ -143,7 +143,9 @@ def PushChange(stable_branch, tracking_branch, dryrun, cwd):
'%s..%s' % (remote_ref.ref, stable_branch)]).output
description = '%s\n\n%s' % (GIT_COMMIT_SUBJECT, description)
logging.info('For %s, using description %s', cwd, description)
- git.CreatePushBranch(constants.MERGE_BRANCH, cwd)
+ git.RunGit(cwd, ['checkout', stable_branch])
+ git.CreatePushBranch(constants.MERGE_BRANCH, cwd,
+ remote_push_branch=remote_ref)
git.RunGit(cwd, ['merge', '--squash', stable_branch])
git.RunGit(cwd, ['commit', '-m', description])
git.RunGit(cwd, ['config', 'push.default', 'tracking'])
diff --git a/scripts/cros_mark_as_stable_unittest.py b/scripts/cros_mark_as_stable_unittest.py
index 35ea08094..bafb1603a 100644
--- a/scripts/cros_mark_as_stable_unittest.py
+++ b/scripts/cros_mark_as_stable_unittest.py
@@ -57,6 +57,8 @@ class NonClassTests(cros_test_lib.MockTestCase):
create_mock = self.PatchObject(git, 'CreatePushBranch')
git_mock = self.StartPatcher(RunGitMock())
+ git_mock.AddCmdResult(['checkout', self._branch])
+
cmd = ['log', '--format=short', '--perl-regexp', '--author',
'^(?!chrome-bot)', 'refs/remotes/gerrit/master..%s' % self._branch]
@@ -78,7 +80,8 @@ class NonClassTests(cros_test_lib.MockTestCase):
sync_mock.assert_called_with('.', 'gerrit', 'refs/remotes/gerrit/master')
if not bad_cls:
push_mock.assert_called_with('merge_branch', '.', dryrun=False)
- create_mock.assert_called_with('merge_branch', '.')
+ create_mock.assert_called_with('merge_branch', '.',
+ remote_push_branch=mock.ANY)
def testPushChange(self):
"""Verify pushing changes works."""