[meld] Remove obsolete patch cleaning code from Git



commit 3109363f733d7cec7b2d85cd6aecf658bbbedd71
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat May 18 10:43:02 2013 +1000

    Remove obsolete patch cleaning code from Git
    
    This was used for the old reverse-apply-based diff code and is no
    longer used by Git.

 meld/vc/git.py |   23 -----------------------
 meld/vcview.py |    5 -----
 2 files changed, 0 insertions(+), 28 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 1b66e4e..f803e94 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -350,26 +350,3 @@ class Vc(_vc.CachedVc):
                 if folder == directory:
                     retfiles.append(_vc.File(path, name, state))
         return retdirs, retfiles
-
-    def clean_patch(self, patch):
-        """Remove extended header lines from the provided patch
-        
-        This removes any of Git's extended header information, being lines
-        giving 'index', 'mode', 'new file' or 'deleted file' metadata. If
-        there is no patch content other than this header information (e.g., if
-        a file has had a mode change and nothing else) then an empty patch is
-        returned, to avoid a non-applyable patch. Anything that doesn't look
-        like a Git format patch is returned unchanged.
-        """
-        if not re.match(self.PATCH_INDEX_RE, patch, re.M):
-            return patch
-
-        patch_lines = patch.splitlines(True)
-        for i, line in enumerate(patch_lines):
-            # A bit loose, but this marks the start of a standard format patch
-            if line.startswith("--- "):
-                break
-        else:
-            return ""
-        return "".join([patch_lines[0]] + patch_lines[i:])
-
diff --git a/meld/vcview.py b/meld/vcview.py
index bfbce1c..3c8d1df 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -577,11 +577,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 yield 1
             prefix, patch = diff[0], diff[1]
 
-            try:
-                patch = self.vc.clean_patch(patch)
-            except AttributeError:
-                pass
-
             yield _("[%s] Applying patch") % self.label_text
             if patch:
                 applied = self.show_patch(prefix, patch, silent=silent_error)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]