OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """This module contains functions for performing source control operations.""" | 5 """This module contains functions for performing source control operations.""" |
6 | 6 |
7 import os | 7 import os |
8 | 8 |
9 import bisect_utils | 9 import bisect_utils |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 log_output = bisect_utils.CheckRunGit(cmd, cwd=cwd) | 52 log_output = bisect_utils.CheckRunGit(cmd, cwd=cwd) |
53 | 53 |
54 revision_hash_list = log_output.split() | 54 revision_hash_list = log_output.split() |
55 revision_hash_list.append(start_revision_hash) | 55 revision_hash_list.append(start_revision_hash) |
56 | 56 |
57 return revision_hash_list | 57 return revision_hash_list |
58 | 58 |
59 | 59 |
60 def SyncToRevision(revision, sync_client=None): | 60 def SyncToRevision(revision, sync_client=None): |
61 if not sync_client: | 61 if not sync_client: |
62 _, return_code = bisect_utils.RunGit(['checkout', revision])[1] | 62 _, return_code = bisect_utils.RunGit(['checkout', revision]) |
63 elif sync_client == 'gclient': | 63 elif sync_client == 'gclient': |
64 return_code = SyncToRevisionWithGClient(revision) | 64 return_code = SyncToRevisionWithGClient(revision) |
65 elif sync_client == 'repo': | 65 elif sync_client == 'repo': |
66 return_code = SyncToRevisionWithRepo(revision) | 66 return_code = SyncToRevisionWithRepo(revision) |
67 else: | 67 else: |
68 raise NotImplementedError('Unsupported sync_client: "%s"' % sync_client) | 68 raise NotImplementedError('Unsupported sync_client: "%s"' % sync_client) |
69 | 69 |
70 return not return_code | 70 return not return_code |
71 | 71 |
72 | 72 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 'log', | 254 'log', |
255 '--format=%H', | 255 '--format=%H', |
256 '%s~1..%s' % (revision_start, revision_end), | 256 '%s~1..%s' % (revision_start, revision_end), |
257 '--', | 257 '--', |
258 filename, | 258 filename, |
259 ] | 259 ] |
260 output = bisect_utils.CheckRunGit(cmd) | 260 output = bisect_utils.CheckRunGit(cmd) |
261 lines = output.split('\n') | 261 lines = output.split('\n') |
262 return [o for o in lines if o] | 262 return [o for o in lines if o] |
263 | 263 |
OLD | NEW |