Add patch.eol to ignore EOLs when patching (issue1019) stable
authorPatrick Mezard <pmezard@gmail.com>
Mon, 15 Jun 2009 00:03:26 +0200
branchstable
changeset 577 0cdbdf79d5e9
parent 573 197aeca9108a
child 578 b9b551e18502
child 580 a5db6cec7863
Add patch.eol to ignore EOLs when patching (issue1019) The intent is to fix many issues involving patching when win32ext is enabled. With win32ext, the working directory and repository files EOLs are not the same which means that patches made on a non-win32ext host do not apply cleanly because of EOLs discrepancies. A theorically correct approach would be transform either the patched file or the patch content with the encoding/decoding filters used by win32ext. This solution is tricky to implement and invasive, instead we prefer to address the win32ext case, by offering a way to ignore input EOLs when patching and rewriting them when saving the patched result. [ original upstream message ]
hgkw/keyword.py
--- a/hgkw/keyword.py	Tue Jun 09 09:25:34 2009 -0400
+++ b/hgkw/keyword.py	Mon Jun 15 00:03:26 2009 +0200
@@ -485,10 +485,10 @@
                 release(lock, wlock)
 
     # monkeypatches
-    def kwpatchfile_init(orig, self, ui, fname, opener, missing=False):
+    def kwpatchfile_init(orig, self, ui, fname, opener, missing=False, eol=None):
         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
         rejects or conflicts due to expanded keywords in working dir.'''
-        orig(self, ui, fname, opener, missing)
+        orig(self, ui, fname, opener, missing, eol)
         # shrink keywords read from working dir
         self.lines = kwt.shrinklines(self.fname, self.lines)