Commit ccfc9db1 authored by prasadv's avatar prasadv Committed by Commit bot

Fix issues caused due to GitMigration.

BUG=
NOTRY=True

Review URL: https://codereview.chromium.org/503283002

Cr-Commit-Position: refs/heads/master@{#291909}
parent aea4a57a
......@@ -285,18 +285,34 @@ def RunGClientAndCreateConfig(opts, custom_deps=None, cwd=None):
return return_code
def IsDepsFileBlink():
def IsDepsFileBlink(git_revision=''):
"""Reads .DEPS.git and returns whether or not we're using blink.
Args:
git_revision: A git hash revision of chromium.
Returns:
True if blink, false if webkit.
"""
locals = {
git_cmd = ['cat-file', 'blob', '%s:%s' %(git_revision, FILE_DEPS_GIT)]
search_str = 'blink.git'
search_key = 'webkit_url'
(out_put, ret_val) = RunGit(git_cmd)
if ret_val:
search_str = 'blink'
search_key = 'webkit_trunk'
git_cmd = ['cat-file', 'blob', '%s:%s' %(git_revision, 'FILE_DEPS')]
(out_put, ret_val) = RunGit(git_cmd)
if ret_val:
print 'Error processing DEPS or .DEPS.git'
return False
locals = {
'Var': lambda _: locals["vars"][_],
'From': lambda *args: None
}
execfile(FILE_DEPS_GIT, {}, locals)
return 'blink.git' in locals['vars']['webkit_url']
exec out_put in {}, locals
return search_str in locals['vars'][search_key]
def OnAccessError(func, path, _):
......
......@@ -283,7 +283,7 @@ class GitSourceControl(SourceControl):
Returns a list of commits that touched this file.
"""
cmd = ['log', '--format=%H', '%s~1..%s' % (revision_start, revision_end),
filename]
'--', filename]
output = bisect_utils.CheckRunGit(cmd)
return [o for o in output.split('\n') if o]
......@@ -1067,7 +1067,11 @@ class BisectPerformanceMetrics(object):
'Var': lambda _: deps_data["vars"][_],
'From': lambda *args: None,
}
execfile(bisect_utils.FILE_DEPS_GIT, {}, deps_data)
deps_file = bisect_utils.FILE_DEPS_GIT
if not os.path.exists(deps_file):
deps_file = bisect_utils.FILE_DEPS
execfile(deps_file, {}, deps_data)
deps_data = deps_data['deps']
rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)")
......@@ -1095,7 +1099,7 @@ class BisectPerformanceMetrics(object):
results[depot_name] = None
return results
except ImportError:
deps_file_contents = ReadStringFromFile(bisect_utils.FILE_DEPS_GIT)
deps_file_contents = ReadStringFromFile(deps_file)
parse_results = _ParseRevisionsFromDEPSFileManually(deps_file_contents)
results = {}
for depot_name, depot_revision in parse_results.iteritems():
......@@ -1777,21 +1781,13 @@ class BisectPerformanceMetrics(object):
Returns:
True if successful.
"""
if not self.source_control.CheckoutFileAtRevision(
bisect_utils.FILE_DEPS_GIT, revision, cwd=self.src_cwd):
return False
cwd = os.getcwd()
os.chdir(self.src_cwd)
is_blink = bisect_utils.IsDepsFileBlink()
is_blink = bisect_utils.IsDepsFileBlink(revision)
os.chdir(cwd)
if not self.source_control.RevertFileToHead(
bisect_utils.FILE_DEPS_GIT):
return False
if self.was_blink != is_blink:
self.was_blink = is_blink
# Removes third_party/Webkit directory.
......@@ -2175,18 +2171,25 @@ class BisectPerformanceMetrics(object):
if self.opts.output_buildbot_annotations:
bisect_utils.OutputAnnotationStepClosed()
def NudgeRevisionsIfDEPSChange(self, bad_revision, good_revision):
def NudgeRevisionsIfDEPSChange(self, bad_revision, good_revision,
good_svn_revision=None):
"""Checks to see if changes to DEPS file occurred, and that the revision
range also includes the change to .DEPS.git. If it doesn't, attempts to
expand the revision range to include it.
Args:
bad_rev: First known bad revision.
good_revision: Last known good revision.
bad_revision: First known bad git revision.
good_revision: Last known good git revision.
good_svn_revision: Last known good svn revision.
Returns:
A tuple with the new bad and good revisions.
"""
# DONOT perform nudge because at revision 291563 .DEPS.git was removed
# and source contain only DEPS file for dependency changes.
if good_svn_revision >= 291563:
return (bad_revision, good_revision)
if self.source_control.IsGit() and self.opts.target_platform == 'chromium':
changes_to_deps = self.source_control.QueryFileRevisionHistory(
'DEPS', good_revision, bad_revision)
......@@ -2208,7 +2211,7 @@ class BisectPerformanceMetrics(object):
# next 15 minutes after the DEPS file change.
cmd = ['log', '--format=%H', '-1',
'--before=%d' % (commit_time + 900), '--after=%d' % commit_time,
'origin/master', bisect_utils.FILE_DEPS_GIT]
'origin/master', '--', bisect_utils.FILE_DEPS_GIT]
output = bisect_utils.CheckRunGit(cmd)
output = output.strip()
if output:
......@@ -2338,7 +2341,6 @@ class BisectPerformanceMetrics(object):
good_revision_in, target_depot, DEPOT_DEPS_NAME, -100)
os.chdir(cwd)
if bad_revision is None:
results['error'] = 'Couldn\'t resolve [%s] to SHA1.' % bad_revision_in
return results
......@@ -2353,10 +2355,8 @@ class BisectPerformanceMetrics(object):
results['error'] = ('bad_revision < good_revision, did you swap these '
'by mistake?')
return results
bad_revision, good_revision = self.NudgeRevisionsIfDEPSChange(
bad_revision, good_revision)
bad_revision, good_revision, good_revision_in)
if self.opts.output_buildbot_annotations:
bisect_utils.OutputAnnotationStepStart('Gathering Revisions')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment