[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 13:27:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9a2809d57e05ba61b9dfb0ccea6decd587f69cd6
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 15 23:25:34 2010 +0000

    2010-09-15  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            [reviewtool] Comments should quote previous comments on the same line
            https://bugs.webkit.org/show_bug.cgi?id=45847
    
            Now when you reply to a previous comment, the tool will quote the
            previous comment in the bugs.webkit.org post.  This makes it eaiser for
            folks following along in email to understand the discussion.
    
            While I was editing this code, I also cleaned up some of the whitespace
            handling in comments.
    
            * code-review.js:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67575 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/BugsSite/ChangeLog b/BugsSite/ChangeLog
index e19b9b9..a580960 100644
--- a/BugsSite/ChangeLog
+++ b/BugsSite/ChangeLog
@@ -1,5 +1,21 @@
 2010-09-15  Adam Barth  <abarth at webkit.org>
 
+        Reviewed by Eric Seidel.
+
+        [reviewtool] Comments should quote previous comments on the same line
+        https://bugs.webkit.org/show_bug.cgi?id=45847
+
+        Now when you reply to a previous comment, the tool will quote the
+        previous comment in the bugs.webkit.org post.  This makes it eaiser for
+        folks following along in email to understand the discussion.
+
+        While I was editing this code, I also cleaned up some of the whitespace
+        handling in comments.
+
+        * code-review.js:
+
+2010-09-15  Adam Barth  <abarth at webkit.org>
+
         Minor UI tweak to the review tool.  We want to display newlines in
         previous and frozen comments instead of collapsing them.
 
diff --git a/BugsSite/code-review.js b/BugsSite/code-review.js
index 60ed45c..ef41ebd 100644
--- a/BugsSite/code-review.js
+++ b/BugsSite/code-review.js
@@ -67,6 +67,16 @@
     });
   }
 
+  function previousCommentsFor(line) {
+    var comments = [];
+    var position = line;
+    while (position.next() && position.next().hasClass('previousComment')) {
+      position = position.next();
+      comments.push(position.get());
+    }
+    return $(comments);
+  }
+
   function findCommentPositionFor(line) {
     var position = line;
     while (position.next() && position.next().hasClass('previousComment'))
@@ -114,7 +124,8 @@
   function addPreviousComment(line, author, comment_text) {
     var comment_block = $('<div data-comment-for="' + line.attr('id') + '" class="previousComment"></div>');
     var author_block = $('<div class="author"></div>').text(author + ':');
-    comment_block.text(comment_text).prepend(author_block).each(hoverify).click(addCommentField);
+    var text_block = $('<div class="content"></div>').text(comment_text);
+    comment_block.append(author_block).append(text_block).each(hoverify).click(addCommentField);
     insertCommentFor(line, comment_block);
   }
 
@@ -171,7 +182,7 @@
         ++i;
       }
       --i; // Decrement i because the for loop will increment it again in a second.
-      var comment_text = comment_lines.join('\n');
+      var comment_text = comment_lines.join('\n').trim();
       comments.push({
         'author': author,
         'file_name': file_name,
@@ -347,7 +358,7 @@
 
   $('.DiffSection').live('mouseleave', stopDragSelect).live('mouseup', stopDragSelect);
 
-  function contextSnippetFor(line) {
+  function contextSnippetFor(line, indent) {
     var snippets = []
     contextLinesFor(line).each(function() {
       var action = ' ';
@@ -356,7 +367,7 @@
       else if ($(this).hasClass('remove'))
         action = '-';
       var text = $(this).children('.text').text();
-      snippets.push('> ' + action + text);
+      snippets.push(indent + action + text);
     });
     return snippets.join('\n');
   }
@@ -365,10 +376,25 @@
     return line.parentsUntil('.FileDiff').parent().find('h1').text();
   }
 
-  function snippetFor(line) {
+  function indentFor(depth) {
+    return (new Array(depth + 1)).join('>') + ' ';
+  }
+
+  function snippetFor(line, indent) {
     var file_name = fileNameFor(line);
     var line_number = line.hasClass('remove') ? '-' + line.children('.from').text() : line.children('.to').text();
-    return '> ' + file_name + ':' + line_number + '\n' + contextSnippetFor(line);
+    return indent + file_name + ':' + line_number + '\n' + contextSnippetFor(line, indent);
+  }
+
+  function quotePreviousComments(comments) {
+    var quoted_comments = [];
+    var depth = comments.size();
+    comments.each(function() {
+      var indent = indentFor(depth--);
+      var text = $(this).children('.content').text();
+      quoted_comments.push(indent + '\n' + indent + text.split('\n').join('\n' + indent));
+    });
+    return quoted_comments.join('\n');
   }
 
   $('#comment_form .winter').live('click', function() {
@@ -380,11 +406,18 @@
     forEachLine(function(line) {
       if (line.attr('data-has-comment') != 'true')
         return;
-      var snippet = snippetFor(line);
       var comment = findCommentBlockFor(line).children('textarea').val().trim();
       if (comment == '')
         return;
-      comments_in_context.push(snippet + '\n' + comment);
+      var previous_comments = previousCommentsFor(line);
+      var snippet = snippetFor(line, indentFor(previous_comments.size() + 1));
+      var quoted_comments = quotePreviousComments(previous_comments);
+      var comment_with_context = [];
+      comment_with_context.push(snippet);
+      if (quoted_comments != '')
+        comment_with_context.push(quoted_comments);
+      comment_with_context.push('\n' + comment);
+      comments_in_context.push(comment_with_context.join('\n'));
     });
     $('#comment_form').removeClass('inactive');
     var comment = $('.overallComments textarea').val().trim();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list