Commit 48d81b7b authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

PrettyPatch.rb: Allow to linkify any files.

We have no reason to restrict links to specific WebKit sub-directories.

Bug: 622551
Change-Id: If0ebcb1b1241cb99e80d4bfffac2a24300fd3a02
Reviewed-on: https://chromium-review.googlesource.com/989812Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547418}
parent ad7d8f49
......@@ -87,14 +87,7 @@ private
SMALLEST_EQUAL_OPERATION = 3
OPENSOURCE_URL = "https://chromium.googlesource.com/chromium/src/+/master/third_party/WebKit/"
OPENSOURCE_DIRS = Set.new %w[
LayoutTests
PerformanceTests
Source
Tools
]
OPENSOURCE_URL = "https://chromium.googlesource.com/chromium/src/+/master/"
IMAGE_CHECKSUM_ERROR = "INVALID: Image lacks a checksum. This will fail with a MISSING error in run-webkit-tests. Always generate new png files using run-webkit-tests."
......@@ -131,26 +124,8 @@ private
end
end
def self.find_url_and_path(file_path)
# Search file_path from the bottom up, at each level checking whether
# we've found a directory we know exists in the source tree.
dirname, basename = File.split(file_path)
dirname.split(/\//).reverse.inject(basename) do |path, directory|
path = directory + "/" + path
return [OPENSOURCE_URL, path] if OPENSOURCE_DIRS.include?(directory)
path
end
[nil, file_path]
end
def self.linkifyFilename(filename)
url, pathBeneathTrunk = find_url_and_path(filename)
url.nil? ? filename : "<a href='#{url}trunk/#{pathBeneathTrunk}'>#{filename}</a>"
"<a href='#{OPENSOURCE_URL}#{filename}'>#{filename}</a>"
end
......
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