comparison tests/test-eol-add @ 11249:0bb67503ad4b stable

eol: extension for managing file EOLs
author Martin Geisler <mg@lazybytes.net>
date Mon, 31 May 2010 21:37:01 +0200
parents
children
comparison
equal deleted inserted replaced
11246:8f5ad12db28e 11249:0bb67503ad4b
1 #!/bin/sh
2
3 cat > $HGRCPATH <<EOF
4 [diff]
5 git = 1
6 EOF
7
8 seteol () {
9 if [ $1 = "LF" ]; then
10 EOL='\n'
11 else
12 EOL='\r\n'
13 fi
14 }
15
16 makerepo () {
17 echo
18 echo "# ==== setup repository ===="
19 echo '% hg init'
20 hg init repo
21 cd repo
22
23 printf "first\nsecond\nthird\n" > a.txt
24 hg commit -d '100 0' --addremove -m 'LF commit'
25 cd ..
26 }
27
28 dotest () {
29 seteol $1
30
31 echo
32 echo "% hg clone repo repo-$1"
33 hg clone repo repo-$1
34 cd repo-$1
35
36 cat > .hg/hgrc <<EOF
37 [extensions]
38 eol =
39
40 [eol]
41 native = LF
42 EOF
43
44 cat > .hgeol <<EOF
45 [patterns]
46 **.txt = native
47
48 [repository]
49 native = $1
50 EOF
51
52 echo '% hg add .hgeol'
53 hg add .hgeol
54 echo '% hg status'
55 hg status
56
57 echo '% hg commit'
58 hg commit -d '200 0' -m 'Added .hgeol file'
59
60 echo '% hg status'
61 hg status
62
63 echo '% hg tip -p'
64 hg tip -p | python $TESTDIR/printrepr.py
65
66 cd ..
67 rm -r repo-$1
68 }
69
70 makerepo
71 dotest LF
72 dotest CRLF
73 rm -r repo