Patchwork D2617: py3: use bytes() instead of str()

login
register
mail settings
Submitter phabricator
Date March 3, 2018, 11:24 p.m.
Message ID <8d4d658a0cd425a37a23293c4a386b4f@localhost.localdomain>
Download mbox | patch
Permalink /patch/28870/
State Not Applicable
Headers show

Comments

phabricator - March 3, 2018, 11:24 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9d8ac10da5ce: py3: use bytes() instead of str() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2617?vs=6501&id=6505

REVISION DETAIL
  https://phab.mercurial-scm.org/D2617

AFFECTED FILES
  hgext/eol.py
  hgext/journal.py
  hgext/mq.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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)
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -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
diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -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