[PATCH 3 of 3] util: make readfile() operate in binary mode

Patrick Mezard pmezard at gmail.com
Sat May 7 11:54:12 CDT 2011


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1304786393 -7200
# Node ID f87101c493c8118c5006a448ea05aa3b52bc6972
# Parent  b5ca6ec56ebbe371f58d4e5e084b06ea05f948dd
util: make readfile() operate in binary mode

writefile() and appendfile() are already working that way.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -772,7 +772,7 @@
     makedirs(name, mode)
 
 def readfile(path):
-    fp = open(path)
+    fp = open(path, 'rb')
     try:
         return fp.read()
     finally:


More information about the Mercurial-devel mailing list