| 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 getpass |
| 10 import logging | 10 import logging |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 # TODO(maruel): HACK, remove me. | 126 # TODO(maruel): HACK, remove me. |
| 127 # When run a build slave, make sure buildbot knows that the checkout was | 127 # When run a build slave, make sure buildbot knows that the checkout was |
| 128 # modified. | 128 # modified. |
| 129 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': | 129 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': |
| 130 # See sourcedirIsPatched() in: | 130 # See sourcedirIsPatched() in: |
| 131 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ | 131 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ |
| 132 # chromium_commands.py?view=markup | 132 # chromium_commands.py?view=markup |
| 133 open('.buildbot-patched', 'w').close() | 133 open('.buildbot-patched', 'w').close() |
| 134 | 134 |
| 135 # Apply the patch. | 135 print('\nApplying the patch.') |
| 136 try: | 136 try: |
| 137 scm_obj.apply_patch(patchset) | 137 scm_obj.apply_patch(patchset, verbose=True) |
| 138 except checkout.PatchApplicationFailed, e: | 138 except checkout.PatchApplicationFailed, e: |
| 139 print >> sys.stderr, str(e) | 139 print >> sys.stderr, str(e) |
| 140 return 1 | 140 return 1 |
| 141 | 141 |
| 142 if 'DEPS' in map(os.path.basename, patchset.filenames): | 142 if 'DEPS' in map(os.path.basename, patchset.filenames): |
| 143 gclient_root = gclient_utils.FindGclientRoot(options.root_dir) | 143 gclient_root = gclient_utils.FindGclientRoot(options.root_dir) |
| 144 if gclient_root and scm_type: | 144 if gclient_root and scm_type: |
| 145 print( | 145 print( |
| 146 'A DEPS file was updated inside a gclient checkout, running gclient ' | 146 'A DEPS file was updated inside a gclient checkout, running gclient ' |
| 147 'sync.') | 147 'sync.') |
| 148 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' | 148 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' |
| 149 gclient_path = os.path.join(BASE_DIR, 'gclient') | 149 gclient_path = os.path.join(BASE_DIR, 'gclient') |
| 150 if sys.platform == 'win32': | 150 if sys.platform == 'win32': |
| 151 gclient_path += '.bat' | 151 gclient_path += '.bat' |
| 152 return subprocess.call( | 152 return subprocess.call( |
| 153 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) | 153 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) |
| 154 return 0 | 154 return 0 |
| 155 | 155 |
| 156 | 156 |
| 157 if __name__ == "__main__": | 157 if __name__ == "__main__": |
| 158 fix_encoding.fix_encoding() | 158 fix_encoding.fix_encoding() |
| 159 sys.exit(main()) | 159 sys.exit(main()) |
| OLD | NEW |