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