Mercurial > hg
changeset 24000:82e3324c4df9
trydiff: inline sole addmodehdr() call
Now that there is only a single call to addmodehdr() left, and there
is other similar code (for new/deleted files) around that call site,
let's inline the function there. That also makes it clearer under what
circumstances the header is actually written (when modes differ).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 16 Jan 2015 14:53:37 -0800 |
parents | e02888efc5aa |
children | f610c3bd03d3 |
files | mercurial/patch.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Fri Jan 16 14:46:03 2015 -0800 +++ b/mercurial/patch.py Fri Jan 16 14:53:37 2015 -0800 @@ -1739,11 +1739,6 @@ def trydiff(repo, revs, ctx1, ctx2, modified, added, removed, copy, getfilectx, opts, losedatafn, prefix): - def addmodehdr(header, mode1, mode2): - if mode1 != mode2: - header.append('old mode %s\n' % mode1) - header.append('new mode %s\n' % mode2) - def addindexmeta(meta, index1, index2): meta.append('index %s..%s\n' % (index1, index2)) @@ -1861,7 +1856,10 @@ elif content2 is None: # removed header.append('deleted file mode %s\n' % gitmode[flag1]) else: # modified/copied/renamed - addmodehdr(header, gitmode[flag1], gitmode[flag2]) + mode1, mode2 = gitmode[flag1], gitmode[flag2] + if mode1 != mode2: + header.append('old mode %s\n' % mode1) + header.append('new mode %s\n' % mode2) if op is not None: header.append('%s from %s\n' % (op, path1)) header.append('%s to %s\n' % (op, path2))