##// END OF EJS Templates
py3: use open() instead of file()...
Pulkit Goyal -
r35963:1dbd8a62 default
parent child Browse files
Show More
@@ -10,7 +10,7 b' Test interactions between mq and patch.e'
10 > EOF
10 > EOF
11
11
12 $ cat > makepatch.py <<EOF
12 $ cat > makepatch.py <<EOF
13 > f = file('eol.diff', 'wb')
13 > f = open('eol.diff', 'wb')
14 > w = f.write
14 > w = f.write
15 > w('test message\n')
15 > w('test message\n')
16 > w('diff --git a/a b/a\n')
16 > w('diff --git a/a b/a\n')
@@ -30,7 +30,7 b' Test interactions between mq and patch.e'
30
30
31 $ cat > cateol.py <<EOF
31 $ cat > cateol.py <<EOF
32 > import sys
32 > import sys
33 > for line in file(sys.argv[1], 'rb'):
33 > for line in open(sys.argv[1], 'rb'):
34 > line = line.replace('\r', '<CR>')
34 > line = line.replace('\r', '<CR>')
35 > line = line.replace('\n', '<LF>')
35 > line = line.replace('\n', '<LF>')
36 > print(line)
36 > print(line)
@@ -44,7 +44,7 b' Test interactions between mq and patch.e'
44
44
45 Test different --eol values
45 Test different --eol values
46
46
47 $ $PYTHON -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
47 $ $PYTHON -c 'open("a", "wb").write("a\nb\nc\nd\ne")'
48 $ hg ci -Am adda
48 $ hg ci -Am adda
49 adding .hgignore
49 adding .hgignore
50 adding a
50 adding a
@@ -152,15 +152,15 b' Test .rej file EOL are left unchanged'
152
152
153 $ hg init testeol
153 $ hg init testeol
154 $ cd testeol
154 $ cd testeol
155 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
155 $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n3\r\n4')"
156 $ hg ci -Am adda
156 $ hg ci -Am adda
157 adding a
157 adding a
158 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
158 $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n33\r\n4')"
159 $ hg qnew patch1
159 $ hg qnew patch1
160 $ hg qpop
160 $ hg qpop
161 popping patch1
161 popping patch1
162 patch queue now empty
162 patch queue now empty
163 $ $PYTHON -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
163 $ $PYTHON -c "open('a', 'wb').write('1\r\n22\r\n33\r\n4')"
164 $ hg ci -m changea
164 $ hg ci -m changea
165
165
166 $ hg --config 'patch.eol=LF' qpush
166 $ hg --config 'patch.eol=LF' qpush
General Comments 0
You need to be logged in to leave comments. Login now