Show More
@@ -12,19 +12,20 b' from util import *' | |||||
12 | def unidiff(a, ad, b, bd, fn, r=None, text=False): |
|
12 | def unidiff(a, ad, b, bd, fn, r=None, text=False): | |
13 |
|
13 | |||
14 | if not a and not b: return "" |
|
14 | if not a and not b: return "" | |
|
15 | epoch = datestr((0,0)) | |||
15 |
|
16 | |||
16 | if not text and (binary(a) or binary(b)): |
|
17 | if not text and (binary(a) or binary(b)): | |
17 | l = ['Binary file %s has changed\n' % fn] |
|
18 | l = ['Binary file %s has changed\n' % fn] | |
18 | elif a == None: |
|
19 | elif a == None: | |
19 | b = b.splitlines(1) |
|
20 | b = b.splitlines(1) | |
20 |
l1 = "--- %s\t%s\n" % ("/dev/null", |
|
21 | l1 = "--- %s\t%s\n" % ("/dev/null", epoch) | |
21 | l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) |
|
22 | l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) | |
22 | l3 = "@@ -0,0 +1,%d @@\n" % len(b) |
|
23 | l3 = "@@ -0,0 +1,%d @@\n" % len(b) | |
23 | l = [l1, l2, l3] + ["+" + e for e in b] |
|
24 | l = [l1, l2, l3] + ["+" + e for e in b] | |
24 | elif b == None: |
|
25 | elif b == None: | |
25 | a = a.splitlines(1) |
|
26 | a = a.splitlines(1) | |
26 | l1 = "--- %s\t%s\n" % ("a/" + fn, ad) |
|
27 | l1 = "--- %s\t%s\n" % ("a/" + fn, ad) | |
27 |
l2 = "+++ %s\t%s\n" % ("/dev/null", |
|
28 | l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) | |
28 | l3 = "@@ -1,%d +0,0 @@\n" % len(a) |
|
29 | l3 = "@@ -1,%d +0,0 @@\n" % len(a) | |
29 | l = [l1, l2, l3] + ["-" + e for e in a] |
|
30 | l = [l1, l2, l3] + ["-" + e for e in a] | |
30 | else: |
|
31 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now