Index: build/util/lastchange.py |
diff --git a/build/util/lastchange.py b/build/util/lastchange.py |
index e938c3db70dcab21275520bc9b9e94c71a4ae8c7..28a266ddaf7ad977d37f4499076b0aa84eca19c5 100755 |
--- a/build/util/lastchange.py |
+++ b/build/util/lastchange.py |
@@ -99,8 +99,6 @@ def FetchGitRevision(directory): |
Returns: |
A VersionInfo object or None on error. |
""" |
- # TODO(agable): Re-add the commit position after the lastchange value can |
- # accept strings longer than 64 characters. See crbug.com/406783. |
hsh = '' |
proc = RunGitCommand(directory, ['rev-parse', 'HEAD']) |
if proc: |
@@ -109,9 +107,17 @@ def FetchGitRevision(directory): |
hsh = output |
if not hsh: |
return None |
- # TODO(agable): Figure out a way to use the full hash instead of just a |
- # 12-character short hash. See crbug.com/406783. |
- return VersionInfo('git', hsh[:12]) |
+ pos = '' |
+ proc = RunGitCommand(directory, ['show', '-s', '--format=%B', 'HEAD']) |
+ if proc: |
+ output = proc.communicate()[0] |
+ if proc.returncode == 0 and output: |
+ for line in reversed(output.splitlines()): |
+ if line.startswith('Cr-Commit-Position:'): |
+ pos = line.rsplit()[-1].strip() |
+ if not pos: |
+ return VersionInfo('git', hsh) |
+ return VersionInfo('git', '%s-%s' % (hsh, pos)) |
def FetchGitSVNURLAndRevision(directory, svn_url_regex): |