# HG changeset patch # User Martin von Zweigbergk # Date 2015-01-07 16:54:26 # Node ID 70d8be6299ab5eba50fb8a05b3dc3a2a9440256b # Parent 30c6e85aac779b79b4477e9de71bfb73a05f2b93 trydiff: make addindexmeta() unconditionally add index meta The conditional-ness is not clear from the name and there is only one caller, so it's clearer to check on the call site. Moving it also makes addindexmeta() no longer close on the 'opts' variable. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1748,8 +1748,7 @@ def trydiff(repo, revs, ctx1, ctx2, modi header.append('new mode %s\n' % nmode) def addindexmeta(meta, oindex, nindex): - if opts.git: - meta.append('index %s..%s\n' % (oindex, nindex)) + meta.append('index %s..%s\n' % (oindex, nindex)) def gitindex(text): if not text: @@ -1875,7 +1874,7 @@ def trydiff(repo, revs, ctx1, ctx2, modi header.insert(0, diffline(join(a), join(b), revs)) if dodiff == 'binary' and not opts.nobinary: text = mdiff.b85diff(to, tn) - if text: + if text and opts.git: addindexmeta(header, gitindex(to), gitindex(tn)) else: text = mdiff.unidiff(to, date1,