Parcourir la source

Handle a diff with only an svn property change

Steven Myint il y a 11 ans
Parent
révision
5ddd06fd05

+ 4
- 3
cdiff.py Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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))