diff hgext/convert/convcmd.py @ 36132:42a393ea56d2

convert: open all files in binary mode Differential Revision: https://phab.mercurial-scm.org/D2220
author Augie Fackler <augie@google.com>
date Mon, 12 Feb 2018 23:50:58 -0500
parents eefabd9ed3e1
children 6df206ef4b10
line wrap: on
line diff
--- a/hgext/convert/convcmd.py	Mon Feb 12 22:29:36 2018 -0500
+++ b/hgext/convert/convcmd.py	Mon Feb 12 23:50:58 2018 -0500
@@ -202,7 +202,7 @@
             return {}
         m = {}
         try:
-            fp = open(path, 'r')
+            fp = open(path, 'rb')
             for i, line in enumerate(util.iterfile(fp)):
                 line = line.splitlines()[0].rstrip()
                 if not line:
@@ -407,13 +407,13 @@
         authorfile = self.authorfile
         if authorfile:
             self.ui.status(_('writing author map file %s\n') % authorfile)
-            ofile = open(authorfile, 'w+')
+            ofile = open(authorfile, 'wb+')
             for author in self.authors:
                 ofile.write("%s=%s\n" % (author, self.authors[author]))
             ofile.close()
 
     def readauthormap(self, authorfile):
-        afile = open(authorfile, 'r')
+        afile = open(authorfile, 'rb')
         for line in afile:
 
             line = line.strip()