##// END OF EJS Templates
Attempt to make diff deal with null sources properly...
mpm@selenic.com -
r264:4c1d7072 default
parent child Browse files
Show More
@@ -61,12 +61,12 b' def dodiff(repo, files = None, node1 = N'
61 61 tn = read(f)
62 62 sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
63 63 for f in a:
64 to = ""
64 to = None
65 65 tn = read(f)
66 66 sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
67 67 for f in d:
68 68 to = repo.file(f).read(mmap[f])
69 tn = ""
69 tn = None
70 70 sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
71 71
72 72 def help(ui, cmd=None):
@@ -10,6 +10,20 b' from mercurial.mpatch import *'
10 10
11 11 def unidiff(a, ad, b, bd, fn):
12 12 if not a and not b: return ""
13
14 if a == None:
15 b = b.splitlines(1)
16 l1 = "--- %s\t%s\n" % ("/dev/null", ad)
17 l2 = "+++ %s\t%s\n" % ("b/" + fn, bd)
18 l3 = "@@ -0,0 +1,%d @@\n" % len(b)
19 l = [l1, l2, l3] + ["+" + e for e in b]
20 elif b == None:
21 a = a.splitlines(1)
22 l1 = "--- %s\t%s\n" % ("a/" + fn, ad)
23 l2 = "+++ %s\t%s\n" % ("/dev/null", bd)
24 l3 = "@@ -1,%d +0,0 @@\n" % len(a)
25 l = [l1, l2, l3] + ["-" + e for e in a]
26 else:
13 27 a = a.splitlines(1)
14 28 b = b.splitlines(1)
15 29 l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn, ad, bd))
General Comments 0
You need to be logged in to leave comments. Login now