Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2938)

Unified Diff: cros_mark_as_stable.py

Issue 6250037: Make push and clean more robust. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fix checkout Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cros_mark_as_stable.py
diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py
index 0f4ffeb84a266fe90e5b3d520a8239d48f3a6e80..2a2e07d56af8098885893e7f7a8cac1d8c80f892 100755
--- a/cros_mark_as_stable.py
+++ b/cros_mark_as_stable.py
@@ -227,6 +227,12 @@ def Clean(tracking_branch):
Args:
tracking_branch: The tracking branch we want to return to after the call.
"""
+ # Safety case in case we got into a bad state with a previous build.
+ try:
+ _SimpleRunCommand('git rebase --abort')
+ except:
+ pass
+
_SimpleRunCommand('git reset HEAD --hard')
branch = GitBranch(STABLE_BRANCH_NAME, tracking_branch)
if branch.Exists():
@@ -260,10 +266,10 @@ def PushChange(stable_branch, tracking_branch):
merge_branch_name = 'merge_branch'
for push_try in range(num_retries + 1):
try:
- _SimpleRunCommand('repo sync .')
merge_branch = GitBranch(merge_branch_name, tracking_branch)
if merge_branch.Exists():
merge_branch.Delete()
+ _SimpleRunCommand('repo sync .')
merge_branch.CreateBranch()
if not merge_branch.Exists():
Die('Unable to create merge branch.')
@@ -299,10 +305,10 @@ class GitBranch(object):
def Checkout(cls, target):
"""Function used to check out to another GitBranch."""
if target.branch_name == target.tracking_branch or target.Exists():
- git_cmd = 'git checkout %s' % target.branch_name
+ git_cmd = 'git checkout %s -f' % target.branch_name
else:
- git_cmd = 'git checkout -b %s %s' % (target.branch_name,
- target.tracking_branch)
+ git_cmd = 'git checkout -b %s %s -f' % (target.branch_name,
+ target.tracking_branch)
_SimpleRunCommand(git_cmd)
def Exists(self):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698