From f30a06ab9132da46ea740d3c81d3950dd3883e66 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Baines Date: Wed, 25 Aug 2010 19:05:45 -0700 Subject: [PATCH] cros_mark_as_stable: delete merge_branch if it already exists Fixes issue with pfbb where commits aren't getting squashed BUG=6102 TEST=Ran the code. Change-Id: Ibbcb8882ee13abf3a7c283bb0d248eef8db31cb8 Review URL: http://codereview.chromium.org/3141045 --- cros_mark_as_stable.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py index 4cf93cbe47..83f878260f 100755 --- a/cros_mark_as_stable.py +++ b/cros_mark_as_stable.py @@ -110,6 +110,9 @@ def _PrintUsageAndDie(error_message=''): else: sys.exit(1) +def _BranchExists(name): + """Returns True is the branch exists""" + return _RunCommand('git branch').split().count(name) != 0 def _PushChange(): """Pushes changes to the git repository. @@ -135,6 +138,10 @@ def _PushChange(): description = 'Marking set of ebuilds as stable\n\n%s' % description merge_branch_name = 'merge_branch' _RunCommand('git remote update') + merge_branch = _GitBranch(merge_branch_name) + merge_branch.CreateBranch() + if not merge_branch.Exists(): + generate_test_report.Die('Unable to create merge branch.') _RunCommand('git checkout -b %s %s' % ( merge_branch_name, gflags.FLAGS.tracking_branch)) _RunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME)