Commit 270213ea authored by stgao's avatar stgao Committed by Commit bot

[Findit] Fix blame for GIT and uptake bug fix.

NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#292319}
parent e17795cf
......@@ -124,6 +124,9 @@ class BlameList(object):
file_path = stack_frame.file_path
crashed_line_number = stack_frame.crashed_line_range[0]
if file_path.startswith(component_path):
file_path = file_path[len(component_path):]
# Parse blame information.
parsed_blame_info = repository_parser.ParseBlameInfo(
component_path, file_path, crashed_line_number, crash_revision)
......
......@@ -5,6 +5,7 @@
import base64
import json
import os
import re
import time
import urllib2
......@@ -14,6 +15,7 @@ from common import utils
_THIS_DIR = os.path.abspath(os.path.dirname(__file__))
CONFIG = json.loads(open(os.path.join(_THIS_DIR,
'deps_config.json'), 'r').read())
OLD_GIT_URL_PATTERN = re.compile(r'https?://git.chromium.org/(.*)')
class _VarImpl(object):
......@@ -147,6 +149,9 @@ def GetChromiumComponents(chromium_revision,
name = _GetComponentName(component_path, host_dirs)
repository, revision = component_repo_url.split('@')
match = OLD_GIT_URL_PATTERN.match(repository)
if match:
repository = 'https://chromium.googlesource.com/%s' % match.group(1)
is_git_hash = utils.IsGitHash(revision)
if is_git_hash:
repository_type = 'git'
......
......@@ -231,7 +231,7 @@ def GetDataFromURL(url, retries=10, sleep_time=0.1, timeout=5):
# Retrieves data from URL.
try:
status_code, data = utils.GetHttpClient().Get(url, timeout=timeout)
except IOError:
except IOError as e:
status_code = -1
data = None
......@@ -370,7 +370,7 @@ def PrettifyFrameInfo(frame_indices, functions):
"""Return a string to represent the frames with functions."""
frames = []
for frame_index, function in zip(frame_indices, functions):
frames.append('frame #%s, function "%s"' % (frame_index, function))
frames.append('frame #%s, "%s"' % (frame_index, function.split('(')[0]))
return '; '.join(frames)
......
......@@ -477,8 +477,8 @@ def GenerateReasonForMatches(matches):
pretty_file_names = crash_utils.PrettifyList(file_names)
# Add the reason, break because we took care of the rest of the files.
file_string += '(%s)' % crash_utils.PrettifyFrameInfo(
stack_frame_indices, function_list)
file_string += ('(and is part of stack %s)' %
crash_utils.PrettifyFrameInfo(stack_frame_indices, function_list))
reason.append(file_string % pretty_file_names)
break
......@@ -522,8 +522,8 @@ def CombineMatches(matches):
if match.min_distance_info:
file_name, min_crashed_line, min_changed_line = match.min_distance_info
match.reason += \
('Minimum distance from crashed line to changed line: %d. '
'(File: %s, Crashed on: %d, Changed: %d).\n' %
('\nMinimum distance from crash line to modified line: %d. '
'(file: %s, crashed on: %d, modified: %d).\n' %
(match.min_distance, file_name, min_crashed_line, min_changed_line))
return combined_matches
......@@ -668,8 +668,8 @@ def FindItForCrash(stacktrace_list,
if result:
return_message = (
'No CL in the regression changes the crashed files. The result is '
'the blame information.')
'No CL in the regression range changes the crashed files. '
'The result is the blame information.')
# When findit could not find any CL that changes file in stacktrace or if
# if cannot get any blame information, return a message saying that no
......
......@@ -294,6 +294,13 @@ class Stacktrace(object):
# Return a new stack frame object with the parsed information.
file_name = file_path.split('/')[-1]
# If we have the common stack frame index pattern, then use it
# since it is more reliable.
index_match = re.match('\s*#(\d+)\s.*', line)
if index_match:
stack_frame_index = int(index_match.group(1))
return StackFrame(stack_frame_index, component_path, component_name,
file_name, function, file_path, crashed_line_range)
......
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