Browse Source

Handle a diff with only an svn property change

Steven Myint 11 years ago
parent
commit
5ddd06fd05

+ 4
- 3
cdiff.py View File

@@ -480,10 +480,11 @@ class DiffParser(object):
480 480
                 self._type = 'unified'
481 481
                 break
482 482
         else:
483
-            if size < 4:
483
+            if size < 5:
484 484
                 # It's safe to consider as udiff if patch stream contains no
485
-                # more than 3 lines, happens with `git diff` on a file that
486
-                # only has perm bits changes
485
+                # more than 4 lines. happens with `git diff` on a file that
486
+                # only has perm bits changes or `svn diff` with property
487
+                # changes.
487 488
                 #
488 489
                 self._type = 'unified'
489 490
             else:

+ 4
- 0
tests/svn-property/in.diff View File

@@ -0,0 +1,4 @@
1
+Index: foo
2
+===================================================================
3
+Cannot display: file marked as a binary type.
4
+svn:mime-type = application/octet-stream

+ 5
- 0
tests/svn-property/out.normal View File

@@ -0,0 +1,5 @@
1
+Index: foo
2
+===================================================================
3
+Cannot display: file marked as a binary type.
4
+svn:mime-type = application/octet-stream
5
+

+ 5
- 0
tests/svn-property/out.side-by-side View File

@@ -0,0 +1,5 @@
1
+Index: foo
2
+===================================================================
3
+Cannot display: file marked as a binary type.
4
+svn:mime-type = application/octet-stream
5
+

+ 5
- 0
tests/svn-property/out.w70 View File

@@ -0,0 +1,5 @@
1
+Index: foo
2
+===================================================================
3
+Cannot display: file marked as a binary type.
4
+svn:mime-type = application/octet-stream
5
+

+ 1
- 0
tests/test_cdiff.py View File

@@ -441,6 +441,7 @@ spam
441 441
 --- a
442 442
 spam
443 443
 +++ b
444
+
444 445
 """
445 446
         items = patch.splitlines(True)
446 447
         stream = cdiff.PatchStream(Sequential(items))