[PATCH 2 of 5] trydiff: remove unused code for git index of "combined diff"

Martin von Zweigbergk martinvonz at google.com
Wed Jan 7 13:53:17 CST 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1420649212 28800
#      Wed Jan 07 08:46:52 2015 -0800
# Node ID 30a4c89a7177ec4088926aee2af326d43d76ce68
# Parent  2de614dd5c5ad626f4b059f2b20de964c0302dbe
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.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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,


More information about the Mercurial-devel mailing list