OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
7 | 7 |
8 import cStringIO | 8 import cStringIO |
9 import codecs | 9 import codecs |
10 import collections | 10 import collections |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1128 |
1129 # Only try once, since subsequent failures hide the real failure. | 1129 # Only try once, since subsequent failures hide the real failure. |
1130 try: | 1130 try: |
1131 call(*cmd, tries=1) | 1131 call(*cmd, tries=1) |
1132 except SubprocessFailed as e: | 1132 except SubprocessFailed as e: |
1133 raise PatchFailed(e.message, e.code, e.output) | 1133 raise PatchFailed(e.message, e.code, e.output) |
1134 | 1134 |
1135 def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset): | 1135 def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset): |
1136 gerrit_repo = gerrit_repo or 'origin' | 1136 gerrit_repo = gerrit_repo or 'origin' |
1137 assert gerrit_ref | 1137 assert gerrit_ref |
| 1138 print '===Applying gerrit ref===' |
| 1139 print 'Repo is %r, ref is %r, root is %r' % (gerrit_repo, gerrit_ref, root) |
1138 try: | 1140 try: |
1139 base_rev = git('rev-parse', 'HEAD', cwd=root).strip() | 1141 base_rev = git('rev-parse', 'HEAD', cwd=root).strip() |
1140 git('retry', 'fetch', gerrit_repo, gerrit_ref, cwd=root, tries=1) | 1142 git('retry', 'fetch', gerrit_repo, gerrit_ref, cwd=root, tries=1) |
1141 git('checkout', 'FETCH_HEAD', cwd=root) | 1143 git('checkout', 'FETCH_HEAD', cwd=root) |
1142 if gerrit_reset: | 1144 if gerrit_reset: |
1143 git('reset', '--soft', base_rev, cwd=root) | 1145 git('reset', '--soft', base_rev, cwd=root) |
1144 except SubprocessFailed as e: | 1146 except SubprocessFailed as e: |
1145 raise PatchFailed(e.message, e.code, e.output) | 1147 raise PatchFailed(e.message, e.code, e.output) |
1146 | 1148 |
1147 def check_flag(flag_file): | 1149 def check_flag(flag_file): |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 # Calling git directly because there is no way to run Gclient without | 1306 # Calling git directly because there is no way to run Gclient without |
1305 # invoking DEPS. | 1307 # invoking DEPS. |
1306 print 'Fetching Git checkout' | 1308 print 'Fetching Git checkout' |
1307 | 1309 |
1308 git_ref = git_checkout(solutions, revisions, shallow, refs, git_cache_dir) | 1310 git_ref = git_checkout(solutions, revisions, shallow, refs, git_cache_dir) |
1309 | 1311 |
1310 patches = None | 1312 patches = None |
1311 if patch_url: | 1313 if patch_url: |
1312 patches = get_svn_patch(patch_url) | 1314 patches = get_svn_patch(patch_url) |
1313 | 1315 |
| 1316 print '===Processing patch solutions===' |
1314 already_patched = [] | 1317 already_patched = [] |
1315 patch_root = patch_root or '' | 1318 patch_root = patch_root or '' |
| 1319 print 'Patch root is %r' % patch_root |
1316 for solution in solutions: | 1320 for solution in solutions: |
| 1321 print 'Processing solution %r' % solution['name'] |
1317 if (patch_root == solution['name'] or | 1322 if (patch_root == solution['name'] or |
1318 solution['name'].startswith(patch_root + '/')): | 1323 solution['name'].startswith(patch_root + '/')): |
1319 relative_root = solution['name'][len(patch_root) + 1:] | 1324 relative_root = solution['name'][len(patch_root) + 1:] |
1320 target = '/'.join([relative_root, 'DEPS']).lstrip('/') | 1325 target = '/'.join([relative_root, 'DEPS']).lstrip('/') |
| 1326 print ' relative root is %r, target is %r' % (relative_root, target) |
1321 if patches: | 1327 if patches: |
1322 apply_svn_patch(patch_root, patches, whitelist=[target]) | 1328 apply_svn_patch(patch_root, patches, whitelist=[target]) |
1323 already_patched.append(target) | 1329 already_patched.append(target) |
1324 elif issue: | 1330 elif issue: |
1325 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, | 1331 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, |
1326 revision_mapping, git_ref, apply_issue_email_file, | 1332 revision_mapping, git_ref, apply_issue_email_file, |
1327 apply_issue_key_file, whitelist=[target]) | 1333 apply_issue_key_file, whitelist=[target]) |
1328 already_patched.append(target) | 1334 already_patched.append(target) |
1329 | 1335 |
1330 if not buildspec: | 1336 if not buildspec: |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 except Exception: | 1761 except Exception: |
1756 # Unexpected failure. | 1762 # Unexpected failure. |
1757 emit_flag(options.flag_file) | 1763 emit_flag(options.flag_file) |
1758 raise | 1764 raise |
1759 else: | 1765 else: |
1760 emit_flag(options.flag_file) | 1766 emit_flag(options.flag_file) |
1761 | 1767 |
1762 | 1768 |
1763 if __name__ == '__main__': | 1769 if __name__ == '__main__': |
1764 sys.exit(main()) | 1770 sys.exit(main()) |
OLD | NEW |