[PATCH] extdiff.py - write out diffed files in binary mode to avoid crlf become crcrlf on windows

Andrei Vermel avermel at mail.ru
Sun Dec 24 23:06:39 UTC 2006


# HG changeset patch
# User "Andrei Vermel <avermel at mail.ru>"
# Date 1167001111 -10800
# Node ID a58ba4f888f3039886ff689ffc6371f1c5755cd9
# Parent  2b87d3c5ab8e2ac79479c643c30e3949ca64690e
extdiff.py - write out diffed files in binary mode to avoid crlf become crcrlf on windows

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -74,7 +74,7 @@ def dodiff(ui, repo, diffcmd, diffopts, 
             destdir = os.path.dirname(dest)
             if not os.path.isdir(destdir):
                 os.makedirs(destdir)
-            repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'w'))
+            repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'wb'))
         return dirname
 
     def snapshot_wdir(files):
@@ -94,7 +94,7 @@ def dodiff(ui, repo, diffcmd, diffopts, 
             destdir = os.path.dirname(dest)
             if not os.path.isdir(destdir):
                 os.makedirs(destdir)
-            fp = open(dest, 'w')
+            fp = open(dest, 'wb')
             for chunk in util.filechunkiter(repo.wopener(wfn)):
                 fp.write(chunk)
         return dirname
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extdiff_patch
Type: application/octet-stream
Size: 1146 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20061225/90eac867/attachment.obj>


More information about the Mercurial-devel mailing list