[bugzilla-gnome-org-extensions] Add Review.Comment.getHunk()



commit 6af0fabe41be6c0ce726b27802ea29c5d5d0acaf
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Sep 17 10:21:32 2009 -0400

    Add Review.Comment.getHunk()
    
    Add a convenience method to go from Review.Comment to Patch.Hunk

 js/review.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/review.js b/js/review.js
index df7b46b..913a4aa 100644
--- a/js/review.js
+++ b/js/review.js
@@ -23,8 +23,12 @@ Comment.prototype = {
         this.comment = comment;
     },
 
+    getHunk : function() {
+        return this.file.patchFile.getHunk(this.location);
+    },
+
     remove : function() {
-        var hunk = this.file.patchFile.getHunk(this.location);
+        var hunk = this.getHunk();
         var line = hunk.lines[this.location - hunk.location];
         _removeFromArray(this.file.comments, this);
         _removeFromArray(line.reviewComments, this);
@@ -106,7 +110,7 @@ File.prototype = {
             else
                 str += '\n';
             var comment = this.comments[i];
-            var hunk = this.patchFile.getHunk(comment.location);
+            var hunk = comment.getHunk();
 
             // Find the range of lines we might want to show. That's everything in the
             // same segment as the commented line, plus up two two lines of non-comment


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]