Show More
@@ -1,32 +1,40 b'' | |||||
1 | #!/bin/sh |
|
|||
2 |
|
1 | |||
3 | cat > unix2mac.py <<EOF |
|
2 | $ cat > unix2mac.py <<EOF | |
4 | import sys |
|
3 | > import sys | |
5 |
|
4 | > | ||
6 | for path in sys.argv[1:]: |
|
5 | > for path in sys.argv[1:]: | |
7 | data = file(path, 'rb').read() |
|
6 | > data = file(path, 'rb').read() | |
8 | data = data.replace('\n', '\r') |
|
7 | > data = data.replace('\n', '\r') | |
9 | file(path, 'wb').write(data) |
|
8 | > file(path, 'wb').write(data) | |
10 | EOF |
|
9 | > EOF | |
11 |
|
10 | $ cat > print.py <<EOF | ||
12 | cat > print.py <<EOF |
|
11 | > import sys | |
13 | import sys |
|
12 | > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>')) | |
14 | print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>')) |
|
13 | > EOF | |
15 | EOF |
|
14 | $ hg init | |
16 |
|
15 | $ echo '[hooks]' >> .hg/hgrc | ||
17 | hg init |
|
16 | $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc | |
18 | echo '[hooks]' >> .hg/hgrc |
|
17 | $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc | |
19 | echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc |
|
18 | $ cat .hg/hgrc | |
20 | echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc |
|
19 | [hooks] | |
21 | cat .hg/hgrc |
|
20 | pretxncommit.cr = python:hgext.win32text.forbidcr | |
22 | echo |
|
21 | pretxnchangegroup.cr = python:hgext.win32text.forbidcr | |
23 |
|
22 | $ echo | ||
24 | echo hello > f |
|
23 | ||
25 | hg add f |
|
24 | $ echo hello > f | |
26 | hg ci -m 1 |
|
25 | $ hg add f | |
27 | echo |
|
26 | $ hg ci -m 1 | |
28 |
|
27 | $ echo | ||
29 | python unix2mac.py f |
|
28 | ||
30 | hg ci -m 2 |
|
29 | $ python unix2mac.py f | |
31 | hg cat f | python print.py |
|
30 | $ hg ci -m 2 | |
32 | cat f | python print.py |
|
31 | Attempt to commit or push text file(s) using CR line endings | |
|
32 | in dea860dc51ec: f | |||
|
33 | transaction abort! | |||
|
34 | rollback completed | |||
|
35 | abort: pretxncommit.cr hook failed | |||
|
36 | [255] | |||
|
37 | $ hg cat f | python print.py | |||
|
38 | hello<LF> | |||
|
39 | $ cat f | python print.py | |||
|
40 | hello<CR> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now