##// END OF EJS Templates
test-win32text: avoid unix2dos, printf extensions
Patrick Mezard -
r5680:963c516b default
parent child Browse files
Show More
@@ -1,5 +1,14 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat > unix2dos.py <<EOF
4 import sys
5
6 for path in sys.argv[1:]:
7 data = file(path, 'rb').read()
8 data = data.replace('\n', '\r\n')
9 file(path, 'wb').write(data)
10 EOF
11
3 hg init
12 hg init
4 echo '[hooks]' >> .hg/hgrc
13 echo '[hooks]' >> .hg/hgrc
5 echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
14 echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
@@ -12,14 +21,14 b' hg add f'
12 hg ci -m 1 -d'0 0'
21 hg ci -m 1 -d'0 0'
13 echo
22 echo
14
23
15 unix2dos f
24 python unix2dos.py f
16 hg ci -m 2 -d'0 0'
25 hg ci -m 2 -d'0 0'
17 hg revert -a
26 hg revert -a
18 echo
27 echo
19
28
20 mkdir d
29 mkdir d
21 echo hello > d/f2
30 echo hello > d/f2
22 unix2dos d/f2
31 python unix2dos.py d/f2
23 hg add d/f2
32 hg add d/f2
24 hg ci -m 3 -d'0 0'
33 hg ci -m 3 -d'0 0'
25 hg revert -a
34 hg revert -a
@@ -30,7 +39,7 b' hg rem f'
30 hg ci -m 4 -d'0 0'
39 hg ci -m 4 -d'0 0'
31 echo
40 echo
32
41
33 printf 'hello\x00\x0D\x0A' > bin
42 python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
34 hg add bin
43 hg add bin
35 hg ci -m 5 -d'0 0'
44 hg ci -m 5 -d'0 0'
36 hg log -v
45 hg log -v
@@ -40,7 +49,7 b' hg clone . dupe'
40 echo
49 echo
41 for x in a b c d; do echo content > dupe/$x; done
50 for x in a b c d; do echo content > dupe/$x; done
42 hg -R dupe add
51 hg -R dupe add
43 unix2dos dupe/b dupe/c dupe/d
52 python unix2dos.py dupe/b dupe/c dupe/d
44 hg -R dupe ci -m a -d'0 0' dupe/a
53 hg -R dupe ci -m a -d'0 0' dupe/a
45 hg -R dupe ci -m b/c -d'0 0' dupe/[bc]
54 hg -R dupe ci -m b/c -d'0 0' dupe/[bc]
46 hg -R dupe ci -m d -d'0 0' dupe/d
55 hg -R dupe ci -m d -d'0 0' dupe/d
@@ -18,7 +18,7 b' abort: pretxncommit.crlf hook failed'
18 forgetting d/f2
18 forgetting d/f2
19
19
20
20
21 changeset: 2:a55cab36df04
21 changeset: 2:b67b2dae057a
22 tag: tip
22 tag: tip
23 user: test
23 user: test
24 date: Thu Jan 01 00:00:00 1970 +0000
24 date: Thu Jan 01 00:00:00 1970 +0000
@@ -50,7 +50,7 b' adding dupe/a'
50 adding dupe/b
50 adding dupe/b
51 adding dupe/c
51 adding dupe/c
52 adding dupe/d
52 adding dupe/d
53 changeset: 5:81c49ee61396
53 changeset: 5:6e8a7629ff5b
54 tag: tip
54 tag: tip
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:00 1970 +0000
56 date: Thu Jan 01 00:00:00 1970 +0000
@@ -59,7 +59,7 b' description:'
59 d
59 d
60
60
61
61
62 changeset: 4:02184785bcac
62 changeset: 4:ac30a42ce8bc
63 user: test
63 user: test
64 date: Thu Jan 01 00:00:00 1970 +0000
64 date: Thu Jan 01 00:00:00 1970 +0000
65 files: b c
65 files: b c
@@ -67,7 +67,7 b' description:'
67 b/c
67 b/c
68
68
69
69
70 changeset: 3:36e70ffe2c3d
70 changeset: 3:a73b85ef1fb7
71 user: test
71 user: test
72 date: Thu Jan 01 00:00:00 1970 +0000
72 date: Thu Jan 01 00:00:00 1970 +0000
73 files: a
73 files: a
@@ -75,7 +75,7 b' description:'
75 a
75 a
76
76
77
77
78 changeset: 2:a55cab36df04
78 changeset: 2:b67b2dae057a
79 user: test
79 user: test
80 date: Thu Jan 01 00:00:00 1970 +0000
80 date: Thu Jan 01 00:00:00 1970 +0000
81 files: bin
81 files: bin
@@ -107,9 +107,9 b' adding manifests'
107 adding file changes
107 adding file changes
108 added 3 changesets with 4 changes to 4 files
108 added 3 changesets with 4 changes to 4 files
109 Attempt to commit or push text file(s) using CRLF line endings
109 Attempt to commit or push text file(s) using CRLF line endings
110 in 02184785bcac: b
110 in ac30a42ce8bc: b
111 in 02184785bcac: c
111 in ac30a42ce8bc: c
112 in 81c49ee61396: d
112 in 6e8a7629ff5b: d
113
113
114 To prevent this mistake in your local repository,
114 To prevent this mistake in your local repository,
115 add to Mercurial.ini or .hg/hgrc:
115 add to Mercurial.ini or .hg/hgrc:
@@ -129,7 +129,7 b' transaction abort!'
129 rollback completed
129 rollback completed
130 abort: pretxnchangegroup.crlf hook failed
130 abort: pretxnchangegroup.crlf hook failed
131
131
132 changeset: 2:a55cab36df04
132 changeset: 2:b67b2dae057a
133 tag: tip
133 tag: tip
134 user: test
134 user: test
135 date: Thu Jan 01 00:00:00 1970 +0000
135 date: Thu Jan 01 00:00:00 1970 +0000
General Comments 0
You need to be logged in to leave comments. Login now