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

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

Issue 511033002: Fix git log command to while processing Commit position in SVNFindRev method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | tools/bisect-perf-regression_test.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 import re 8 import re
9 9
10 from . import bisect_utils 10 from . import bisect_utils
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 output = bisect_utils.CheckRunGit(cmd, cwd) 223 output = bisect_utils.CheckRunGit(cmd, cwd)
224 svn_revision = output.strip() 224 svn_revision = output.strip()
225 225
226 if bisect_utils.IsStringInt(svn_revision): 226 if bisect_utils.IsStringInt(svn_revision):
227 return int(svn_revision) 227 return int(svn_revision)
228 228
229 # Retrieve commit position number from git log body for the given revision. 229 # Retrieve commit position number from git log body for the given revision.
230 # TODO(prasadv): Use an appropriate command to find commit position instead 230 # TODO(prasadv): Use an appropriate command to find commit position instead
231 # of parsing the log. Resolve this once 407316 is fixed. 231 # of parsing the log. Resolve this once 407316 is fixed.
232 commit_position_pattern = 'Cr-Commit-Position: .*@\{#(?P<commit>[0-9]+)\}' 232 commit_position_pattern = 'Cr-Commit-Position: .*@\{#(?P<commit>[0-9]+)\}'
233 cmd = ['log', '--format=%b', '-1', 'origin/master', git_revision] 233 cmd = ['log', '--format=%b', '-1', git_revision]
234 output = bisect_utils.CheckRunGit(cmd, cwd=cwd) 234 output = bisect_utils.CheckRunGit(cmd, cwd=cwd)
235 if output: 235 if output:
236 version_re = re.compile(commit_position_pattern) 236 version_re = re.compile(commit_position_pattern)
237 commit_reg = version_re.search(output) 237 commit_reg = version_re.search(output)
238 if commit_reg and bisect_utils.IsStringInt(commit_reg.group('commit')): 238 if commit_reg and bisect_utils.IsStringInt(commit_reg.group('commit')):
239 return int(commit_reg.group('commit')) 239 return int(commit_reg.group('commit'))
240 240
241 return None 241 return None
242 242
243 def QueryRevisionInfo(self, revision, cwd=None): 243 def QueryRevisionInfo(self, revision, cwd=None):
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 revision_end: End of revision range. 298 revision_end: End of revision range.
299 299
300 Returns: 300 Returns:
301 Returns a list of commits that touched this file. 301 Returns a list of commits that touched this file.
302 """ 302 """
303 cmd = ['log', '--format=%H', '%s~1..%s' % (revision_start, revision_end), 303 cmd = ['log', '--format=%H', '%s~1..%s' % (revision_start, revision_end),
304 '--', filename] 304 '--', filename]
305 output = bisect_utils.CheckRunGit(cmd) 305 output = bisect_utils.CheckRunGit(cmd)
306 306
307 return [o for o in output.split('\n') if o] 307 return [o for o in output.split('\n') if o]
OLDNEW
« no previous file with comments | « no previous file | tools/bisect-perf-regression_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698