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

Unified Diff: cros_mark_as_stable.py

Issue 6291013: Have the ability for the PFQ to both rev Chrome and other packages. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: 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 | « bin/cros_mark_chrome_as_stable.py ('k') | 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 8fa635e467ed16f8cca6310e6cbc0387fccc165f..bf2ab82e5fafaeb18f2f8bb074d7e95a1b1a5468 100755
--- a/cros_mark_as_stable.py
+++ b/cros_mark_as_stable.py
@@ -223,7 +223,10 @@ def Clean(tracking_branch):
tracking_branch: The tracking branch we want to return to after the call.
"""
_SimpleRunCommand('git reset HEAD --hard')
- _SimpleRunCommand('git checkout %s' % tracking_branch)
+ branch = GitBranch(STABLE_BRANCH_NAME, tracking_branch)
+ if branch.Exists():
+ branch.Checkout(branch)
+ branch.Delete()
def PushChange(stable_branch, tracking_branch):
@@ -274,6 +277,7 @@ def PushChange(stable_branch, tracking_branch):
raise
scottz 2011/01/27 05:33:38 extra new line?
+
class GitBranch(object):
"""Wrapper class for a git branch."""
@@ -283,17 +287,15 @@ class GitBranch(object):
self.tracking_branch = tracking_branch
def CreateBranch(self):
- """Creates a new git branch or replaces an existing one."""
- if self.Exists():
- self.Delete()
- self._Checkout(self.branch_name)
-
- def _Checkout(self, target, create=True):
- """Function used internally to create and move between branches."""
- if create:
- git_cmd = 'git checkout -b %s %s' % (target, self.tracking_branch)
+ self.Checkout(self)
+
+ def Checkout(self, target):
+ """Function used to check out to another GitBranch."""
+ if target.branch_name == self.tracking_branch or target.Exists():
+ git_cmd = 'git checkout %s' % target.branch_name
else:
- git_cmd = 'git checkout %s' % target
+ git_cmd = 'git checkout -b %s %s' % (target.branch_name,
+ target.tracking_branch)
_SimpleRunCommand(git_cmd)
def Exists(self):
@@ -307,7 +309,8 @@ class GitBranch(object):
Returns True on success.
"""
- self._Checkout(self.tracking_branch, create=False)
+ tracking_branch = GitBranch(self.tracking_branch, self.tracking_branch)
+ self.Checkout(tracking_branch)
delete_cmd = 'git branch -D %s' % self.branch_name
_SimpleRunCommand(delete_cmd)
@@ -570,14 +573,11 @@ def main(argv):
'and reset the git repo yourself.' % overlay)
raise
- if revved_packages:
- _CleanStalePackages(gflags.FLAGS.board, new_package_atoms)
- if gflags.FLAGS.drop_file:
- fh = open(gflags.FLAGS.drop_file, 'w')
- fh.write(' '.join(revved_packages))
- fh.close()
- else:
- work_branch.Delete()
+ _CleanStalePackages(gflags.FLAGS.board, new_package_atoms)
+ if gflags.FLAGS.drop_file:
+ fh = open(gflags.FLAGS.drop_file, 'w')
+ fh.write(' '.join(revved_packages))
+ fh.close()
if __name__ == '__main__':
« no previous file with comments | « bin/cros_mark_chrome_as_stable.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698