Show More
@@ -18,16 +18,22 b' def unidiff(a, ad, b, bd, fn, r=None, te' | |||||
18 |
|
18 | |||
19 | if not text and (util.binary(a) or util.binary(b)): |
|
19 | if not text and (util.binary(a) or util.binary(b)): | |
20 | l = ['Binary file %s has changed\n' % fn] |
|
20 | l = ['Binary file %s has changed\n' % fn] | |
21 |
elif a |
|
21 | elif not a: | |
22 | b = b.splitlines(1) |
|
22 | b = b.splitlines(1) | |
23 | l1 = "--- %s\t%s\n" % ("/dev/null", epoch) |
|
23 | if a is None: | |
|
24 | l1 = "--- %s\t%s\n" % ("/dev/null", epoch) | |||
|
25 | else: | |||
|
26 | l1 = "--- %s\t%s\n" % ("a/" + fn, ad) | |||
24 | l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) |
|
27 | l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) | |
25 | l3 = "@@ -0,0 +1,%d @@\n" % len(b) |
|
28 | l3 = "@@ -0,0 +1,%d @@\n" % len(b) | |
26 | l = [l1, l2, l3] + ["+" + e for e in b] |
|
29 | l = [l1, l2, l3] + ["+" + e for e in b] | |
27 |
elif b |
|
30 | elif not b: | |
28 | a = a.splitlines(1) |
|
31 | a = a.splitlines(1) | |
29 | l1 = "--- %s\t%s\n" % ("a/" + fn, ad) |
|
32 | l1 = "--- %s\t%s\n" % ("a/" + fn, ad) | |
30 | l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) |
|
33 | if b is None: | |
|
34 | l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) | |||
|
35 | else: | |||
|
36 | l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) | |||
31 | l3 = "@@ -1,%d +0,0 @@\n" % len(a) |
|
37 | l3 = "@@ -1,%d +0,0 @@\n" % len(a) | |
32 | l = [l1, l2, l3] + ["-" + e for e in a] |
|
38 | l = [l1, l2, l3] + ["-" + e for e in a] | |
33 | else: |
|
39 | else: |
@@ -12,3 +12,7 b' hg diff | sed -e "s/\\(+++ [a-zA-Z0-9_/.-' | |||||
12 |
|
12 | |||
13 | hg diff -r tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
13 | hg diff -r tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | |
14 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" |
|
14 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" | |
|
15 | ||||
|
16 | echo foo > a | |||
|
17 | hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ | |||
|
18 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" |
General Comments 0
You need to be logged in to leave comments.
Login now