Title: [293992] trunk/Websites/bugs.webkit.org
Revision
293992
Author
jbed...@apple.com
Date
2022-05-09 16:03:48 -0700 (Mon, 09 May 2022)

Log Message

[bugs.webkit.org] Use GitHub as baseline when diffing
https://bugs.webkit.org/show_bug.cgi?id=240073
<rdar://problem/92741303>

Reviewed by Ryan Haddad and Dewei Zhu.

* Websites/bugs.webkit.org/code-review.js: Use GitHub instead of
Subversion for tip-of-tree baseline, blame and log links.
* Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb: Ditto.
Use GitHub instead of Subversion for tip-of-tree baseline.

Canonical link: https://commits.webkit.org/250429@main

Modified Paths

Diff

Modified: trunk/Websites/bugs.webkit.org/ChangeLog (293991 => 293992)


--- trunk/Websites/bugs.webkit.org/ChangeLog	2022-05-09 23:02:39 UTC (rev 293991)
+++ trunk/Websites/bugs.webkit.org/ChangeLog	2022-05-09 23:03:48 UTC (rev 293992)
@@ -1,3 +1,17 @@
+2022-05-09  Jonathan Bedard  <jbed...@apple.com>
+
+        [bugs.webkit.org] Use GitHub as baseline when diffing
+        https://bugs.webkit.org/show_bug.cgi?id=240073
+        <rdar://problem/92741303>
+
+        Reviewed by Ryan Haddad and Dewei Zhu.
+
+        * code-review.js: Use GitHub instead of Subversion for tip-of-tree
+        baseline, blame and log links.
+        * PrettyPatch/PrettyPatch.rb: Use GitHub instead of Subversion
+        for tip-of-tree baseline.
+        * code-review-test.html:
+
 2022-05-04  Jonathan Bedard  <jbed...@apple.com>
 
         [bugs.webkit.org] Replace svn.webkit.org in committers autocomplete

Modified: trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb (293991 => 293992)


--- trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2022-05-09 23:02:39 UTC (rev 293991)
+++ trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb	2022-05-09 23:03:48 UTC (rev 293992)
@@ -18,18 +18,6 @@
         string = normalize_line_ending(string)
         str = "#{HEADER}<body>\n"
 
-        # Just look at the first line to see if it is an SVN revision number as added
-        # by webkit-patch for git checkouts.
-        $svn_revision = 0
-        string.each_line do |line|
-            match = /^Subversion\ Revision: (\d*)$/.match(line)
-            unless match.nil?
-                str << "<span class='revision'>#{match[1]}</span>\n"
-                $svn_revision = match[1].to_i;
-            end
-            break
-        end
-
         fileDiffs = FileDiff.parse(string)
 
         # Newly added images get two diffs with svn 1.7; toss the first one.
@@ -101,7 +89,7 @@
 
     SMALLEST_EQUAL_OPERATION = 3
 
-    OPENSOURCE_TRAC_URL = "http://trac.webkit.org/"
+    OPENSOURCE_GITHUB_URL = "https://github.com/WebKit/WebKit/blob/"
 
     OPENSOURCE_DIRS = Set.new %w[
         Examples
@@ -148,32 +136,11 @@
         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_TRAC_URL, path] if OPENSOURCE_DIRS.include?(directory)
-
-            path
-        end
-
-        [nil, file_path]
+    def self.linkifyFilename(filename)
+        "<a href=''>#{filename}</a>"
     end
 
-    def self.linkifyFilename(filename, force)
-        if force
-          "<a href=''>#{filename}</a>"
-        else
-          url, pathBeneathTrunk = find_url_and_path(filename)
-          url.nil? ? filename : "<a href=''>#{filename}</a>"
-        end
-    end
 
-
     HEADER =<<EOF
 <html>
 <head>
@@ -725,7 +692,7 @@
 
                     raise "no binary chunks" unless chunks
 
-                    from_filepath = FileDiff.extract_contents_of_from_revision(@filename, chunks[0], @git_indexes[0])
+                    from_filepath = FileDiff.extract_contents_from_remote(@filename, chunks[0], @git_indexes[0])
                     to_filepath = FileDiff.extract_contents_of_to_revision(@filename, chunks[1], @git_indexes[1], from_filepath, @git_indexes[0])
                     filepaths = from_filepath, to_filepath
 
@@ -763,9 +730,9 @@
             if @renameFrom
                 str += "<h1>#{@filename}</h1>"
                 str += "was renamed from"
-                str += "<h1>#{PrettyPatch.linkifyFilename(@renameFrom.to_s, true)}</h1>"
+                str += "<h1>#{PrettyPatch.linkifyFilename(@renameFrom.to_s)}</h1>"
             else
-                str += "<h1>#{PrettyPatch.linkifyFilename(@filename, false)}</h1>\n"
+                str += "<h1>#{PrettyPatch.linkifyFilename(@filename)}</h1>\n"
             end
             if @image then
                 str += self.image_to_html
@@ -862,8 +829,8 @@
 END
         end
 
-        def self.get_svn_uri(repository_path)
-            "http://svn.webkit.org/repository/webkit/!svn/bc/" + $svn_revision.to_s + "/trunk/" + (repository_path)
+        def self.get_github_uri(repository_path)
+            "https://raw.githubusercontent.com/WebKit/WebKit/main/" + (repository_path)
         end
 
         def self.get_new_temp_filepath_and_name
@@ -873,11 +840,11 @@
             return filepath, filename
         end
 
-        def self.download_from_revision_from_svn(repository_path)
+        def self.download_from_revision_from_github(repository_path)
             filepath, filename = get_new_temp_filepath_and_name
-            svn_uri = get_svn_uri(repository_path)
+            github_uri = get_github_uri(repository_path)
             open(filepath, 'wb') do |to_file|
-                to_file << open(svn_uri) { |from_file| from_file.read }
+                to_file << open(github_uri) { |from_file| from_file.read }
             end
             return filepath
         end
@@ -926,7 +893,7 @@
             return to_filepath
         end
 
-        def self.extract_contents_of_from_revision(repository_path, encoded_chunk, git_index)
+        def self.extract_contents_from_remote(repository_path, encoded_chunk, git_index)
             # For literal encoded, simply reconstruct.
             if GIT_LITERAL_FORMAT.match(encoded_chunk[0])
                 return extract_contents_from_git_binary_literal_chunk(encoded_chunk, git_index)
@@ -933,7 +900,7 @@
             end
             #  For delta encoded, download from svn.
             if GIT_DELTA_FORMAT.match(encoded_chunk[0])
-                return download_from_revision_from_svn(repository_path)
+                return download_from_revision_from_github(repository_path)
             end
             raise "Error: unknown git patch encoding"
         end

Modified: trunk/Websites/bugs.webkit.org/code-review-test.html (293991 => 293992)


--- trunk/Websites/bugs.webkit.org/code-review-test.html	2022-05-09 23:02:39 UTC (rev 293991)
+++ trunk/Websites/bugs.webkit.org/code-review-test.html	2022-05-09 23:03:48 UTC (rev 293992)
@@ -42,30 +42,30 @@
 function testTracLinks() {
   var links = tracLinks('foo/bar/baz.cpp', '');
   ASSERT_EQUAL($('<div>').append(links).html(),
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>');
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" log</a>');
 
   var links = tracLinks('foo/bar.cpp/qux.mm', '');
   ASSERT_EQUAL($('<div>').append(links).html(),
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>');
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" log</a>');
 
   var links = tracLinks('foo/bar.h', '');
   ASSERT_EQUAL($('<div>').append(links).html(),
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>');
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" log</a>');
 
   var links = tracLinks('foo/bar.gypi', '');
   ASSERT_EQUAL($('<div>').append(links).html(),
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>');
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" log</a>');
 
   var links = tracLinks('foo/ChangeLog', '');
   ASSERT_EQUAL($('<div>').append(links).html(),
-    '<a target="_blank" href="" +
-    '<a target="_blank" href="" log</a>');
+    '<a target="_blank" href="" +
+    '<a target="_blank" href="" log</a>');
 }
 
 function testDraftCommentSaver() {
@@ -221,7 +221,7 @@
 function testReadDiscardedCommentWithPreviousComment() {
   document.getElementById('diff-content').innerHTML =
       '<div class="FileDiff">' +
-        '<h1><a href="" +
+        '<h1><a href="" +
         '<div class="DiffSection">' +
           '<div class="DiffBlock">' +
             '<div class="DiffBlockPart add">' +
@@ -284,7 +284,7 @@
 function testSideBySideDiffWithPreviousCommentsOnSharedLine() {
   document.getElementById('diff-content').innerHTML =
       '<div class="FileDiff">' +
-        '<h1><a href="" +
+        '<h1><a href="" +
         '<div class="DiffSection">' +
           '<div class="DiffBlock">' +
             '<div class="DiffBlockPart shared">' +
@@ -326,7 +326,7 @@
 function testSanitizeFragmentForCopy() {
   var fragment = document.createElement('div');
   fragment.innerHTML = '<div class="FileDiff">' +
-      '<h1><a href="" +
+      '<h1><a href="" +
       '<div class="FileDiffLinkContainer LinkContainer" style="opacity: 0;"><a href="" class="unify-link cremed" style="display: inline;">unified</a></div>' +
       '<div class="DiffSection">' +
         '<div class="DiffBlock">' +
@@ -346,7 +346,7 @@
     '</div>';
 
   var expectedWithLineNumbers = '<div class="FileDiff">' +
-      '<h1><a href="" +
+      '<h1><a href="" +
       '<div class="DiffSection">' +
         '<div class="DiffBlock">' +
           '<div class="DiffBlockPart shared">' +
@@ -369,7 +369,7 @@
   ASSERT_EQUAL(fragmentCopy.innerHTML, expectedWithLineNumbers);
 
   var expectedWithOutLineNumbers = '<div class="FileDiff">' +
-      '<h1><a href="" +
+      '<h1><a href="" +
       '<div class="DiffSection">' +
         '<div class="DiffBlock">' +
           '<div class="DiffBlockPart shared">' +
@@ -402,7 +402,7 @@
 function testSaveCommentsWithMissingLineIds() {
   document.getElementById('diff-content').innerHTML =
       '<div class="FileDiff">' +
-        '<h1><a href="" +
+        '<h1><a href="" +
         '<div class="DiffSection">' +
           '<div class="DiffBlock">' +
             '<div class="DiffBlockPart shared">' +

Modified: trunk/Websites/bugs.webkit.org/code-review.js (293991 => 293992)


--- trunk/Websites/bugs.webkit.org/code-review.js	2022-05-09 23:02:39 UTC (rev 293991)
+++ trunk/Websites/bugs.webkit.org/code-review.js	2022-05-09 23:03:48 UTC (rev 293992)
@@ -70,7 +70,7 @@
   var files = {};
   var original_file_contents = {};
   var patched_file_contents = {};
-  var WEBKIT_BASE_DIR = "//svn.webkit.org/repository/webkit/trunk/";
+  var WEBKIT_BASE_DIR = "//raw.githubusercontent.com/WebKit/WebKit/main/";
   var SIDE_BY_SIDE_DIFFS_KEY = 'sidebysidediffs';
   var g_displayed_draft_comments = false;
   var g_next_line_id = 0;
@@ -624,8 +624,8 @@
 
   function tracLinks(file_name, url_hash) {
     var trac_links = $('<a target="_blank">annotate</a><a target="_blank">revision log</a>');
-    trac_links[0].href = '' + file_name + '?annotate=blame' + url_hash;
-    trac_links[1].href = '' + file_name;
+    trac_links[0].href = '' + file_name + url_hash;
+    trac_links[1].href = '' + file_name;
     var implementation_suffix_list = ['.cpp', '.mm'];
     for (var i = 0; i < implementation_suffix_list.length; ++i) {
       var suffix = implementation_suffix_list[i];
@@ -632,7 +632,7 @@
       if (file_name.lastIndexOf(suffix) == file_name.length - suffix.length) {
         var new_link = $('<a target="_blank">header</a>');
         var stem = file_name.substr(0, file_name.length - suffix.length);
-        new_link[0].href= '' + stem + '.h';
+        new_link[0].href= '' + stem + '.h';
         trac_links = $.merge(new_link, trac_links);
       }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to