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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Feb 11 09:05:30 EST 2018


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

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 () {



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


More information about the Mercurial-devel mailing list