diff options
author | dilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 07:50:33 +0000 |
---|---|---|
committer | dilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 07:50:33 +0000 |
commit | 6255c7853ac2ab99ed8fd663afed76d63bc8cdc9 (patch) | |
tree | c9d17d2d2731d48ac0aca42731a714bc72c01e5f /build/util | |
parent | dd1605a8587bb74236f558307f560c9a36bcd8f6 (diff) | |
download | chromium_src-6255c7853ac2ab99ed8fd663afed76d63bc8cdc9.zip chromium_src-6255c7853ac2ab99ed8fd663afed76d63bc8cdc9.tar.gz chromium_src-6255c7853ac2ab99ed8fd663afed76d63bc8cdc9.tar.bz2 |
Fetch repository root for git-svn checkouts.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6609039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/util')
-rwxr-xr-x | build/util/lastchange.py | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/build/util/lastchange.py b/build/util/lastchange.py index 8725640..4d7a1fe 100755 --- a/build/util/lastchange.py +++ b/build/util/lastchange.py @@ -140,6 +140,29 @@ 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: + # Zero return code implies presence of requested configuration variable. + # Its value is second (last) field of output. + match = re.search(r'\S+$', output) + if match: + return match.group(0) + return '' + + def LookupGitSVNRevision(directory, depth): """ Fetch the Git-SVN identifier for the local tree. @@ -149,11 +172,11 @@ 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: - match = git_re.search(line) + match = git_re.match(line) if match: id = match.group(2) if id: @@ -185,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): |