Show More
@@ -1,276 +1,278 | |||
|
1 | 1 | Test EOL update |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [diff] |
|
5 | 5 | > git = 1 |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ seteol () { |
|
9 | 9 | > if [ $1 = "LF" ]; then |
|
10 | 10 | > EOL='\n' |
|
11 | 11 | > else |
|
12 | 12 | > EOL='\r\n' |
|
13 | 13 | > fi |
|
14 | 14 | > } |
|
15 | 15 | |
|
16 | 16 | $ makerepo () { |
|
17 | 17 | > echo |
|
18 | 18 | > echo "# ==== setup repository ====" |
|
19 | 19 | > echo '% hg init' |
|
20 | 20 | > hg init repo |
|
21 | 21 | > cd repo |
|
22 | 22 | > |
|
23 | 23 | > cat > .hgeol <<EOF |
|
24 | 24 | > [patterns] |
|
25 | 25 | > **.txt = LF |
|
26 | 26 | > EOF |
|
27 | 27 | > |
|
28 | 28 | > printf "first\nsecond\nthird\n" > a.txt |
|
29 | 29 | > printf "f\r\n" > f |
|
30 | 30 | > hg commit --addremove -m 'LF commit' |
|
31 | 31 | > |
|
32 | 32 | > cat > .hgeol <<EOF |
|
33 | 33 | > [patterns] |
|
34 | 34 | > **.txt = CRLF |
|
35 | 35 | > f = LF |
|
36 | 36 | > EOF |
|
37 | 37 | > |
|
38 | 38 | > printf "first\r\nsecond\r\nthird\r\n" > a.txt |
|
39 | 39 | > printf "f\n" > f |
|
40 | 40 | > hg commit -m 'CRLF commit' |
|
41 | 41 | > |
|
42 | 42 | > cd .. |
|
43 | 43 | > } |
|
44 | 44 | |
|
45 | 45 | $ dotest () { |
|
46 | 46 | > seteol $1 |
|
47 | 47 | > |
|
48 | 48 | > echo |
|
49 | 49 | > echo "% hg clone repo repo-$1" |
|
50 | 50 | > hg clone --noupdate repo repo-$1 |
|
51 | 51 | > cd repo-$1 |
|
52 | 52 | > |
|
53 | 53 | > cat > .hg/hgrc <<EOF |
|
54 | 54 | > [extensions] |
|
55 | 55 | > eol = |
|
56 | 56 | > EOF |
|
57 | 57 | > |
|
58 | 58 | > hg update |
|
59 | 59 | > |
|
60 | 60 | > echo '% a.txt (before)' |
|
61 | 61 | > cat a.txt |
|
62 | 62 | > |
|
63 | 63 | > printf "first${EOL}third${EOL}" > a.txt |
|
64 | 64 | > |
|
65 | 65 | > echo '% a.txt (after)' |
|
66 | 66 | > cat a.txt |
|
67 | 67 | > echo '% hg diff' |
|
68 | 68 | > hg diff |
|
69 | 69 | > |
|
70 | 70 | > echo '% hg update 0' |
|
71 | 71 | > hg update 0 |
|
72 | 72 | > |
|
73 | 73 | > echo '% a.txt' |
|
74 | 74 | > cat a.txt |
|
75 | 75 | > echo '% hg diff' |
|
76 | 76 | > hg diff |
|
77 | 77 | > |
|
78 | 78 | > |
|
79 | 79 | > cd .. |
|
80 | 80 | > rm -r repo-$1 |
|
81 | 81 | > } |
|
82 | 82 | |
|
83 | 83 | $ makerepo |
|
84 | 84 | |
|
85 | 85 | # ==== setup repository ==== |
|
86 | 86 | % hg init |
|
87 | 87 | adding .hgeol |
|
88 | 88 | adding a.txt |
|
89 | 89 | adding f |
|
90 | 90 | $ dotest LF |
|
91 | 91 | |
|
92 | 92 | % hg clone repo repo-LF |
|
93 | 93 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
94 | 94 | % a.txt (before) |
|
95 | 95 | first\r (esc) |
|
96 | 96 | second\r (esc) |
|
97 | 97 | third\r (esc) |
|
98 | 98 | % a.txt (after) |
|
99 | 99 | first |
|
100 | 100 | third |
|
101 | 101 | % hg diff |
|
102 | 102 | diff --git a/a.txt b/a.txt |
|
103 | 103 | --- a/a.txt |
|
104 | 104 | +++ b/a.txt |
|
105 | 105 | @@ -1,3 +1,2 @@ |
|
106 | 106 | first\r (esc) |
|
107 | 107 | -second\r (esc) |
|
108 | 108 | third\r (esc) |
|
109 | 109 | % hg update 0 |
|
110 | 110 | merging a.txt |
|
111 | 111 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
112 | 112 | % a.txt |
|
113 | 113 | first |
|
114 | 114 | third |
|
115 | 115 | % hg diff |
|
116 | 116 | diff --git a/a.txt b/a.txt |
|
117 | 117 | --- a/a.txt |
|
118 | 118 | +++ b/a.txt |
|
119 | 119 | @@ -1,3 +1,2 @@ |
|
120 | 120 | first |
|
121 | 121 | -second |
|
122 | 122 | third |
|
123 | 123 | $ dotest CRLF |
|
124 | 124 | |
|
125 | 125 | % hg clone repo repo-CRLF |
|
126 | 126 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | % a.txt (before) |
|
128 | 128 | first\r (esc) |
|
129 | 129 | second\r (esc) |
|
130 | 130 | third\r (esc) |
|
131 | 131 | % a.txt (after) |
|
132 | 132 | first\r (esc) |
|
133 | 133 | third\r (esc) |
|
134 | 134 | % hg diff |
|
135 | 135 | diff --git a/a.txt b/a.txt |
|
136 | 136 | --- a/a.txt |
|
137 | 137 | +++ b/a.txt |
|
138 | 138 | @@ -1,3 +1,2 @@ |
|
139 | 139 | first\r (esc) |
|
140 | 140 | -second\r (esc) |
|
141 | 141 | third\r (esc) |
|
142 | 142 | % hg update 0 |
|
143 | 143 | merging a.txt |
|
144 | 144 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
145 | 145 | % a.txt |
|
146 | 146 | first |
|
147 | 147 | third |
|
148 | 148 | % hg diff |
|
149 | 149 | diff --git a/a.txt b/a.txt |
|
150 | 150 | --- a/a.txt |
|
151 | 151 | +++ b/a.txt |
|
152 | 152 | @@ -1,3 +1,2 @@ |
|
153 | 153 | first |
|
154 | 154 | -second |
|
155 | 155 | third |
|
156 | 156 | |
|
157 | 157 | Test in repo using eol extension, while keeping an eye on how filters are |
|
158 | 158 | applied: |
|
159 | 159 | |
|
160 | 160 | $ cd repo |
|
161 | 161 | |
|
162 | 162 | $ hg up -q -c -r null |
|
163 | 163 | $ cat > .hg/hgrc <<EOF |
|
164 | 164 | > [extensions] |
|
165 | 165 | > eol = |
|
166 | 166 | > EOF |
|
167 | 167 | |
|
168 | 168 | Update to revision 0 which has no .hgeol, shouldn't use any filters, and |
|
169 | 169 | obviously should leave things as tidy as they were before the clean update. |
|
170 | 170 | |
|
171 | 171 | $ hg up -c -r 0 -v --debug |
|
172 | 172 | resolving manifests |
|
173 | 173 | branchmerge: False, force: False, partial: False |
|
174 | 174 | ancestor: 000000000000, local: 000000000000+, remote: 15cbdf8ca3db |
|
175 | 175 | calling hook preupdate.eol: hgext.eol.preupdate |
|
176 | 176 | .hgeol: remote created -> g |
|
177 | 177 | getting .hgeol |
|
178 | 178 | filtering .hgeol through isbinary |
|
179 | 179 | a.txt: remote created -> g |
|
180 | 180 | getting a.txt |
|
181 | 181 | filtering a.txt through tolf |
|
182 | 182 | f: remote created -> g |
|
183 | 183 | getting f |
|
184 | 184 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
185 | 185 | $ hg st |
|
186 | 186 | |
|
187 | 187 | $ hg branch b |
|
188 | 188 | marked working directory as branch b |
|
189 | 189 | (branches are permanent and global, did you want a bookmark?) |
|
190 | 190 | $ hg ci -m b |
|
191 | 191 | |
|
192 | 192 | Merge changes that apply a filter to f: |
|
193 | 193 | |
|
194 | 194 | $ hg merge 1 |
|
195 | 195 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
196 | 196 | (branch merge, don't forget to commit) |
|
197 | 197 | $ hg st |
|
198 | 198 | M .hgeol |
|
199 | 199 | M a.txt |
|
200 | 200 | M f |
|
201 | 201 | $ hg diff |
|
202 | 202 | diff --git a/.hgeol b/.hgeol |
|
203 | 203 | --- a/.hgeol |
|
204 | 204 | +++ b/.hgeol |
|
205 | 205 | @@ -1,2 +1,3 @@ |
|
206 | 206 | [patterns] |
|
207 | 207 | -**.txt = LF |
|
208 | 208 | +**.txt = CRLF |
|
209 | 209 | +f = LF |
|
210 | 210 | diff --git a/a.txt b/a.txt |
|
211 | 211 | --- a/a.txt |
|
212 | 212 | +++ b/a.txt |
|
213 | 213 | @@ -1,3 +1,3 @@ |
|
214 | 214 | -first |
|
215 | 215 | -second |
|
216 | 216 | -third |
|
217 | 217 | +first\r (esc) |
|
218 | 218 | +second\r (esc) |
|
219 | 219 | +third\r (esc) |
|
220 | 220 | diff --git a/f b/f |
|
221 | 221 | --- a/f |
|
222 | 222 | +++ b/f |
|
223 | 223 | @@ -1,1 +1,1 @@ |
|
224 | 224 | -f\r (esc) |
|
225 | 225 | +f |
|
226 | 226 | |
|
227 | 227 | Abort the merge with up -C to revision 0. |
|
228 | 228 | Note that files are filtered correctly for revision 0: f is not filtered, a.txt |
|
229 | 229 | is filtered with tolf, and everything is left tidy. |
|
230 | 230 | |
|
231 | 231 | $ touch .hgeol * # ensure consistent dirtyness checks ignoring dirstate |
|
232 | 232 | $ hg up -C -r 0 -v --debug |
|
233 | 233 | eol: detected change in .hgeol |
|
234 | 234 | resolving manifests |
|
235 | 235 | branchmerge: False, force: True, partial: False |
|
236 | 236 | ancestor: 1db78bdd3bd6+, local: 1db78bdd3bd6+, remote: 15cbdf8ca3db |
|
237 | 237 | calling hook preupdate.eol: hgext.eol.preupdate |
|
238 | 238 | .hgeol: remote is newer -> g |
|
239 | 239 | getting .hgeol |
|
240 | 240 | filtering .hgeol through isbinary |
|
241 | 241 | a.txt: remote is newer -> g |
|
242 | 242 | getting a.txt |
|
243 | 243 | filtering a.txt through tolf |
|
244 | 244 | f: remote is newer -> g |
|
245 | 245 | getting f |
|
246 | 246 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
247 | 247 | |
|
248 | 248 | $ touch .hgeol * |
|
249 | 249 | $ hg st --debug |
|
250 | 250 | eol: detected change in .hgeol |
|
251 | 251 | filtering .hgeol through isbinary |
|
252 | 252 | filtering a.txt through tolf |
|
253 | skip updating dirstate: identity mismatch (?) | |
|
253 | 254 | $ hg diff |
|
254 | 255 | |
|
255 | 256 | Things were clean, and updating again will not change anything: |
|
256 | 257 | |
|
257 | 258 | $ touch .hgeol * |
|
258 | 259 | $ hg up -C -r 0 -v --debug |
|
259 | 260 | eol: detected change in .hgeol |
|
260 | 261 | filtering .hgeol through isbinary |
|
261 | 262 | filtering a.txt through tolf |
|
262 | 263 | resolving manifests |
|
263 | 264 | branchmerge: False, force: True, partial: False |
|
264 | 265 | ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db |
|
265 | 266 | calling hook preupdate.eol: hgext.eol.preupdate |
|
267 | starting 4 threads for background file closing (?) | |
|
266 | 268 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
267 | 269 | |
|
268 | 270 | $ touch .hgeol * |
|
269 | 271 | $ hg st --debug |
|
270 | 272 | eol: detected change in .hgeol |
|
271 | 273 | filtering .hgeol through isbinary |
|
272 | 274 | filtering a.txt through tolf |
|
273 | 275 | |
|
274 | 276 | $ cd .. |
|
275 | 277 | |
|
276 | 278 | $ rm -r repo |
General Comments 0
You need to be logged in to leave comments.
Login now