equal
deleted
inserted
replaced
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 seteol $1 |
|
18 echo |
|
19 echo "# ==== setup $1 repository ====" |
|
20 echo '% hg init' |
|
21 hg init repo |
|
22 cd repo |
|
23 |
|
24 cat > .hgeol <<EOF |
|
25 [repository] |
|
26 native = $1 |
|
27 |
|
28 [patterns] |
|
29 unix.txt = LF |
|
30 win.txt = CRLF |
|
31 **.txt = native |
|
32 EOF |
|
33 |
|
34 printf "first\r\nsecond\r\nthird\r\n" > win.txt |
|
35 printf "first\nsecond\nthird\n" > unix.txt |
|
36 printf "first${EOL}second${EOL}third${EOL}" > native.txt |
|
37 hg commit --addremove -m 'checkin' |
|
38 cd .. |
|
39 } |
|
40 |
|
41 dotest () { |
|
42 seteol $1 |
|
43 |
|
44 echo |
|
45 echo "% hg clone repo repo-$1" |
|
46 hg clone --noupdate repo repo-$1 |
|
47 cd repo-$1 |
|
48 |
|
49 cat > .hg/hgrc <<EOF |
|
50 [extensions] |
|
51 eol = |
|
52 |
|
53 [eol] |
|
54 native = $1 |
|
55 EOF |
|
56 |
|
57 hg update |
|
58 echo '% printrepr.py native.txt' |
|
59 python $TESTDIR/printrepr.py < native.txt |
|
60 |
|
61 echo '% printrepr.py unix.txt' |
|
62 python $TESTDIR/printrepr.py < unix.txt |
|
63 |
|
64 echo '% printrepr.py win.txt' |
|
65 python $TESTDIR/printrepr.py < win.txt |
|
66 |
|
67 printf "first${EOL}third${EOL}" > native.txt |
|
68 printf "first\r\nthird\r\n" > win.txt |
|
69 printf "first\nthird\n" > unix.txt |
|
70 |
|
71 echo '% hg diff' |
|
72 hg diff > p |
|
73 python $TESTDIR/printrepr.py < p |
|
74 |
|
75 echo '% hg revert' |
|
76 hg revert --all |
|
77 |
|
78 echo '% hg import' |
|
79 hg import -m 'patch' p |
|
80 |
|
81 echo '% printrepr.py native.txt' |
|
82 python $TESTDIR/printrepr.py < native.txt |
|
83 echo '% printrepr.py unix.txt' |
|
84 python $TESTDIR/printrepr.py < unix.txt |
|
85 echo '% printrepr.py win.txt' |
|
86 python $TESTDIR/printrepr.py < win.txt |
|
87 |
|
88 echo '% hg diff -c tip' |
|
89 hg diff -c tip | python $TESTDIR/printrepr.py |
|
90 |
|
91 cd .. |
|
92 rm -r repo-$1 |
|
93 } |
|
94 |
|
95 makerepo LF |
|
96 dotest LF |
|
97 dotest CRLF |
|
98 rm -r repo |
|
99 |
|
100 makerepo CRLF |
|
101 dotest LF |
|
102 dotest CRLF |
|
103 rm -r repo |
|