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 """ | 6 """ |
7 lastchange.py -- Chromium revision fetching utility. | 7 lastchange.py -- Chromium revision fetching utility. |
8 """ | 8 """ |
9 | 9 |
10 import re | 10 import re |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 Errors are swallowed. | 143 Errors are swallowed. |
144 """ | 144 """ |
145 url, revision = FetchGitSVNURLAndRevision(directory, svn_url_regex) | 145 url, revision = FetchGitSVNURLAndRevision(directory, svn_url_regex) |
146 if url and revision: | 146 if url and revision: |
147 return VersionInfo(url, revision) | 147 return VersionInfo(url, revision) |
148 return None | 148 return None |
149 | 149 |
150 | 150 |
151 def FetchVersionInfo(default_lastchange, directory=None, | 151 def FetchVersionInfo(default_lastchange, directory=None, |
152 directory_regex_prior_to_src_url='chrome|svn'): | 152 directory_regex_prior_to_src_url='chrome|blink|svn'): |
153 """ | 153 """ |
154 Returns the last change (in the form of a branch, revision tuple), | 154 Returns the last change (in the form of a branch, revision tuple), |
155 from some appropriate revision control system. | 155 from some appropriate revision control system. |
156 """ | 156 """ |
157 svn_url_regex = re.compile( | 157 svn_url_regex = re.compile( |
158 r'.*/(' + directory_regex_prior_to_src_url + r')(/.*)') | 158 r'.*/(' + directory_regex_prior_to_src_url + r')(/.*)') |
159 | 159 |
160 version_info = (FetchSVNRevision(directory, svn_url_regex) or | 160 version_info = (FetchSVNRevision(directory, svn_url_regex) or |
161 FetchGitSVNRevision(directory, svn_url_regex) or | 161 FetchGitSVNRevision(directory, svn_url_regex) or |
162 FetchGitRevision(directory)) | 162 FetchGitRevision(directory)) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if out_file: | 227 if out_file: |
228 WriteIfChanged(out_file, contents) | 228 WriteIfChanged(out_file, contents) |
229 else: | 229 else: |
230 sys.stdout.write(contents) | 230 sys.stdout.write(contents) |
231 | 231 |
232 return 0 | 232 return 0 |
233 | 233 |
234 | 234 |
235 if __name__ == '__main__': | 235 if __name__ == '__main__': |
236 sys.exit(main()) | 236 sys.exit(main()) |
OLD | NEW |