Show More
@@ -1,83 +1,152 b'' | |||||
1 | #!/bin/sh |
|
1 | Test EOL update | |
2 |
|
2 | |||
3 | cat > $HGRCPATH <<EOF |
|
3 | $ cat > $HGRCPATH <<EOF | |
4 | [diff] |
|
4 | > [diff] | |
5 | git = 1 |
|
5 | > git = 1 | |
6 | EOF |
|
6 | > EOF | |
7 |
|
7 | |||
8 | seteol () { |
|
8 | $ seteol () { | |
9 | if [ $1 = "LF" ]; then |
|
9 | > if [ $1 = "LF" ]; then | |
10 | EOL='\n' |
|
10 | > EOL='\n' | |
11 | else |
|
11 | > else | |
12 | EOL='\r\n' |
|
12 | > EOL='\r\n' | |
13 | fi |
|
13 | > fi | |
14 | } |
|
14 | > } | |
15 |
|
15 | |||
16 | makerepo () { |
|
16 | $ makerepo () { | |
17 | echo |
|
17 | > echo | |
18 | echo "# ==== setup repository ====" |
|
18 | > echo "# ==== setup repository ====" | |
19 | echo '% hg init' |
|
19 | > echo '% hg init' | |
20 | hg init repo |
|
20 | > hg init repo | |
21 | cd repo |
|
21 | > cd repo | |
22 |
|
22 | > | ||
23 | cat > .hgeol <<EOF |
|
23 | > cat > .hgeol <<EOF | |
24 | [patterns] |
|
24 | > [patterns] | |
25 | **.txt = LF |
|
25 | > **.txt = LF | |
26 | EOF |
|
26 | > EOF | |
27 |
|
27 | > | ||
28 | printf "first\nsecond\nthird\n" > a.txt |
|
28 | > printf "first\nsecond\nthird\n" > a.txt | |
29 | hg commit --addremove -m 'LF commit' |
|
29 | > hg commit --addremove -m 'LF commit' | |
30 |
|
30 | > | ||
31 | cat > .hgeol <<EOF |
|
31 | > cat > .hgeol <<EOF | |
32 | [patterns] |
|
32 | > [patterns] | |
33 | **.txt = CRLF |
|
33 | > **.txt = CRLF | |
34 | EOF |
|
34 | > EOF | |
35 |
|
35 | > | ||
36 | printf "first\r\nsecond\r\nthird\r\n" > a.txt |
|
36 | > printf "first\r\nsecond\r\nthird\r\n" > a.txt | |
37 | hg commit -m 'CRLF commit' |
|
37 | > hg commit -m 'CRLF commit' | |
38 |
|
38 | > | ||
39 | cd .. |
|
39 | > cd .. | |
40 | } |
|
40 | > } | |
41 |
|
41 | |||
42 | dotest () { |
|
42 | $ dotest () { | |
43 | seteol $1 |
|
43 | > seteol $1 | |
44 |
|
44 | > | ||
45 | echo |
|
45 | > echo | |
46 | echo "% hg clone repo repo-$1" |
|
46 | > echo "% hg clone repo repo-$1" | |
47 | hg clone --noupdate repo repo-$1 |
|
47 | > hg clone --noupdate repo repo-$1 | |
48 | cd repo-$1 |
|
48 | > cd repo-$1 | |
49 |
|
49 | > | ||
50 | cat > .hg/hgrc <<EOF |
|
50 | > cat > .hg/hgrc <<EOF | |
51 | [extensions] |
|
51 | > [extensions] | |
52 | eol = |
|
52 | > eol = | |
53 | EOF |
|
53 | > EOF | |
54 |
|
54 | > | ||
55 | hg update |
|
55 | > hg update | |
56 |
|
56 | > | ||
57 | echo '% printrepr.py a.txt (before)' |
|
57 | > echo '% printrepr.py a.txt (before)' | |
58 | python $TESTDIR/printrepr.py < a.txt |
|
58 | > python $TESTDIR/printrepr.py < a.txt | |
59 |
|
59 | > | ||
60 | printf "first${EOL}third${EOL}" > a.txt |
|
60 | > printf "first${EOL}third${EOL}" > a.txt | |
|
61 | > | |||
|
62 | > echo '% printrepr.py a.txt (after)' | |||
|
63 | > python $TESTDIR/printrepr.py < a.txt | |||
|
64 | > echo '% hg diff' | |||
|
65 | > hg diff | python $TESTDIR/printrepr.py | |||
|
66 | > | |||
|
67 | > echo '% hg update 0' | |||
|
68 | > hg update 0 | |||
|
69 | > | |||
|
70 | > echo '% printrepr.py a.txt' | |||
|
71 | > python $TESTDIR/printrepr.py < a.txt | |||
|
72 | > echo '% hg diff' | |||
|
73 | > hg diff | python $TESTDIR/printrepr.py | |||
|
74 | > | |||
|
75 | > | |||
|
76 | > cd .. | |||
|
77 | > rm -r repo-$1 | |||
|
78 | > } | |||
61 |
|
79 | |||
62 | echo '% printrepr.py a.txt (after)' |
|
80 | $ makerepo | |
63 | python $TESTDIR/printrepr.py < a.txt |
|
81 | ||
64 | echo '% hg diff' |
|
82 | # ==== setup repository ==== | |
65 | hg diff | python $TESTDIR/printrepr.py |
|
83 | % hg init | |
66 |
|
84 | adding .hgeol | ||
67 | echo '% hg update 0' |
|
85 | adding a.txt | |
68 | hg update 0 |
|
86 | $ dotest LF | |
69 |
|
87 | |||
70 | echo '% printrepr.py a.txt' |
|
88 | % hg clone repo repo-LF | |
71 | python $TESTDIR/printrepr.py < a.txt |
|
89 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
72 | echo '% hg diff' |
|
90 | % printrepr.py a.txt (before) | |
73 | hg diff | python $TESTDIR/printrepr.py |
|
91 | first\r | |
74 |
|
92 | second\r | ||
75 |
|
93 | third\r | ||
76 | cd .. |
|
94 | % printrepr.py a.txt (after) | |
77 | rm -r repo-$1 |
|
95 | first | |
78 | } |
|
96 | third | |
79 |
|
97 | % hg diff | ||
80 | makerepo |
|
98 | diff --git a/a.txt b/a.txt | |
81 | dotest LF |
|
99 | --- a/a.txt | |
82 | dotest CRLF |
|
100 | +++ b/a.txt | |
83 | rm -r repo |
|
101 | @@ -1,3 +1,2 @@ | |
|
102 | first\r | |||
|
103 | -second\r | |||
|
104 | third\r | |||
|
105 | % hg update 0 | |||
|
106 | merging a.txt | |||
|
107 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
108 | % printrepr.py a.txt | |||
|
109 | first | |||
|
110 | third | |||
|
111 | % hg diff | |||
|
112 | diff --git a/a.txt b/a.txt | |||
|
113 | --- a/a.txt | |||
|
114 | +++ b/a.txt | |||
|
115 | @@ -1,3 +1,2 @@ | |||
|
116 | first | |||
|
117 | -second | |||
|
118 | third | |||
|
119 | $ dotest CRLF | |||
|
120 | ||||
|
121 | % hg clone repo repo-CRLF | |||
|
122 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
123 | % printrepr.py a.txt (before) | |||
|
124 | first\r | |||
|
125 | second\r | |||
|
126 | third\r | |||
|
127 | % printrepr.py a.txt (after) | |||
|
128 | first\r | |||
|
129 | third\r | |||
|
130 | % hg diff | |||
|
131 | diff --git a/a.txt b/a.txt | |||
|
132 | --- a/a.txt | |||
|
133 | +++ b/a.txt | |||
|
134 | @@ -1,3 +1,2 @@ | |||
|
135 | first\r | |||
|
136 | -second\r | |||
|
137 | third\r | |||
|
138 | % hg update 0 | |||
|
139 | merging a.txt | |||
|
140 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
141 | % printrepr.py a.txt | |||
|
142 | first | |||
|
143 | third | |||
|
144 | % hg diff | |||
|
145 | diff --git a/a.txt b/a.txt | |||
|
146 | --- a/a.txt | |||
|
147 | +++ b/a.txt | |||
|
148 | @@ -1,3 +1,2 @@ | |||
|
149 | first | |||
|
150 | -second | |||
|
151 | third | |||
|
152 | $ rm -r repo |
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