# HG changeset patch # User Martin von Zweigbergk # Date 1421448548 28800 # Node ID f610c3bd03d39851712791c352d92c78d9b54269 # Parent 82e3324c4df9fcc5b6ca4c161018b392bec4ad23 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. diff -r 82e3324c4df9 -r f610c3bd03d3 mercurial/patch.py --- a/mercurial/patch.py Fri Jan 16 14:53:37 2015 -0800 +++ b/mercurial/patch.py Fri Jan 16 14:49:08 2015 -0800 @@ -1850,6 +1850,8 @@ path1 = posixpath.join(prefix, f1) path2 = posixpath.join(prefix, f2) header = [] + if opts.git or revs: + header.append(diffline(path1, path2, revs)) if opts.git: if content1 is None: # added header.append('new file mode %s\n' % gitmode[flag2]) @@ -1864,8 +1866,6 @@ header.append('%s from %s\n' % (op, path1)) header.append('%s to %s\n' % (op, path2)) - if opts.git or revs: - header.insert(0, diffline(path1, path2, revs)) if binarydiff and not opts.nobinary: text = mdiff.b85diff(content1, content2) if text and opts.git: