py3: use bytes() instead of str()
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 02 Mar 2018 07:16:33 +0530
changeset 36696 bcfc4e3b6548
parent 36695 d79d68bb9f7c
child 36697 e77cee5de1c7
py3: use bytes() instead of str() Differential Revision: https://phab.mercurial-scm.org/D2617
hgext/eol.py
hgext/journal.py
hgext/mq.py
--- a/hgext/eol.py	Fri Mar 02 07:15:54 2018 +0530
+++ b/hgext/eol.py	Fri Mar 02 07:16:33 2018 +0530
@@ -222,7 +222,7 @@
                 data = ctx[f].data()
                 if (target == "to-lf" and "\r\n" in data
                     or target == "to-crlf" and singlelf.search(data)):
-                    failed.append((f, target, str(ctx)))
+                    failed.append((f, target, bytes(ctx)))
                 break
         return failed
 
--- a/hgext/journal.py	Fri Mar 02 07:15:54 2018 +0530
+++ b/hgext/journal.py	Fri Mar 02 07:16:33 2018 +0530
@@ -363,7 +363,7 @@
                     # empty file, write version first
                     f.write(str(storageversion) + '\0')
                 f.seek(0, os.SEEK_END)
-                f.write(str(entry) + '\0')
+                f.write(bytes(entry) + '\0')
 
     def filtered(self, namespace=None, name=None):
         """Yield all journal entries with the given namespace or name
--- a/hgext/mq.py	Fri Mar 02 07:15:54 2018 +0530
+++ b/hgext/mq.py	Fri Mar 02 07:16:33 2018 +0530
@@ -780,7 +780,7 @@
 
         diffopts = self.patchopts(diffopts, patch)
         patchf = self.opener(patch, "w")
-        comments = str(ph)
+        comments = bytes(ph)
         if comments:
             patchf.write(comments)
         self.printdiff(repo, diffopts, head, n, fp=patchf)