2011-01-20 Ojan Vafai <ojan@chromium.org>
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 00:04:53 +0000 (00:04 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 00:04:53 +0000 (00:04 +0000)
        Reviewed by Adam Barth.

        handle cases where PrettyPatch.rb doesn't linkify filenames
        https://bugs.webkit.org/show_bug.cgi?id=52834

        * code-review.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76302 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/bugs.webkit.org/ChangeLog
Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
Websites/bugs.webkit.org/code-review.js

index 5eb210a..3e16960 100644 (file)
@@ -2,6 +2,15 @@
 
         Reviewed by Adam Barth.
 
+        handle cases where PrettyPatch.rb doesn't linkify filenames
+        https://bugs.webkit.org/show_bug.cgi?id=52834
+
+        * code-review.js:
+
+2011-01-20  Ojan Vafai  <ojan@chromium.org>
+
+        Reviewed by Adam Barth.
+
         fix goofup in http://trac.webkit.org/changeset/76082
         https://bugs.webkit.org/show_bug.cgi?id=52830
 
index 16935bb..203f213 100644 (file)
@@ -417,7 +417,7 @@ body {
 }
 </style>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
-<script src="code-review.js?version=26"></script>
+<script src="code-review.js?version=27"></script>
 EOF
 
     def self.revisionOrDescription(string)
index 10b522c..ffa251d 100644 (file)
       var header = $(this).children('h1');
       var url_hash = '#L' + firstLine(this);
 
-      var file_link = $('a', header)[0];
-      file_link.target = "_blank";
-      file_link.href += url_hash;
-
       var file_name = header.text();
       files[file_name] = this;
 
       addExpandLinks(file_name);
-      addFileDiffLinks(file_name, url_hash);
+
+      var diff_links = $('<div class="FileDiffLinkContainer LinkContainer">' +
+          diffLinksHtml() +
+          '</div>');
+
+      var file_link = $('a', header)[0];
+      // If the base directory in the file path does not match a WebKit top level directory,
+      // then PrettyPatch.rb doesn't linkify the header.
+      if (file_link) {
+        file_link.target = "_blank";
+        file_link.href += url_hash;
+        diff_links.append(tracLinks(file_name, url_hash));
+      }
+
+      $('h1', this).after(diff_links);
+      updateDiffLinkVisibility(this);
     });
   }
 
-  function addFileDiffLinks(file_name, url_hash) {
-    var diff_links = $('<div class="FileDiffLinkContainer LinkContainer">' +
-        diffLinksHtml() +
-        '</div>');
-
+  function tracLinks(file_name, url_hash) {
     var trac_links = $('<a target="_blank">annotate</a><a target="_blank">revision log</a>');
     trac_links[0].href = 'http://trac.webkit.org/browser/trunk/' + file_name + '?annotate=blame' + url_hash;
     trac_links[1].href = 'http://trac.webkit.org/log/trunk/' + file_name;
-    diff_links.append(trac_links);
-
-    $('h1', files[file_name]).after(diff_links);
-    updateDiffLinkVisibility(files[file_name]);
+    return trac_links;
   }
 
   function addExpandLinks(file_name) {