Patchwork D2132: py3: replace file() with open() in test-convert-hg-source.t

login
register
mail settings
Submitter phabricator
Date Feb. 12, 2018, 11:07 a.m.
Message ID <8cebbd3001ca2193ef811510d915193d@localhost.localdomain>
Download mbox | patch
Permalink /patch/27659/
State Not Applicable
Headers show

Comments

phabricator - Feb. 12, 2018, 11:07 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3c9f2d4dbb39: py3: replace file() with open() in test-convert-hg-source.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2132?vs=5481&id=5485

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

AFFECTED FILES
  tests/test-convert-hg-source.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-convert-hg-source.t b/tests/test-convert-hg-source.t
--- a/tests/test-convert-hg-source.t
+++ b/tests/test-convert-hg-source.t
@@ -126,9 +126,9 @@ 
   $ cat > rewrite.py <<EOF
   > import sys
   > # Interlace LF and CRLF
-  > lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n'))
-  >          for i, l in enumerate(file(sys.argv[1]))]
-  > file(sys.argv[1], 'wb').write(''.join(lines))
+  > lines = [(l.rstrip() + ((i % 2) and b'\n' or b'\r\n'))
+  >          for i, l in enumerate(open(sys.argv[1], 'rb'))]
+  > open(sys.argv[1], 'wb').write(b''.join(lines))
   > EOF
   $ $PYTHON rewrite.py new/.hg/shamap
   $ cd orig