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 json | 10 import json |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 options.server, options.issue) | 155 options.server, options.issue) |
156 return 1 | 156 return 1 |
157 for patch in patchset.patches: | 157 for patch in patchset.patches: |
158 print(patch) | 158 print(patch) |
159 full_dir = os.path.abspath(options.root_dir) | 159 full_dir = os.path.abspath(options.root_dir) |
160 scm_type = scm.determine_scm(full_dir) | 160 scm_type = scm.determine_scm(full_dir) |
161 if scm_type == 'svn': | 161 if scm_type == 'svn': |
162 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) | 162 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) |
163 elif scm_type == 'git': | 163 elif scm_type == 'git': |
164 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None, | 164 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None, |
165 base_ref=options.base_ref) | 165 base_ref=options.base_ref,) |
166 elif scm_type == None: | 166 elif scm_type == None: |
167 scm_obj = checkout.RawCheckout(full_dir, None, None) | 167 scm_obj = checkout.RawCheckout(full_dir, None, None) |
168 else: | 168 else: |
169 parser.error('Couldn\'t determine the scm') | 169 parser.error('Couldn\'t determine the scm') |
170 | 170 |
171 # TODO(maruel): HACK, remove me. | 171 # TODO(maruel): HACK, remove me. |
172 # When run a build slave, make sure buildbot knows that the checkout was | 172 # When run a build slave, make sure buildbot knows that the checkout was |
173 # modified. | 173 # modified. |
174 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': | 174 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': |
175 # See sourcedirIsPatched() in: | 175 # See sourcedirIsPatched() in: |
176 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ | 176 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ |
177 # chromium_commands.py?view=markup | 177 # chromium_commands.py?view=markup |
178 open('.buildbot-patched', 'w').close() | 178 open('.buildbot-patched', 'w').close() |
179 | 179 |
180 print('\nApplying the patch.') | 180 print('\nApplying the patch.') |
181 try: | 181 try: |
182 scm_obj.apply_patch(patchset, verbose=True) | 182 scm_obj.apply_patch( |
| 183 patchset, verbose=True, |
| 184 email=properties.get('owner_email', 'chrome-bot@chromium.org'), |
| 185 name=properties.get('owner', 'chrome-bot')) |
183 except checkout.PatchApplicationFailed, e: | 186 except checkout.PatchApplicationFailed, e: |
184 print(str(e)) | 187 print(str(e)) |
185 print('CWD=%s' % os.getcwd()) | 188 print('CWD=%s' % os.getcwd()) |
186 print('Checkout path=%s' % scm_obj.project_path) | 189 print('Checkout path=%s' % scm_obj.project_path) |
187 return 1 | 190 return 1 |
188 | 191 |
189 if 'DEPS' in map(os.path.basename, patchset.filenames): | 192 if 'DEPS' in map(os.path.basename, patchset.filenames): |
190 gclient_root = gclient_utils.FindGclientRoot(full_dir) | 193 gclient_root = gclient_utils.FindGclientRoot(full_dir) |
191 if gclient_root and scm_type: | 194 if gclient_root and scm_type: |
192 print( | 195 print( |
(...skipping 20 matching lines...) Expand all Loading... |
213 f, options.revision_mapping) | 216 f, options.revision_mapping) |
214 annotated_gclient.emit_buildprops(revisions) | 217 annotated_gclient.emit_buildprops(revisions) |
215 | 218 |
216 return retcode | 219 return retcode |
217 return 0 | 220 return 0 |
218 | 221 |
219 | 222 |
220 if __name__ == "__main__": | 223 if __name__ == "__main__": |
221 fix_encoding.fix_encoding() | 224 fix_encoding.fix_encoding() |
222 sys.exit(main()) | 225 sys.exit(main()) |
OLD | NEW |