Chromium Code Reviews| Index: build/util/lastchange.py |
| diff --git a/build/util/lastchange.py b/build/util/lastchange.py |
| index 872564065c64560f5483c5a00e5124fc159654d3..04d1d07db21b22710668205ea523cd903115b75b 100755 |
| --- a/build/util/lastchange.py |
| +++ b/build/util/lastchange.py |
| @@ -140,6 +140,27 @@ def FetchGitSVNURL(directory): |
| return '' |
| +def FetchGitSVNRoot(directory): |
| + """ |
| + Fetch root of SVN repository bound to git. |
| + |
| + Errors are swallowed. |
| + |
| + Returns: |
| + SVN root repository. |
| + """ |
| + if IsGitSVN(directory): |
| + 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(r'\S+$', output) |
|
Evan Martin
2011/03/03 23:53:09
What is this regex for? Does this command sometim
Denis Lagno
2011/03/04 00:15:21
Executing it on my checkout produces:
$ git confi
|
| + if match: |
| + return match.group(0) |
| + return '' |
| + |
| + |
| def LookupGitSVNRevision(directory, depth): |
| """ |
| Fetch the Git-SVN identifier for the local tree. |
| @@ -149,7 +170,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(r'^\s*git-svn-id:\s+(\S+)@(\d+)') |
| proc = RunGitCommand(directory, ['log', '-' + str(depth)]) |
| if proc: |
| for line in proc.stdout: |
| @@ -185,7 +206,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): |