comparison mercurial/patch.py @ 24001:f610c3bd03d3

trydiff: order header-writing code in same order as output Instead of inserting a line before the others header lines, move the code that writes that line before the code that writes the other lines.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 16 Jan 2015 14:49:08 -0800
parents 82e3324c4df9
children 2c166f6b5d10
comparison
equal deleted inserted replaced
24000:82e3324c4df9 24001:f610c3bd03d3
1848 losedatafn(f) 1848 losedatafn(f)
1849 1849
1850 path1 = posixpath.join(prefix, f1) 1850 path1 = posixpath.join(prefix, f1)
1851 path2 = posixpath.join(prefix, f2) 1851 path2 = posixpath.join(prefix, f2)
1852 header = [] 1852 header = []
1853 if opts.git or revs:
1854 header.append(diffline(path1, path2, revs))
1853 if opts.git: 1855 if opts.git:
1854 if content1 is None: # added 1856 if content1 is None: # added
1855 header.append('new file mode %s\n' % gitmode[flag2]) 1857 header.append('new file mode %s\n' % gitmode[flag2])
1856 elif content2 is None: # removed 1858 elif content2 is None: # removed
1857 header.append('deleted file mode %s\n' % gitmode[flag1]) 1859 header.append('deleted file mode %s\n' % gitmode[flag1])
1862 header.append('new mode %s\n' % mode2) 1864 header.append('new mode %s\n' % mode2)
1863 if op is not None: 1865 if op is not None:
1864 header.append('%s from %s\n' % (op, path1)) 1866 header.append('%s from %s\n' % (op, path1))
1865 header.append('%s to %s\n' % (op, path2)) 1867 header.append('%s to %s\n' % (op, path2))
1866 1868
1867 if opts.git or revs:
1868 header.insert(0, diffline(path1, path2, revs))
1869 if binarydiff and not opts.nobinary: 1869 if binarydiff and not opts.nobinary:
1870 text = mdiff.b85diff(content1, content2) 1870 text = mdiff.b85diff(content1, content2)
1871 if text and opts.git: 1871 if text and opts.git:
1872 addindexmeta(header, gitindex(content1), gitindex(content2)) 1872 addindexmeta(header, gitindex(content1), gitindex(content2))
1873 else: 1873 else: