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 """Generate a CL to roll a DEPS entry to the specified revision number and post | 6 """Generate a CL to roll a DEPS entry to the specified revision number and post |
7 it to Rietveld so that the CL will land automatically if it passes the | 7 it to Rietveld so that the CL will land automatically if it passes the |
8 commit-queue's checks. | 8 commit-queue's checks. |
9 """ | 9 """ |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 def process_deps(path, project, new_rev, is_dry_run): | 27 def process_deps(path, project, new_rev, is_dry_run): |
28 """Update project_revision to |new_issue|. | 28 """Update project_revision to |new_issue|. |
29 | 29 |
30 A bit hacky, could it be made better? | 30 A bit hacky, could it be made better? |
31 """ | 31 """ |
32 content = open(path).read() | 32 content = open(path).read() |
33 # Hack for Blink to get the AutoRollBot running again. | 33 # Hack for Blink to get the AutoRollBot running again. |
34 if project == "blink": | 34 if project == "blink": |
35 project = "webkit" | 35 project = "webkit" |
36 old_line = r'(\s+)"%s_revision": "([0-9a-f]{2,40})",' % project | 36 old_line = r"(\s+)'%s_revision': '([0-9a-f]{2,40})'," % project |
37 new_line = r'\1"%s_revision": "%s",' % (project, new_rev) | 37 new_line = r"\1'%s_revision': '%s'," % (project, new_rev) |
38 new_content = re.sub(old_line, new_line, content, 1) | 38 new_content = re.sub(old_line, new_line, content, 1) |
39 old_rev = re.search(old_line, content).group(2) | 39 old_rev = re.search(old_line, content).group(2) |
40 if not old_rev or new_content == content: | 40 if not old_rev or new_content == content: |
41 die_with_error('Failed to update the DEPS file') | 41 die_with_error('Failed to update the DEPS file') |
42 | 42 |
43 if not is_dry_run: | 43 if not is_dry_run: |
44 open(path, 'w').write(new_content) | 44 open(path, 'w').write(new_content) |
45 return old_rev | 45 return old_rev |
46 | 46 |
47 | 47 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 prnt_subprocess.check_call(upload_cmd) | 152 prnt_subprocess.check_call(upload_cmd) |
153 finally: | 153 finally: |
154 if not options.dry_run: | 154 if not options.dry_run: |
155 prnt_subprocess.check_output(['git', 'checkout', old_branch]) | 155 prnt_subprocess.check_output(['git', 'checkout', old_branch]) |
156 prnt_subprocess.check_output(['git', 'branch', '-D', new_branch]) | 156 prnt_subprocess.check_output(['git', 'branch', '-D', new_branch]) |
157 return 0 | 157 return 0 |
158 | 158 |
159 | 159 |
160 if __name__ == '__main__': | 160 if __name__ == '__main__': |
161 sys.exit(main()) | 161 sys.exit(main()) |
OLD | NEW |