62c8ba974c19

Strip even more from the diffs Mercurial gives us.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 08 Oct 2009 17:52:45 -0400
parents 789e5765c9ff
children 8cea29aa955f
branches/tags (none)
files review/api.py review/extension_ui.py review/tests/sample_data.py

Changes

--- a/review/api.py	Wed Oct 07 23:38:30 2009 -0400
+++ b/review/api.py	Thu Oct 08 17:52:45 2009 -0400
@@ -234,11 +234,12 @@
                 opts=patch.diffopts(self.ui, opts))
             
             # patch.diff will give us back a generator with two items
-            # the first is the diff header, which we don't care about
+            # the first is the diff --git header, which we don't care about
             d.next()
             
-            # the second is the diff's contents, which is what we want
-            diffs[filename] = d.next()
+            # the second is the diff's contents, which is what we want,
+            # minus the header
+            diffs[filename] = '\n'.join(d.next().splitlines()[3:])
         
         return diffs
     
--- a/review/extension_ui.py	Wed Oct 07 23:38:30 2009 -0400
+++ b/review/extension_ui.py	Thu Oct 08 17:52:45 2009 -0400
@@ -119,7 +119,7 @@
         for comment in file_level_comments:
             _print_comment(comment)
         
-        content = diffs[filename].splitlines()[2:]
+        content = diffs[filename].splitlines()
         
         line_level_comments = filter(
             lambda c: filename == c.filename and c.lines, rcset.comments
--- a/review/tests/sample_data.py	Wed Oct 07 23:38:30 2009 -0400
+++ b/review/tests/sample_data.py	Thu Oct 08 17:52:45 2009 -0400
@@ -1,9 +1,9 @@
 log = [
-    { 'file_one': 'hello\nworld',
+    { 'file_one': 'hello\nworld\nfirst\ncommit',
       'file_two': 'this is another test file',
     },
     { 'file_one': 'hello again\nworld\nfoo\nbar',
-      'file_three': 'this is a new file\nfor testing',
-      'test_dir/test_file': 'this file is inside\nof a directory',
+      'file_three': 'this is a new file\nfor testing\npurposes\nonly',
+      'test_dir/test_file': 'this file is inside\nof a directory\n\nponies!',
     },
 ]
\ No newline at end of file