##// END OF EJS Templates
tests: use `f --hexdump` to print file content...
Gregory Szorc -
r45132:da9b7f96 default
parent child Browse files
Show More
@@ -1,38 +1,36 b''
1
1
2 $ cat > unix2mac.py <<EOF
2 $ cat > unix2mac.py <<EOF
3 > import sys
3 > import sys
4 >
4 >
5 > for path in sys.argv[1:]:
5 > for path in sys.argv[1:]:
6 > data = open(path, 'rb').read()
6 > data = open(path, 'rb').read()
7 > data = data.replace(b'\n', b'\r')
7 > data = data.replace(b'\n', b'\r')
8 > open(path, 'wb').write(data)
8 > open(path, 'wb').write(data)
9 > EOF
9 > EOF
10 $ cat > print.py <<EOF
11 > import sys
12 > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
13 > EOF
14 $ hg init
10 $ hg init
15 $ echo '[hooks]' >> .hg/hgrc
11 $ echo '[hooks]' >> .hg/hgrc
16 $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
12 $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
17 $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
13 $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
18 $ cat .hg/hgrc
14 $ cat .hg/hgrc
19 [hooks]
15 [hooks]
20 pretxncommit.cr = python:hgext.win32text.forbidcr
16 pretxncommit.cr = python:hgext.win32text.forbidcr
21 pretxnchangegroup.cr = python:hgext.win32text.forbidcr
17 pretxnchangegroup.cr = python:hgext.win32text.forbidcr
22
18
23 $ echo hello > f
19 $ echo hello > f
24 $ hg add f
20 $ hg add f
25 $ hg ci -m 1
21 $ hg ci -m 1
26
22
27 $ "$PYTHON" unix2mac.py f
23 $ "$PYTHON" unix2mac.py f
28 $ hg ci -m 2
24 $ hg ci -m 2
29 attempt to commit or push text file(s) using CR line endings
25 attempt to commit or push text file(s) using CR line endings
30 in dea860dc51ec: f
26 in dea860dc51ec: f
31 transaction abort!
27 transaction abort!
32 rollback completed
28 rollback completed
33 abort: pretxncommit.cr hook failed
29 abort: pretxncommit.cr hook failed
34 [255]
30 [255]
35 $ hg cat f | "$PYTHON" print.py
31 $ hg cat f | f --hexdump
36 hello<LF>
32
37 $ cat f | "$PYTHON" print.py
33 0000: 68 65 6c 6c 6f 0a |hello.|
38 hello<CR>
34 $ f --hexdump f
35 f:
36 0000: 68 65 6c 6c 6f 0d |hello.|
General Comments 0
You need to be logged in to leave comments. Login now