Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 _STABLE_BRANCH_NAME | 130 _STABLE_BRANCH_NAME |
| 131 return | 131 return |
| 132 | 132 |
| 133 description = _RunCommand('git log --format=format:%s%n%n%b ' + | 133 description = _RunCommand('git log --format=format:%s%n%n%b ' + |
| 134 gflags.FLAGS.tracking_branch + '..') | 134 gflags.FLAGS.tracking_branch + '..') |
| 135 description = 'Marking set of ebuilds as stable\n\n%s' % description | 135 description = 'Marking set of ebuilds as stable\n\n%s' % description |
| 136 merge_branch_name = 'merge_branch' | 136 merge_branch_name = 'merge_branch' |
| 137 _RunCommand('git remote update') | 137 _RunCommand('git remote update') |
| 138 _RunCommand('git checkout -b %s %s' % ( | 138 _RunCommand('git checkout -b %s %s' % ( |
| 139 merge_branch_name, gflags.FLAGS.tracking_branch)) | 139 merge_branch_name, gflags.FLAGS.tracking_branch)) |
| 140 try: | 140 _RunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) |
| 141 _RunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) | 141 _RunCommand('git commit -m "%s"' % description) |
| 142 _RunCommand('git commit -m "%s"' % description) | 142 # Ugh. There has got to be an easier way to push to a tracking branch |
| 143 # Ugh. There has got to be an easier way to push to a tracking branch | 143 _RunCommand('git config push.default tracking') |
| 144 _RunCommand('git config push.default tracking') | 144 _RunCommand('git push') |
|
Chris Masone
2010/08/19 00:47:51
Ok...so now what happens if there's an error?
| |
| 145 _RunCommand('git push') | |
| 146 finally: | |
| 147 _RunCommand('git checkout %s' % _STABLE_BRANCH_NAME) | |
| 148 _RunCommand('git branch -D %s' % merge_branch_name) | |
| 149 | 145 |
| 150 | 146 |
| 151 def _RunCommand(command): | 147 def _RunCommand(command): |
| 152 """Runs a shell command and returns stdout back to caller.""" | 148 """Runs a shell command and returns stdout back to caller.""" |
| 153 _Print(' + %s' % command) | 149 _Print(' + %s' % command) |
| 154 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) | 150 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) |
| 155 return proc_handle.communicate()[0] | 151 return proc_handle.communicate()[0] |
| 156 | 152 |
| 157 | 153 |
| 158 # ======================= End Global Helper Functions ======================== | 154 # ======================= End Global Helper Functions ======================== |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 'and reset the git repo yourself.' % | 368 'and reset the git repo yourself.' % |
| 373 (package_list[:index], overlay_directory)) | 369 (package_list[:index], overlay_directory)) |
| 374 raise e | 370 raise e |
| 375 elif command == 'push': | 371 elif command == 'push': |
| 376 _PushChange() | 372 _PushChange() |
| 377 | 373 |
| 378 | 374 |
| 379 if __name__ == '__main__': | 375 if __name__ == '__main__': |
| 380 main(sys.argv) | 376 main(sys.argv) |
| 381 | 377 |
| OLD | NEW |