##// END OF EJS Templates
diff: unify calls to diffline...
Guillermo Pérez -
r17940:c84ef004 default
parent child Browse files
Show More
@@ -156,7 +156,7 b' def diffline(revs, a, b, opts):'
156 parts.append(a)
156 parts.append(a)
157 return ' '.join(parts) + '\n'
157 return ' '.join(parts) + '\n'
158
158
159 def unidiff(a, ad, b, bd, fn1, fn2, r=None, opts=defaultopts):
159 def unidiff(a, ad, b, bd, fn1, fn2, opts=defaultopts):
160 def datetag(date, fn=None):
160 def datetag(date, fn=None):
161 if not opts.git and not opts.nodates:
161 if not opts.git and not opts.nodates:
162 return '\t%s\n' % date
162 return '\t%s\n' % date
@@ -207,9 +207,6 b' def unidiff(a, ad, b, bd, fn1, fn2, r=No'
207 if l[ln][-1] != '\n':
207 if l[ln][-1] != '\n':
208 l[ln] += "\n\ No newline at end of file\n"
208 l[ln] += "\n\ No newline at end of file\n"
209
209
210 if r:
211 l.insert(0, diffline(r, fn1, fn2, opts))
212
213 return "".join(l)
210 return "".join(l)
214
211
215 # creates a headerless unified diff
212 # creates a headerless unified diff
@@ -1746,17 +1746,17 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1746 dodiff = 'binary'
1746 dodiff = 'binary'
1747 elif binary or nflag != oflag:
1747 elif binary or nflag != oflag:
1748 losedatafn(f)
1748 losedatafn(f)
1749 if opts.git:
1750 header.insert(0, mdiff.diffline(revs, join(a), join(b), opts))
1751
1749
1752 if dodiff:
1750 if dodiff:
1751 if opts.git or revs:
1752 header.insert(0, mdiff.diffline(revs, join(a), join(b), opts))
1753 if dodiff == 'binary':
1753 if dodiff == 'binary':
1754 text = mdiff.b85diff(to, tn)
1754 text = mdiff.b85diff(to, tn)
1755 else:
1755 else:
1756 text = mdiff.unidiff(to, date1,
1756 text = mdiff.unidiff(to, date1,
1757 # ctx2 date may be dynamic
1757 # ctx2 date may be dynamic
1758 tn, util.datestr(ctx2.date()),
1758 tn, util.datestr(ctx2.date()),
1759 join(a), join(b), revs, opts=opts)
1759 join(a), join(b), opts=opts)
1760 if header and (text or len(header) > 1):
1760 if header and (text or len(header) > 1):
1761 yield ''.join(header)
1761 yield ''.join(header)
1762 if text:
1762 if text:
General Comments 0
You need to be logged in to leave comments. Login now