Chromium Code Reviews| Index: build/util/lastchange.py |
| diff --git a/build/util/lastchange.py b/build/util/lastchange.py |
| index 4e5311b11dbbb2930002a5897675e0a7bec96708..c6e83db35e86517f611d0d6fc37bc4140bf9f32b 100755 |
| --- a/build/util/lastchange.py |
| +++ b/build/util/lastchange.py |
| @@ -130,13 +130,37 @@ def FetchGitSVNURL(directory): |
| SVN URL. |
| """ |
| if not IsGitSVN(directory): |
| - return None |
| + return '' |
| proc = RunGitCommand(directory, ['svn', 'info', '--url']) |
| if proc: |
| output = proc.communicate()[0].strip() |
| if proc.returncode == 0: |
| - return output |
| - return None |
| + match = re.search('^.*://.*$', output, re.M) |
|
Evan Martin
2011/03/03 19:49:31
Maybe use
r'^\w+://.*$'
just to make it harder t
Denis Lagno
2011/03/03 20:18:39
Done.
should I use those 'raw string literals'?
|
| + if match: |
| + return match.group(0) |
| + return '' |
| + |
| + |
| +def FetchGitSVNRoot(directory): |
| + """ |
| + Fetch root of SVN repository bound to git. |
|
Evan Martin
2011/03/03 19:49:31
This part of the change seems unrelated to the bug
Denis Lagno
2011/03/03 20:18:39
yes. But only now I realized how URL and Root are
|
| + |
| + Errors are swallowed. |
| + |
| + Returns: |
| + SVN root repository. |
| + """ |
| + if not IsGitSVN(directory): |
| + return '' |
| + git_command = ['config', '--get-regexp', '^svn-remote.svn.url$'] |
| + proc = RunGitCommand(directory, git_command) |
| + if proc: |
| + output = proc.communicate()[0].strip() |
| + if proc.returncode == 0: |
| + match = re.search('\S*$', output) |
| + if match: |
| + return match.group(0) |
| + return '' |
| def LookupGitSVNRevision(directory, depth): |
| @@ -148,7 +172,7 @@ def LookupGitSVNRevision(directory, depth): |
| """ |
| if not IsGitSVN(directory): |
| return None |
| - git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) |
| + git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)') |
| proc = RunGitCommand(directory, ['log', '-' + str(depth)]) |
| if proc: |
| for line in proc.stdout: |
| @@ -184,7 +208,9 @@ def FetchGitSVNRevision(directory): |
| return None |
| if IsGitSVNDirty(directory): |
| revision = revision + '-dirty' |
| - return VersionInfo(FetchGitSVNURL(directory), 'git-svn', revision) |
| + url = FetchGitSVNURL(directory) |
| + root = FetchGitSVNRoot(directory) |
| + return VersionInfo(url, root, revision) |
| def FetchVersionInfo(default_lastchange, directory=None): |