##// END OF EJS Templates
trydiff: move git-header code out of diffline function...
Martin von Zweigbergk -
r24020:cc81e6da default
parent child Browse files
Show More
@@ -1754,9 +1754,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1754 bprefix = 'b/'
1754 bprefix = 'b/'
1755
1755
1756 def diffline(a, b, revs):
1756 def diffline(a, b, revs):
1757 if opts.git:
1757 if not repo.ui.quiet:
1758 line = 'diff --git %s%s %s%s\n' % (aprefix, a, bprefix, b)
1759 elif not repo.ui.quiet:
1760 if revs:
1758 if revs:
1761 revinfo = ' '.join(["-r %s" % rev for rev in revs])
1759 revinfo = ' '.join(["-r %s" % rev for rev in revs])
1762 line = 'diff %s %s\n' % (revinfo, a)
1760 line = 'diff %s %s\n' % (revinfo, a)
@@ -1847,9 +1845,11 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1847 path1 = posixpath.join(prefix, f1)
1845 path1 = posixpath.join(prefix, f1)
1848 path2 = posixpath.join(prefix, f2)
1846 path2 = posixpath.join(prefix, f2)
1849 header = []
1847 header = []
1850 if opts.git or revs:
1848 if revs:
1851 header.append(diffline(path1, path2, revs))
1849 header.append(diffline(path1, path2, revs))
1852 if opts.git:
1850 elif opts.git:
1851 header.append('diff --git %s%s %s%s\n' %
1852 (aprefix, path1, bprefix, path2))
1853 if content1 is None: # added
1853 if content1 is None: # added
1854 header.append('new file mode %s\n' % gitmode[flag2])
1854 header.append('new file mode %s\n' % gitmode[flag2])
1855 elif content2 is None: # removed
1855 elif content2 is None: # removed
General Comments 0
You need to be logged in to leave comments. Login now