trydiff: remove unused code for git index of "combined diff"
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 07 Jan 2015 08:46:52 -0800
changeset 23751 30c6e85aac77
parent 23750 e864353f8c6b
child 23752 70d8be6299ab
trydiff: remove unused code for git index of "combined diff" We only ever produce diffs with one pre- and one post-image, so remove the code for displaying "index" lines for combined diffs.
mercurial/patch.py
--- a/mercurial/patch.py	Tue Jan 06 22:55:01 2015 -0800
+++ b/mercurial/patch.py	Wed Jan 07 08:46:52 2015 -0800
@@ -1747,13 +1747,9 @@
             header.append('old mode %s\n' % omode)
             header.append('new mode %s\n' % nmode)
 
-    def addindexmeta(meta, revs):
+    def addindexmeta(meta, oindex, nindex):
         if opts.git:
-            i = len(revs)
-            if i==2:
-                meta.append('index %s..%s\n' % tuple(revs))
-            elif i==3:
-                meta.append('index %s,%s..%s\n' % tuple(revs))
+            meta.append('index %s..%s\n' % (oindex, nindex))
 
     def gitindex(text):
         if not text:
@@ -1880,7 +1876,7 @@
             if dodiff == 'binary' and not opts.nobinary:
                 text = mdiff.b85diff(to, tn)
                 if text:
-                    addindexmeta(header, [gitindex(to), gitindex(tn)])
+                    addindexmeta(header, gitindex(to), gitindex(tn))
             else:
                 text = mdiff.unidiff(to, date1,
                                      tn, date2,