瀏覽代碼

Handle a diff with only an svn property change

Steven Myint 12 年之前
父節點
當前提交
5ddd06fd05
共有 6 個檔案被更改,包括 24 行新增3 行删除
  1. 4
    3
      cdiff.py
  2. 4
    0
      tests/svn-property/in.diff
  3. 5
    0
      tests/svn-property/out.normal
  4. 5
    0
      tests/svn-property/out.side-by-side
  5. 5
    0
      tests/svn-property/out.w70
  6. 1
    0
      tests/test_cdiff.py

+ 4
- 3
cdiff.py 查看文件

480
                 self._type = 'unified'
480
                 self._type = 'unified'
481
                 break
481
                 break
482
         else:
482
         else:
483
-            if size < 4:
483
+            if size < 5:
484
                 # It's safe to consider as udiff if patch stream contains no
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
                 self._type = 'unified'
489
                 self._type = 'unified'
489
             else:
490
             else:

+ 4
- 0
tests/svn-property/in.diff 查看文件

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 查看文件

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 查看文件

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 查看文件

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 查看文件

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