Chromium Code Reviews| Index: tools/auto_bisect/source_control.py |
| diff --git a/tools/auto_bisect/source_control.py b/tools/auto_bisect/source_control.py |
| index 7946aa8ec87d2b4c85bad65bab4aa6ce5f5cfb1b..15d4c1508e92d7a05d4c732ed2e6ec51645af1e1 100644 |
| --- a/tools/auto_bisect/source_control.py |
| +++ b/tools/auto_bisect/source_control.py |
| @@ -12,22 +12,6 @@ def IsInGitRepository(): |
| return output.strip() == 'true' |
| -def SyncToRevisionWithGClient(revision): |
| - """Uses gclient to sync to the specified revision. |
| - |
| - This is like running gclient sync --revision <revision>. |
| - |
| - Args: |
| - revision: A git SHA1 hash or SVN revision number (depending on workflow). |
| - |
| - Returns: |
| - The return code of the call. |
| - """ |
| - return bisect_utils.RunGClient( |
| - ['sync', '--verbose', '--reset', '--force', |
| - '--delete_unversioned_trees', '--nohooks', '--revision', revision]) |
| - |
| - |
| def GetRevisionList(end_revision_hash, start_revision_hash, cwd=None): |
| """Retrieves a list of git commit hashes in a range. |
| @@ -53,7 +37,7 @@ def SyncToRevision(revision, sync_client=None): |
| if not sync_client: |
| _, return_code = bisect_utils.RunGit(['checkout', revision]) |
| elif sync_client == 'gclient': |
| - return_code = SyncToRevisionWithGClient(revision) |
| + return_code = bisect_utils.RunGClientAndSync(revision) |
| else: |
| raise NotImplementedError('Unsupported sync_client: "%s"' % sync_client) |
| @@ -139,17 +123,12 @@ def GetCommitPosition(git_revision, cwd=None): |
| """ |
| # Some of the respositories are pure git based, unlike other repositories |
| # they doesn't have commit position. e.g., skia, angle. |
| - no_commit_position_repos = ['angle', 'skia'] |
| - if cwd and any(repo in cwd for repo in no_commit_position_repos): |
| - return None |
| - |
| cmd = ['footers', '--position-num', git_revision] |
| - output = bisect_utils.CheckRunGit(cmd, cwd) |
| - commit_position = output.strip() |
| - |
| - if bisect_utils.IsStringInt(commit_position): |
| - return int(commit_position) |
| - |
| + output, return_code = bisect_utils.RunGit(cmd, cwd) |
| + if not return_code: |
| + commit_position = output.strip() |
| + if bisect_utils.IsStringInt(commit_position): |
| + return int(commit_position) |
| return None |
| @@ -229,3 +208,9 @@ def QueryFileRevisionHistory(filename, revision_start, revision_end): |
| lines = output.split('\n') |
| return [o for o in lines if o] |
| +def GetCommitTime(git_revision, cwd=None): |
| + """Returns commit time for the given revision.""" |
|
qyearsley
2014/12/11 23:51:06
This could go up next to GetCommitPosition, with t
|
| + cmd = ['log', '--format=%ct', '-1', git_revision] |
| + output = bisect_utils.CheckRunGit(cmd, cwd=cwd) |
| + return int(output) |
| + |