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

Side by Side Diff: cros_mark_as_stable.py

Issue 3076035: cros_mark_as_stable: make it work better in repo (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: Created 10 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """This module uprevs a given package's ebuild to the next revision.""" 7 """This module uprevs a given package's ebuild to the next revision."""
8 8
9 9
10 import fileinput 10 import fileinput
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 _PrintUsageAndDie('Please specify a board') 84 _PrintUsageAndDie('Please specify a board')
85 if not os.path.isdir(gflags.FLAGS.srcroot): 85 if not os.path.isdir(gflags.FLAGS.srcroot):
86 _PrintUsageAndDie('srcroot is not a valid path') 86 _PrintUsageAndDie('srcroot is not a valid path')
87 if commit_id_list and (len(package_list) != len(commit_id_list)): 87 if commit_id_list and (len(package_list) != len(commit_id_list)):
88 _PrintUsageAndDie( 88 _PrintUsageAndDie(
89 'Package list is not the same length as the commit id list') 89 'Package list is not the same length as the commit id list')
90 90
91 91
92 def _Clean(): 92 def _Clean():
93 """Cleans up uncommitted changes on either stabilizing branch or master.""" 93 """Cleans up uncommitted changes on either stabilizing branch or master."""
94 if _CheckOnStabilizingBranch():
95 _RunCommand('git reset HEAD --hard')
96 _RunCommand('git checkout master')
97 _RunCommand('git reset HEAD --hard') 94 _RunCommand('git reset HEAD --hard')
95 _RunCommand('git checkout %s' % gflags.FLAGS.tracking_branch)
98 96
99 97
100 def _PrintUsageAndDie(error_message=''): 98 def _PrintUsageAndDie(error_message=''):
101 """Prints optional error_message the usage and returns an error exit code.""" 99 """Prints optional error_message the usage and returns an error exit code."""
102 command_usage = 'Commands: \n' 100 command_usage = 'Commands: \n'
103 # Add keys and usage information from dictionary. 101 # Add keys and usage information from dictionary.
104 commands = sorted(_COMMAND_DICTIONARY.keys()) 102 commands = sorted(_COMMAND_DICTIONARY.keys())
105 for command in commands: 103 for command in commands:
106 command_usage += ' %s: %s\n' % (command, _COMMAND_DICTIONARY[command]) 104 command_usage += ' %s: %s\n' % (command, _COMMAND_DICTIONARY[command])
107 commands_str = '|'.join(commands) 105 commands_str = '|'.join(commands)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 """Returns True if the branch exists.""" 170 """Returns True if the branch exists."""
173 branch_cmd = 'git branch' 171 branch_cmd = 'git branch'
174 branches = _RunCommand(branch_cmd) 172 branches = _RunCommand(branch_cmd)
175 return self.branch_name in branches.split() 173 return self.branch_name in branches.split()
176 174
177 def Delete(self): 175 def Delete(self):
178 """Deletes the branch and returns the user to the master branch. 176 """Deletes the branch and returns the user to the master branch.
179 177
180 Returns True on success. 178 Returns True on success.
181 """ 179 """
182 self._Checkout('master', create=False) 180 self._Checkout(gflags.FLAGS.tracking_branch, create=False)
183 delete_cmd = 'git branch -D %s' % self.branch_name 181 delete_cmd = 'git branch -D %s' % self.branch_name
184 _RunCommand(delete_cmd) 182 _RunCommand(delete_cmd)
185 183
186 184
187 class _EBuild(object): 185 class _EBuild(object):
188 """Wrapper class for an ebuild.""" 186 """Wrapper class for an ebuild."""
189 187
190 def __init__(self, package, commit_id=None): 188 def __init__(self, package, commit_id=None):
191 """Initializes all data about an ebuild. 189 """Initializes all data about an ebuild.
192 190
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 'and reset the git repo yourself.' % 359 'and reset the git repo yourself.' %
362 (package_list[:index], overlay_directory)) 360 (package_list[:index], overlay_directory))
363 raise e 361 raise e
364 elif command == 'push': 362 elif command == 'push':
365 _PushChange() 363 _PushChange()
366 364
367 365
368 if __name__ == '__main__': 366 if __name__ == '__main__':
369 main(sys.argv) 367 main(sys.argv)
370 368
OLDNEW
« 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