Index: tools/auto_bisect/source_control.py |
diff --git a/tools/auto_bisect/source_control.py b/tools/auto_bisect/source_control.py |
index fa7ded63ed5d8864fa3abc927f85851740207586..218dd77c5ea48fc504fcf50826f7bb79bd99a5fc 100644 |
--- a/tools/auto_bisect/source_control.py |
+++ b/tools/auto_bisect/source_control.py |
@@ -5,6 +5,7 @@ |
"""This module contains the SourceControl class and related functions.""" |
import os |
+import re |
from . import bisect_utils |
@@ -202,7 +203,7 @@ class GitSourceControl(SourceControl): |
return log_output == "master" |
- def SVNFindRev(self, revision, cwd=None): |
+ def SVNFindRev(self, git_revision, cwd=None): |
"""Maps directly to the 'git svn find-rev' command. |
qyearsley
2014/08/26 22:42:34
The name and description probably should be update
prasadv
2014/08/26 23:07:30
Done.
|
Args: |
@@ -212,7 +213,7 @@ class GitSourceControl(SourceControl): |
An integer changelist #, otherwise None. |
qyearsley
2014/08/26 22:42:34
This is now going to be git number (aka git commit
prasadv
2014/08/26 23:07:30
Done.
|
""" |
- cmd = ['svn', 'find-rev', revision] |
+ cmd = ['svn', 'find-rev', git_revision] |
output = bisect_utils.CheckRunGit(cmd, cwd) |
svn_revision = output.strip() |
@@ -220,6 +221,18 @@ class GitSourceControl(SourceControl): |
if bisect_utils.IsStringInt(svn_revision): |
return int(svn_revision) |
+ # Retrieve commit position number from git log body for the given revision. |
+ # TODO(prasadv): Use an appropriate command to find commit position instead |
+ # of parsing the log. Resolve this once 407316 is fixed. |
+ commit_position_pattern = 'Cr-Commit-Position: .*@\{#(?P<commit>[0-9]+)\}' |
+ cmd = ['log', '--format=%b', '-1', 'origin/master', git_revision] |
+ output = bisect_utils.CheckRunGit(cmd, cwd=cwd) |
+ if output: |
+ version_re = re.compile(commit_position_pattern) |
+ commit_reg = version_re.search(output) |
+ if commit_reg and bisect_utils.IsStringInt(commit_reg.group('commit')): |
+ return int(commit_reg.group('commit')) |
qyearsley
2014/08/26 22:42:34
This block is only executed when "git svn find-rev
prasadv
2014/08/26 23:07:30
Yes, basically everything in this method should be
|
+ |
return None |
def QueryRevisionInfo(self, revision, cwd=None): |