##// 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 50 defaultopts = diffopts()
51 51
52 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 56 if not a and not b: return ""
54 57 epoch = util.datestr((0, 0))
55 58
@@ -58,19 +61,19 b' def unidiff(a, ad, b, bd, fn, r=None, op'
58 61 elif not a:
59 62 b = splitnewlines(b)
60 63 if a is None:
61 l1 = "--- %s\t%s\n" % ("/dev/null", epoch)
64 l1 = '--- /dev/null%s' % datetag(epoch)
62 65 else:
63 l1 = "--- %s\t%s\n" % ("a/" + fn, ad)
64 l2 = "+++ %s\t%s\n" % ("b/" + fn, bd)
66 l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
67 l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
65 68 l3 = "@@ -0,0 +1,%d @@\n" % len(b)
66 69 l = [l1, l2, l3] + ["+" + e for e in b]
67 70 elif not b:
68 71 a = splitnewlines(a)
69 l1 = "--- %s\t%s\n" % ("a/" + fn, ad)
72 l1 = "--- %s%s" % ("a/" + fn, datetag(ad))
70 73 if b is None:
71 l2 = "+++ %s\t%s\n" % ("/dev/null", epoch)
74 l2 = '+++ /dev/null%s' % datetag(epoch)
72 75 else:
73 l2 = "+++ %s\t%s\n" % ("b/" + fn, bd)
76 l2 = "+++ %s%s" % ("b/" + fn, datetag(bd))
74 77 l3 = "@@ -1,%d +0,0 @@\n" % len(a)
75 78 l = [l1, l2, l3] + ["-" + e for e in a]
76 79 else:
@@ -79,8 +82,8 b' def unidiff(a, ad, b, bd, fn, r=None, op'
79 82 l = list(bunidiff(a, b, al, bl, "a/" + fn, "b/" + fn, opts=opts))
80 83 if not l: return ""
81 84 # difflib uses a space, rather than a tab
82 l[0] = "%s\t%s\n" % (l[0][:-2], ad)
83 l[1] = "%s\t%s\n" % (l[1][:-2], bd)
85 l[0] = "%s%s" % (l[0][:-2], datetag(ad))
86 l[1] = "%s%s" % (l[1][:-2], datetag(bd))
84 87
85 88 for ln in xrange(len(l)):
86 89 if l[ln][-1] != '\n':
General Comments 0
You need to be logged in to leave comments. Login now