changeset 23752:70d8be6299ab

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 07 Jan 2015 08:54:26 -0800
parents 30c6e85aac77
children e30c6aa6f2a2
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Jan 07 08:46:52 2015 -0800
+++ b/mercurial/patch.py	Wed Jan 07 08:54:26 2015 -0800
@@ -1748,8 +1748,7 @@
             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 @@
                 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,