##// END OF EJS Templates
py3: replace file() with open() in test-win32text.t...
Pulkit Goyal -
r36031:d7238d12 default
parent child Browse files
Show More
@@ -5,9 +5,9 b''
5 > import sys
5 > import sys
6 >
6 >
7 > for path in sys.argv[1:]:
7 > for path in sys.argv[1:]:
8 > data = file(path, 'rb').read()
8 > data = open(path, 'rb').read()
9 > data = data.replace('\n', '\r\n')
9 > data = data.replace(b'\n', b'\r\n')
10 > file(path, 'wb').write(data)
10 > open(path, 'wb').write(data)
11 > EOF
11 > EOF
12 $ echo '[hooks]' >> .hg/hgrc
12 $ echo '[hooks]' >> .hg/hgrc
13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
13 $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
@@ -118,7 +118,7 b' and now for something completely differe'
118 $ hg rem f
118 $ hg rem f
119 $ hg ci -m 4
119 $ hg ci -m 4
120
120
121 $ $PYTHON -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
121 $ $PYTHON -c 'open("bin", "wb").write(b"hello\x00\x0D\x0A")'
122 $ hg add bin
122 $ hg add bin
123 $ hg ci -m 5
123 $ hg ci -m 5
124 $ hg log -v
124 $ hg log -v
@@ -342,7 +342,7 b' and now for something completely differe'
342
342
343 $ rm .hg/hgrc
343 $ rm .hg/hgrc
344 $ (echo some; echo text) > f3
344 $ (echo some; echo text) > f3
345 $ $PYTHON -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
345 $ $PYTHON -c 'open("f4.bat", "wb").write(b"rem empty\x0D\x0A")'
346 $ hg add f3 f4.bat
346 $ hg add f3 f4.bat
347 $ hg ci -m 6
347 $ hg ci -m 6
348 $ cat bin
348 $ cat bin
@@ -395,7 +395,7 b' Disable warning:'
395 $ cat f4.bat
395 $ cat f4.bat
396 rem empty\r (esc)
396 rem empty\r (esc)
397
397
398 $ $PYTHON -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
398 $ $PYTHON -c 'open("f5.sh", "wb").write(b"# empty\x0D\x0A")'
399 $ hg add f5.sh
399 $ hg add f5.sh
400 $ hg ci -m 7
400 $ hg ci -m 7
401 $ cat f5.sh
401 $ cat f5.sh
General Comments 0
You need to be logged in to leave comments. Login now