OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 def RemoteBranch(self, name): | 398 def RemoteBranch(self, name): |
399 if name in ["candidates", "master"]: | 399 if name in ["candidates", "master"]: |
400 return "origin/%s" % name | 400 return "origin/%s" % name |
401 return "branch-heads/%s" % name | 401 return "branch-heads/%s" % name |
402 | 402 |
403 def Tag(self, tag, remote, message): | 403 def Tag(self, tag, remote, message): |
404 # Wait for the commit to appear. Assumes unique commit message titles (this | 404 # Wait for the commit to appear. Assumes unique commit message titles (this |
405 # is the case for all automated merge and push commits - also no title is | 405 # is the case for all automated merge and push commits - also no title is |
406 # the prefix of another title). | 406 # the prefix of another title). |
407 commit = None | 407 commit = None |
408 for wait_interval in [3, 7, 15, 35]: | 408 for wait_interval in [3, 7, 15, 35, 35]: |
409 self.step.Git("fetch") | 409 self.step.Git("fetch") |
410 commit = self.step.GitLog(n=1, format="%H", grep=message, branch=remote) | 410 commit = self.step.GitLog(n=1, format="%H", grep=message, branch=remote) |
411 if commit: | 411 if commit: |
412 break | 412 break |
413 print("The commit has not replicated to git. Waiting for %s seconds." % | 413 print("The commit has not replicated to git. Waiting for %s seconds." % |
414 wait_interval) | 414 wait_interval) |
415 self.step._side_effect_handler.Sleep(wait_interval) | 415 self.step._side_effect_handler.Sleep(wait_interval) |
416 else: | 416 else: |
417 self.step.Die("Couldn't determine commit for setting the tag. Maybe the " | 417 self.step.Die("Couldn't determine commit for setting the tag. Maybe the " |
418 "git updater is lagging behind?") | 418 "git updater is lagging behind?") |
419 | 419 |
420 self.step.Git("tag %s %s" % (tag, commit)) | 420 self.step.Git("tag %s %s" % (tag, commit)) |
421 self.step.Git("push origin %s" % tag) | 421 self.step.Git("push origin %s" % tag) |
422 | 422 |
423 | 423 |
424 class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface): | 424 class GitReadSvnWriteInterface(GitTagsOnlyMixin, GitSvnInterface): |
425 pass | 425 pass |
426 | 426 |
427 | 427 |
| 428 class GitInterface(GitTagsOnlyMixin): |
| 429 def Fetch(self): |
| 430 self.step.Git("fetch") |
| 431 |
| 432 def GitSvn(self, hsh, branch=""): |
| 433 return "" |
| 434 |
| 435 def SvnGit(self, rev, branch=""): |
| 436 raise NotImplementedError() |
| 437 |
| 438 def Land(self): |
| 439 self.step.Git("push origin") |
| 440 |
| 441 def CLLand(self): |
| 442 self.step.GitCLLand() |
| 443 |
| 444 |
428 VC_INTERFACES = { | 445 VC_INTERFACES = { |
429 "git_svn": GitSvnInterface, | 446 "git_svn": GitSvnInterface, |
430 "git_read_svn_write": GitReadSvnWriteInterface, | 447 "git_read_svn_write": GitReadSvnWriteInterface, |
| 448 "git": GitInterface, |
431 } | 449 } |
432 | 450 |
433 | 451 |
434 class Step(GitRecipesMixin): | 452 class Step(GitRecipesMixin): |
435 def __init__(self, text, number, config, state, options, handler): | 453 def __init__(self, text, number, config, state, options, handler): |
436 self._text = text | 454 self._text = text |
437 self._number = number | 455 self._number = number |
438 self._config = config | 456 self._config = config |
439 self._state = state | 457 self._state = state |
440 self._options = options | 458 self._options = options |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 for (number, step_class) in enumerate(step_classes): | 902 for (number, step_class) in enumerate(step_classes): |
885 steps.append(MakeStep(step_class, number, self._state, self._config, | 903 steps.append(MakeStep(step_class, number, self._state, self._config, |
886 options, self._side_effect_handler)) | 904 options, self._side_effect_handler)) |
887 for step in steps[options.step:]: | 905 for step in steps[options.step:]: |
888 if step.Run(): | 906 if step.Run(): |
889 return 0 | 907 return 0 |
890 return 0 | 908 return 0 |
891 | 909 |
892 def Run(self, args=None): | 910 def Run(self, args=None): |
893 return self.RunSteps(self._Steps(), args) | 911 return self.RunSteps(self._Steps(), args) |
OLD | NEW |