Patchwork D2129: py3: replace file() with open() in test-eol.t

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 2:05 p.m.
Message ID <1d4f009e7f45a3064968792ce1fcee05@localhost.localdomain>
Download mbox | patch
Permalink /patch/27570/
State Not Applicable
Headers show

Comments

phabricator - Feb. 11, 2018, 2:05 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb85b0bbed6de: py3: replace file() with open() in test-eol.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2129?vs=5392&id=5418

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

AFFECTED FILES
  tests/test-eol.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-eol.t b/tests/test-eol.t
--- a/tests/test-eol.t
+++ b/tests/test-eol.t
@@ -17,12 +17,12 @@ 
   >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
   > except ImportError:
   >     pass
-  > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
+  > (old, new) = sys.argv[1] == 'LF' and (b'\n', b'\r\n') or (b'\r\n', b'\n')
   > print("%% switching encoding from %r to %r" % (old, new))
   > for path in sys.argv[2:]:
-  >     data = file(path, 'rb').read()
+  >     data = open(path, 'rb').read()
   >     data = data.replace(old, new)
-  >     file(path, 'wb').write(data)
+  >     open(path, 'wb').write(data)
   > EOF
 
   $ seteol () {