Changeset 34175 in webkit


Ignore:
Timestamp:
May 28, 2008 10:31:37 AM (16 years ago)
Author:
Adam Roben
Message:

Make PrettyPatch able to handle diffs taken from outside the WebKit source tree

Part of Bug 19290: More patches not handled by PrettyPatch.rb
<https://bugs.webkit.org/show_bug.cgi?id=19290>

Reviewed by David Kilzer.

  • PrettyPatch/PrettyPatch.rb: (PrettyPatch.find_url_and_path): Added. Searches the file path from the bottom up looking for a directory that exists in the source tree. (PrettyPatch.linkifyFilename): Changed to call find_url_and_path.
Location:
trunk/BugsSite
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BugsSite/ChangeLog

    r34173 r34175  
     12008-05-28  Adam Roben  <aroben@apple.com>
     2
     3        Make PrettyPatch able to handle diffs taken from outside the WebKit
     4        source tree
     5
     6        Part of Bug 19290: More patches not handled by PrettyPatch.rb
     7        <https://bugs.webkit.org/show_bug.cgi?id=19290>
     8
     9        Reviewed by David Kilzer.
     10
     11        * PrettyPatch/PrettyPatch.rb:
     12        (PrettyPatch.find_url_and_path): Added. Searches the file path from
     13        the bottom up looking for a directory that exists in the source tree.
     14        (PrettyPatch.linkifyFilename): Changed to call find_url_and_path.
     15
    1162008-05-28  Adam Roben  <aroben@apple.com>
    217
  • trunk/BugsSite/PrettyPatch/PrettyPatch.rb

    r31728 r34175  
    6262    ]
    6363
     64    def self.find_url_and_path(file_path)
     65        # Search file_path from the bottom up, at each level checking whether
     66        # we've found a directory we know exists in the source tree.
     67
     68        dirname, basename = File.split(file_path)
     69        dirname.split(/\//).reverse.inject(basename) do |path, directory|
     70            path = directory + "/" + path
     71
     72            return [OPENSOURCE_TRAC_URL, path] if OPENSOURCE_DIRS.include?(directory)
     73
     74            path
     75        end
     76
     77        [nil, file_path]
     78    end
     79
    6480    def self.linkifyFilename(filename)
    65         directory = /^([^\/]+)/.match(filename)[1]
    66         url, pathBeneathTrunk = if filename =~ /\bOpenSource\// then
    67                                     [OPENSOURCE_TRAC_URL, filename.gsub(/^.*\bOpenSource\//, '')]
    68                                 elsif OPENSOURCE_DIRS.include?(directory) then
    69                                     [OPENSOURCE_TRAC_URL, filename]
    70                                 else
    71                                     [nil, nil]
    72                                 end
     81        url, pathBeneathTrunk = find_url_and_path(filename)
    7382
    7483        url.nil? ? filename : "<a href='#{url}browser/trunk/#{pathBeneathTrunk}'>#{filename}</a>"
Note: See TracChangeset for help on using the changeset viewer.