Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2189)

Unified Diff: build/util/lastchange.py

Issue 6609039: Fetch repository root for git-svn checkouts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: c Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/util/lastchange.py
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index 872564065c64560f5483c5a00e5124fc159654d3..a3f9508f3e0abc0a5af2f7c1656f168b630d1088 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/04 00:17:05 Ah, I see. You want to grab the right half of the
Denis Lagno 2011/03/04 00:49:21 Done.
+ if match:
+ return match.group(0)
+ return ''
+
+
def LookupGitSVNRevision(directory, depth):
"""
Fetch the Git-SVN identifier for the local tree.
@@ -149,11 +170,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 +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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698