extdiff: open files in binary mode
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 15 Feb 2007 08:14:03 -0200
changeset 4089 0ff50cc7acb4
parent 4088 18dcc22666a0
child 4090 785ad8cd1d31
extdiff: open files in binary mode Problem noticed by Darrell Gallion.
hgext/extdiff.py
--- a/hgext/extdiff.py	Thu Feb 15 12:51:43 2007 +0300
+++ b/hgext/extdiff.py	Thu Feb 15 08:14:03 2007 -0200
@@ -77,7 +77,7 @@
             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):
@@ -99,7 +99,7 @@
             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