comparison mercurial/patch.py @ 23763:30c6e85aac77

trydiff: remove unused code for git index of "combined diff" We only ever produce diffs with one pre- and one post-image, so remove the code for displaying "index" lines for combined diffs.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 07 Jan 2015 08:46:52 -0800
parents e864353f8c6b
children 70d8be6299ab
comparison
equal deleted inserted replaced
23762:e864353f8c6b 23763:30c6e85aac77
1745 def addmodehdr(header, omode, nmode): 1745 def addmodehdr(header, omode, nmode):
1746 if omode != nmode: 1746 if omode != nmode:
1747 header.append('old mode %s\n' % omode) 1747 header.append('old mode %s\n' % omode)
1748 header.append('new mode %s\n' % nmode) 1748 header.append('new mode %s\n' % nmode)
1749 1749
1750 def addindexmeta(meta, revs): 1750 def addindexmeta(meta, oindex, nindex):
1751 if opts.git: 1751 if opts.git:
1752 i = len(revs) 1752 meta.append('index %s..%s\n' % (oindex, nindex))
1753 if i==2:
1754 meta.append('index %s..%s\n' % tuple(revs))
1755 elif i==3:
1756 meta.append('index %s,%s..%s\n' % tuple(revs))
1757 1753
1758 def gitindex(text): 1754 def gitindex(text):
1759 if not text: 1755 if not text:
1760 text = "" 1756 text = ""
1761 l = len(text) 1757 l = len(text)
1878 if opts.git or revs: 1874 if opts.git or revs:
1879 header.insert(0, diffline(join(a), join(b), revs)) 1875 header.insert(0, diffline(join(a), join(b), revs))
1880 if dodiff == 'binary' and not opts.nobinary: 1876 if dodiff == 'binary' and not opts.nobinary:
1881 text = mdiff.b85diff(to, tn) 1877 text = mdiff.b85diff(to, tn)
1882 if text: 1878 if text:
1883 addindexmeta(header, [gitindex(to), gitindex(tn)]) 1879 addindexmeta(header, gitindex(to), gitindex(tn))
1884 else: 1880 else:
1885 text = mdiff.unidiff(to, date1, 1881 text = mdiff.unidiff(to, date1,
1886 tn, date2, 1882 tn, date2,
1887 join(a), join(b), opts=opts) 1883 join(a), join(b), opts=opts)
1888 if header and (text or len(header) > 1): 1884 if header and (text or len(header) > 1):