| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Applies an issue from Rietveld. | 6 """Applies an issue from Rietveld. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import getpass |
| 9 import logging | 10 import logging |
| 10 import optparse | 11 import optparse |
| 11 import os | 12 import os |
| 12 import sys | 13 import sys |
| 13 import urllib2 | 14 import urllib2 |
| 14 | 15 |
| 15 import breakpad # pylint: disable=W0611 | 16 import breakpad # pylint: disable=W0611 |
| 16 | 17 |
| 17 import checkout | 18 import checkout |
| 18 import fix_encoding | 19 import fix_encoding |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 scm_type = scm.determine_scm(options.root_dir) | 87 scm_type = scm.determine_scm(options.root_dir) |
| 87 if scm_type == 'svn': | 88 if scm_type == 'svn': |
| 88 scm_obj = checkout.SvnCheckout(options.root_dir, None, None, None, None) | 89 scm_obj = checkout.SvnCheckout(options.root_dir, None, None, None, None) |
| 89 elif scm_type == 'git': | 90 elif scm_type == 'git': |
| 90 scm_obj = checkout.GitCheckoutBase(options.root_dir, None, None) | 91 scm_obj = checkout.GitCheckoutBase(options.root_dir, None, None) |
| 91 elif scm_type == None: | 92 elif scm_type == None: |
| 92 scm_obj = checkout.RawCheckout(options.root_dir, None, None) | 93 scm_obj = checkout.RawCheckout(options.root_dir, None, None) |
| 93 else: | 94 else: |
| 94 parser.error('Couldn\'t determine the scm') | 95 parser.error('Couldn\'t determine the scm') |
| 95 | 96 |
| 97 # TODO(maruel): HACK, remove me. |
| 98 # When run a build slave, make sure buildbot knows that the checkout was |
| 99 # modified. |
| 100 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': |
| 101 # See sourcedirIsPatched() in: |
| 102 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ |
| 103 # chromium_commands.py?view=markup |
| 104 open('.buildbot-patched', 'w').close() |
| 105 |
| 96 # Apply the patch. | 106 # Apply the patch. |
| 97 try: | 107 try: |
| 98 scm_obj.apply_patch(patchset) | 108 scm_obj.apply_patch(patchset) |
| 99 except checkout.PatchApplicationFailed, e: | 109 except checkout.PatchApplicationFailed, e: |
| 100 print >> sys.stderr, str(e) | 110 print >> sys.stderr, str(e) |
| 101 return 1 | 111 return 1 |
| 102 return 0 | 112 return 0 |
| 103 | 113 |
| 104 | 114 |
| 105 if __name__ == "__main__": | 115 if __name__ == "__main__": |
| 106 fix_encoding.fix_encoding() | 116 fix_encoding.fix_encoding() |
| 107 sys.exit(main()) | 117 sys.exit(main()) |
| OLD | NEW |