| 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 15 matching lines...) Expand all Loading... |
| 26 """Optional list of commit ids for each package. | 26 """Optional list of commit ids for each package. |
| 27 This list must either be empty or have the same length as | 27 This list must either be empty or have the same length as |
| 28 the packages list. If not set all rev'd ebuilds will have | 28 the packages list. If not set all rev'd ebuilds will have |
| 29 empty commit id's.""", | 29 empty commit id's.""", |
| 30 short_name='i') | 30 short_name='i') |
| 31 gflags.DEFINE_string('packages', '', | 31 gflags.DEFINE_string('packages', '', |
| 32 'Space separated list of packages to mark as stable.', | 32 'Space separated list of packages to mark as stable.', |
| 33 short_name='p') | 33 short_name='p') |
| 34 gflags.DEFINE_string('push_options', '', | 34 gflags.DEFINE_string('push_options', '', |
| 35 'Options to use with git-cl push using push command.') | 35 'Options to use with git-cl push using push command.') |
| 36 gflags.DEFINE_string('tracking_branch', 'origin', |
| 37 'Used with commit to specify branch to track against.', |
| 38 short_name='t') |
| 36 gflags.DEFINE_boolean('verbose', False, | 39 gflags.DEFINE_boolean('verbose', False, |
| 37 'Prints out verbose information about what is going on.', | 40 'Prints out verbose information about what is going on.', |
| 38 short_name='v') | 41 short_name='v') |
| 39 | 42 |
| 40 | 43 |
| 41 # TODO(sosa): Remove hard-coding of overlays directory once there is a better | 44 # TODO(sosa): Remove hard-coding of overlays directory once there is a better |
| 42 # way. | 45 # way. |
| 43 _CHROMIUMOS_OVERLAYS_DIRECTORY = \ | 46 _CHROMIUMOS_OVERLAYS_DIRECTORY = \ |
| 44 '%s/trunk/src/third_party/chromiumos-overlay' % os.environ['HOME'] | 47 '%s/trunk/src/third_party/chromiumos-overlay' % os.environ['HOME'] |
| 45 | 48 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 155 |
| 153 def CreateBranch(self): | 156 def CreateBranch(self): |
| 154 """Creates a new git branch or replaces an existing one.""" | 157 """Creates a new git branch or replaces an existing one.""" |
| 155 if self.Exists(): | 158 if self.Exists(): |
| 156 self.Delete() | 159 self.Delete() |
| 157 self._Checkout(self.branch_name) | 160 self._Checkout(self.branch_name) |
| 158 | 161 |
| 159 def _Checkout(self, target, create=True): | 162 def _Checkout(self, target, create=True): |
| 160 """Function used internally to create and move between branches.""" | 163 """Function used internally to create and move between branches.""" |
| 161 if create: | 164 if create: |
| 162 git_cmd = 'git checkout -b %s origin' % target | 165 git_cmd = 'git checkout -b %s %s' % (target, gflags.FLAGS.tracking_branch) |
| 163 else: | 166 else: |
| 164 git_cmd = 'git checkout %s' % target | 167 git_cmd = 'git checkout %s' % target |
| 165 _RunCommand(git_cmd) | 168 _RunCommand(git_cmd) |
| 166 | 169 |
| 167 def Exists(self): | 170 def Exists(self): |
| 168 """Returns True if the branch exists.""" | 171 """Returns True if the branch exists.""" |
| 169 branch_cmd = 'git branch' | 172 branch_cmd = 'git branch' |
| 170 branches = _RunCommand(branch_cmd) | 173 branches = _RunCommand(branch_cmd) |
| 171 return self.branch_name in branches.split() | 174 return self.branch_name in branches.split() |
| 172 | 175 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 'and reset the git repo yourself.' % | 358 'and reset the git repo yourself.' % |
| 356 (package_list[:index], _CHROMIUMOS_OVERLAYS_DIRECTORY)) | 359 (package_list[:index], _CHROMIUMOS_OVERLAYS_DIRECTORY)) |
| 357 raise e | 360 raise e |
| 358 elif command == 'push': | 361 elif command == 'push': |
| 359 _PushChange() | 362 _PushChange() |
| 360 | 363 |
| 361 | 364 |
| 362 if __name__ == '__main__': | 365 if __name__ == '__main__': |
| 363 main(sys.argv) | 366 main(sys.argv) |
| 364 | 367 |
| OLD | NEW |