##// END OF EJS Templates
Remove dates from git export file lines - they confuse git-apply
Brendan Cully -
r3026:d838bfac default
parent child Browse files
Show More
@@ -50,6 +50,9 b' class diffopts(object):'
50 defaultopts = diffopts()
50 defaultopts = diffopts()
51
51
52 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
52 def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts):
53 def datetag(date):
54 return opts.git and '\n' or '\t%s\n' % date
55
53 if not a and not b: return ""
56 if not a and not b: return ""
54 epoch = util.datestr((0, 0))
57 epoch = util.datestr((0, 0))
55
58
@@ -58,19 +61,19 b' def unidiff(a, ad, b, bd, fn, r=None, op'
58 elif not a:
61 elif not a:
59 b = splitnewlines(b)
62 b = splitnewlines(b)
60 if a is None:
63 if a is None:
61 l1 = "--- %s\t%s\n" % ("/dev/null", epoch)
64 l1 = '--- /dev/null%s' % datetag(epoch)
62 else:
65 else:
63 l1 = "--- %s\t%s\n" % ("a/" + fn, ad)
66 l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
64 l2 = "+++ %s\t%s\n" % ("b/" + fn, bd)
67 l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
65 l3 = "@@ -0,0 +1,%d @@\n" % len(b)
68 l3 = "@@ -0,0 +1,%d @@\n" % len(b)
66 l = [l1, l2, l3] + ["+" + e for e in b]
69 l = [l1, l2, l3] + ["+" + e for e in b]
67 elif not b:
70 elif not b:
68 a = splitnewlines(a)
71 a = splitnewlines(a)
69 l1 = "--- %s\t%s\n" % ("a/" + fn, ad)
72 l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
70 if b is None:
73 if b is None:
71 l2 = "+++ %s\t%s\n" % ("/dev/null", epoch)
74 l2 = '+++ /dev/null%s' % datetag(epoch)
72 else:
75 else:
73 l2 = "+++ %s\t%s\n" % ("b/" + fn, bd)
76 l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
74 l3 = "@@ -1,%d +0,0 @@\n" % len(a)
77 l3 = "@@ -1,%d +0,0 @@\n" % len(a)
75 l = [l1, l2, l3] + ["-" + e for e in a]
78 l = [l1, l2, l3] + ["-" + e for e in a]
76 else:
79 else:
@@ -79,8 +82,8 b' def unidiff(a, ad, b, bd, fn, r=None, op'
79 l = list(bunidiff(a, b, al, bl, "a/" + fn, "b/" + fn, opts=opts))
82 l = list(bunidiff(a, b, al, bl, "a/" + fn, "b/" + fn, opts=opts))
80 if not l: return ""
83 if not l: return ""
81 # difflib uses a space, rather than a tab
84 # difflib uses a space, rather than a tab
82 l[0] = "%s\t%s\n" % (l[0][:-2], ad)
85 l[0] = "%s%s" % (l[0][:-2], datetag(ad))
83 l[1] = "%s\t%s\n" % (l[1][:-2], bd)
86 l[1] = "%s%s" % (l[1][:-2], datetag(bd))
84
87
85 for ln in xrange(len(l)):
88 for ln in xrange(len(l)):
86 if l[ln][-1] != '\n':
89 if l[ln][-1] != '\n':
General Comments 0
You need to be logged in to leave comments. Login now