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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 OSError: Error occurred while pushing. | 121 OSError: Error occurred while pushing. |
122 """ | 122 """ |
123 | 123 |
124 # TODO(sosa) - Add logic for buildbot to check whether other slaves have | 124 # TODO(sosa) - Add logic for buildbot to check whether other slaves have |
125 # completed and push this change only if they have. | 125 # completed and push this change only if they have. |
126 | 126 |
127 # Sanity check to make sure we're on a stabilizing branch before pushing. | 127 # Sanity check to make sure we're on a stabilizing branch before pushing. |
128 if not _CheckOnStabilizingBranch(): | 128 if not _CheckOnStabilizingBranch(): |
129 generate_test_report.Die('Expected %s to be on branch "%s"' % | 129 generate_test_report.Die('Expected %s to be on branch "%s"' % |
130 (os.getcwd(), _STABLE_BRANCH_NAME)) | 130 (os.getcwd(), _STABLE_BRANCH_NAME)) |
131 _RunCommand('git cl upload --desc_from_logs -m "%s"' % | 131 description = _RunCommand('git log --format=format:%s%n%n%b ' + |
132 'Marking set of ebuilds as stable') | 132 gflags.FLAGS.tracking_branch + '..') |
| 133 description = 'Marking set of ebuilds as stable\n\n%s' % description |
| 134 merge_branch_name = 'merge_branch' |
133 _RunCommand('git remote update') | 135 _RunCommand('git remote update') |
134 _RunCommand('git rebase %s' % gflags.FLAGS.tracking_branch) | 136 _RunCommand('git checkout -b %s %s' % ( |
135 _RunCommand('git cl push %s' % gflags.FLAGS.push_options) | 137 merge_branch_name, gflags.FLAGS.tracking_branch)) |
| 138 try: |
| 139 _RunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) |
| 140 _RunCommand('git commit -m "%s"' % description) |
| 141 # Ugh. There has got to be an easier way to push to a tracking branch |
| 142 _RunCommand('git config push.default tracking') |
| 143 _RunCommand('git push') |
| 144 finally: |
| 145 _RunCommand('git checkout %s' % _STABLE_BRANCH_NAME) |
| 146 _RunCommand('git branch -D %s' % merge_branch_name) |
136 | 147 |
137 | 148 |
138 def _RunCommand(command): | 149 def _RunCommand(command): |
139 """Runs a shell command and returns stdout back to caller.""" | 150 """Runs a shell command and returns stdout back to caller.""" |
140 _Print(' + %s' % command) | 151 _Print(' + %s' % command) |
141 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) | 152 proc_handle = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) |
142 return proc_handle.communicate()[0] | 153 return proc_handle.communicate()[0] |
143 | 154 |
144 | 155 |
145 # ======================= End Global Helper Functions ======================== | 156 # ======================= End Global Helper Functions ======================== |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 'and reset the git repo yourself.' % | 370 'and reset the git repo yourself.' % |
360 (package_list[:index], overlay_directory)) | 371 (package_list[:index], overlay_directory)) |
361 raise e | 372 raise e |
362 elif command == 'push': | 373 elif command == 'push': |
363 _PushChange() | 374 _PushChange() |
364 | 375 |
365 | 376 |
366 if __name__ == '__main__': | 377 if __name__ == '__main__': |
367 main(sys.argv) | 378 main(sys.argv) |
368 | 379 |
OLD | NEW |