Hi,

imagine a file containing sql code and comments

foo.sql:

--This is the comment
SELECT * FROM Foo;

Now you update the comment and create a diff of it:


diff -up foo2.sql foo.sql
--- foo2.sql    2008-12-05 15:50:17.000000000 -0500
+++ foo.sql     2008-12-05 15:50:04.000000000 -0500
@@ -1,3 +1,3 @@
---This is the new comment
+--This is the comment
 SELECT * FROM Foo;

As you can tell, there is the line which removes the old comment and
it starts with three dashes.
The three dashes are also part of the diff syntax.

post-review will now exclude the line
"---This is the new comment"
and the created diff is incomplete.


I patched post-review. Where do I upload the file?
Since it is short, I paste it here.

You might prefer another solution, but this is what worked for me.

--- post-review.1       2008-08-25 08:38:45.000000000 -0400
+++ post-review 2008-12-05 15:30:25.000000000 -0500
@@ -647,6 +647,13 @@ class SVNClient(SCMClient):

         return ''.join(diff)

+    def isDiffLine(self, line, minus):
+        if minus:
+            return line.startswith('---') and line.find('(revision') !
= -1
+        else:
+            return line.startswith('+++') and (line.find('(working
copy') != -1 or line.find('(revision') != -1)
+
+
     def handle_renames(self, diff_content):
         """
         The output of svn diff is incorrect when the file in question
came
@@ -660,12 +667,12 @@ class SVNClient(SCMClient):

         from_line = ""
         for line in diff_content:
-            if line.startswith('---'):
+            if self.isDiffLine(line, True):
                 from_line = line
                 continue

             # This is where we decide how mangle the previous '---'
-            if line.startswith('+++'):
+            if self.isDiffLine(line, False):
                 to_file, _ = self.parse_filename_header(line[4:])
                 info       = self.svn_info(to_file)
                 if info.has_key("Copied From URL"):
@@ -694,7 +701,7 @@ class SVNClient(SCMClient):

         for line in diff_content:
             front = None
-            if line.startswith('+++ ') or line.startswith('--- ') or
line.startswith('Index: '):
+            if self.isDiffLine(line, True) or self.isDiffLine(line,
False) or line.startswith('Index: '):
                 front, line = line.split(" ", 1)

             if front:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to