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

Side by Side Diff: tools/auto_bisect/source_control.py

Issue 468633005: Quick spelling clean-up in the auto-bisect code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/auto_bisect/math_utils.py ('k') | tools/bisect-perf-regression.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 the SourceControl class and related functions.""" 5 """This module contains the SourceControl class and related functions."""
6 6
7 import os 7 import os
8 8
9 from . import bisect_utils 9 from . import bisect_utils
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 class SourceControl(object): 30 class SourceControl(object):
31 """SourceControl is an abstraction over the source control system.""" 31 """SourceControl is an abstraction over the source control system."""
32 32
33 def __init__(self): 33 def __init__(self):
34 super(SourceControl, self).__init__() 34 super(SourceControl, self).__init__()
35 35
36 def SyncToRevisionWithGClient(self, revision): 36 def SyncToRevisionWithGClient(self, revision):
37 """Uses gclient to sync to the specified revision. 37 """Uses gclient to sync to the specified revision.
38 38
39 ie. gclient sync --revision <revision> 39 This is like running gclient sync --revision <revision>.
40 40
41 Args: 41 Args:
42 revision: The git SHA1 or svn CL (depending on workflow). 42 revision: A git SHA1 hash or SVN revision number (depending on workflow).
43 43
44 Returns: 44 Returns:
45 The return code of the call. 45 The return code of the call.
46 """ 46 """
47 return bisect_utils.RunGClient(['sync', '--verbose', '--reset', '--force', 47 return bisect_utils.RunGClient(['sync', '--verbose', '--reset', '--force',
48 '--delete_unversioned_trees', '--nohooks', '--revision', revision]) 48 '--delete_unversioned_trees', '--nohooks', '--revision', revision])
49 49
50 def SyncToRevisionWithRepo(self, timestamp): 50 def SyncToRevisionWithRepo(self, timestamp):
51 """Uses repo to sync all the underlying git depots to the specified 51 """Uses the repo command to sync all the underlying git depots to the
52 time. 52 specified time.
53 53
54 Args: 54 Args:
55 timestamp: The unix timestamp to sync to. 55 timestamp: The Unix timestamp to sync to.
56 56
57 Returns: 57 Returns:
58 The return code of the call. 58 The return code of the call.
59 """ 59 """
60 return bisect_utils.RunRepoSyncAtTimestamp(timestamp) 60 return bisect_utils.RunRepoSyncAtTimestamp(timestamp)
61 61
62 62
63 class GitSourceControl(SourceControl): 63 class GitSourceControl(SourceControl):
64 """GitSourceControl is used to query the underlying source control.""" 64 """GitSourceControl is used to query the underlying source control."""
65 65
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return int(svn_revision) 220 return int(svn_revision)
221 221
222 return None 222 return None
223 223
224 def QueryRevisionInfo(self, revision, cwd=None): 224 def QueryRevisionInfo(self, revision, cwd=None):
225 """Gathers information on a particular revision, such as author's name, 225 """Gathers information on a particular revision, such as author's name,
226 email, subject, and date. 226 email, subject, and date.
227 227
228 Args: 228 Args:
229 revision: Revision you want to gather information on. 229 revision: Revision you want to gather information on.
230
230 Returns: 231 Returns:
231 A dict in the following format: 232 A dict in the following format:
232 { 233 {
233 'author': %s, 234 'author': %s,
234 'email': %s, 235 'email': %s,
235 'date': %s, 236 'date': %s,
236 'subject': %s, 237 'subject': %s,
237 'body': %s, 238 'body': %s,
238 } 239 }
239 """ 240 """
(...skipping 12 matching lines...) Expand all
252 def CheckoutFileAtRevision(self, file_name, revision, cwd=None): 253 def CheckoutFileAtRevision(self, file_name, revision, cwd=None):
253 """Performs a checkout on a file at the given revision. 254 """Performs a checkout on a file at the given revision.
254 255
255 Returns: 256 Returns:
256 True if successful. 257 True if successful.
257 """ 258 """
258 return not bisect_utils.RunGit( 259 return not bisect_utils.RunGit(
259 ['checkout', revision, file_name], cwd=cwd)[1] 260 ['checkout', revision, file_name], cwd=cwd)[1]
260 261
261 def RevertFileToHead(self, file_name): 262 def RevertFileToHead(self, file_name):
262 """Unstages a file and returns it to HEAD. 263 """Un-stages a file and resets the file's state to HEAD.
263 264
264 Returns: 265 Returns:
265 True if successful. 266 True if successful.
266 """ 267 """
267 # Reset doesn't seem to return 0 on success. 268 # Reset doesn't seem to return 0 on success.
268 bisect_utils.RunGit(['reset', 'HEAD', file_name]) 269 bisect_utils.RunGit(['reset', 'HEAD', file_name])
269 270
270 return not bisect_utils.RunGit(['checkout', bisect_utils.FILE_DEPS_GIT])[1] 271 return not bisect_utils.RunGit(['checkout', bisect_utils.FILE_DEPS_GIT])[1]
271 272
272 def QueryFileRevisionHistory(self, filename, revision_start, revision_end): 273 def QueryFileRevisionHistory(self, filename, revision_start, revision_end):
273 """Returns a list of commits that modified this file. 274 """Returns a list of commits that modified this file.
274 275
275 Args: 276 Args:
276 filename: Name of file. 277 filename: Name of file.
277 revision_start: Start of revision range. 278 revision_start: Start of revision range.
278 revision_end: End of revision range. 279 revision_end: End of revision range.
279 280
280 Returns: 281 Returns:
281 Returns a list of commits that touched this file. 282 Returns a list of commits that touched this file.
282 """ 283 """
283 cmd = ['log', '--format=%H', '%s~1..%s' % (revision_start, revision_end), 284 cmd = ['log', '--format=%H', '%s~1..%s' % (revision_start, revision_end),
284 filename] 285 filename]
285 output = bisect_utils.CheckRunGit(cmd) 286 output = bisect_utils.CheckRunGit(cmd)
286 287
287 return [o for o in output.split('\n') if o] 288 return [o for o in output.split('\n') if o]
OLDNEW
« no previous file with comments | « tools/auto_bisect/math_utils.py ('k') | tools/bisect-perf-regression.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698