| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """A subclass of commands.SVN that allows more flexible error recovery. | 5 """A subclass of commands.SVN that allows more flexible error recovery. |
| 6 | 6 |
| 7 This code is only used on the slave but it is living in common/ because it is | 7 This code is only used on the slave but it is living in common/ because it is |
| 8 directly imported from buildbot/slave/bot.py.""" | 8 directly imported from buildbot/slave/bot.py.""" |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 def __init__(self, *args, **kwargs): | 625 def __init__(self, *args, **kwargs): |
| 626 log.msg('ApplyIssue.__init__') | 626 log.msg('ApplyIssue.__init__') |
| 627 self.root = None | 627 self.root = None |
| 628 self.issue = None | 628 self.issue = None |
| 629 self.patchset = None | 629 self.patchset = None |
| 630 self.email = None | 630 self.email = None |
| 631 self.password = None | 631 self.password = None |
| 632 self.workdir = None | 632 self.workdir = None |
| 633 self.timeout = None | 633 self.timeout = None |
| 634 self.server = None | 634 self.server = None |
| 635 self.command = None |
| 635 chromium_utils.GetParentClass(ApplyIssue).__init__(self, *args, **kwargs) | 636 chromium_utils.GetParentClass(ApplyIssue).__init__(self, *args, **kwargs) |
| 636 | 637 |
| 637 def _doApplyIssue(self, _): | 638 def _doApplyIssue(self, _): |
| 638 """Run the apply_issue.py script in the source checkout directory.""" | 639 """Run the apply_issue.py script in the source checkout directory.""" |
| 639 log.msg('ApplyIssue._doApplyIssue') | 640 log.msg('ApplyIssue._doApplyIssue') |
| 640 cmd = [ | 641 cmd = [ |
| 641 'apply_issue.bat' if chromium_utils.IsWindows() else 'apply_issue', | 642 'apply_issue.bat' if chromium_utils.IsWindows() else 'apply_issue', |
| 642 '-r', self.root, | 643 '-r', self.root, |
| 643 '-i', self.issue, | 644 '-i', self.issue, |
| 644 '-p', self.patchset, | 645 '-p', self.patchset, |
| 645 '-e', self.email, | 646 '-e', self.email, |
| 646 '--no-auth', | 647 '--no-auth', |
| 647 ] | 648 ] |
| 648 | 649 |
| 649 if self.server: | 650 if self.server: |
| 650 cmd.extend(['-s', self.server]) | 651 cmd.extend(['-s', self.server]) |
| 651 | 652 |
| 652 command = runprocess.RunProcess( | 653 self.command = runprocess.RunProcess( |
| 653 self.builder, cmd, os.path.join(self.builder.basedir, self.workdir), | 654 self.builder, cmd, os.path.join(self.builder.basedir, self.workdir), |
| 654 timeout=self.timeout) | 655 timeout=self.timeout, keepStdout=True) |
| 655 return command.start() | 656 return self.command.start() |
| 656 | 657 |
| 657 # Command overrides: | 658 # Command overrides: |
| 658 | 659 |
| 659 def setup(self, args): | 660 def setup(self, args): |
| 660 self.root = args['root'] | 661 self.root = args['root'] |
| 661 self.issue = args['issue'] | 662 self.issue = args['issue'] |
| 662 self.patchset = args['patchset'] | 663 self.patchset = args['patchset'] |
| 663 self.email = args['email'] | 664 self.email = args['email'] |
| 664 self.password = args['password'] | 665 self.password = args['password'] |
| 665 self.workdir = args['workdir'] | 666 self.workdir = args['workdir'] |
| 666 self.timeout = args['timeout'] | 667 self.timeout = args['timeout'] |
| 667 self.server = args.get('server') | 668 self.server = args.get('server') |
| 668 | 669 |
| 669 def start(self): | 670 def start(self): |
| 670 log.msg('ApplyIssue.start') | 671 log.msg('ApplyIssue.start') |
| 671 d = defer.succeed(None) | 672 d = defer.succeed(None) |
| 672 d.addCallback(self._doApplyIssue) | 673 d.addCallback(self._doApplyIssue) |
| 674 d.addCallback(self._parseGotRevision) |
| 673 return d | 675 return d |
| 674 | 676 |
| 677 def _parseGotRevision(self, command): |
| 678 return self.sendStatus(extract_revisions(self.command.stdout)) |
| 679 |
| 675 | 680 |
| 676 def RegisterCommands(): | 681 def RegisterCommands(): |
| 677 """Registers all command objects defined in this file.""" | 682 """Registers all command objects defined in this file.""" |
| 678 try: | 683 try: |
| 679 # We run this code in a try because it fails with an assertion if | 684 # We run this code in a try because it fails with an assertion if |
| 680 # the module is loaded twice. | 685 # the module is loaded twice. |
| 681 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' | 686 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' |
| 682 commandRegistry['apply_issue'] = 'slave.chromium_commands.ApplyIssue' | 687 commandRegistry['apply_issue'] = 'slave.chromium_commands.ApplyIssue' |
| 683 return | 688 return |
| 684 except (AssertionError, NameError): | 689 except (AssertionError, NameError): |
| 685 pass | 690 pass |
| 686 | 691 |
| 687 | 692 |
| 688 RegisterCommands() | 693 RegisterCommands() |
| OLD | NEW |