125
125
if roundtrip_to is None:
126
126
roundtrip_to = _LF_IN_REPO + _CRLF_IN_REPO
127
127
self.assertNewContentForSetting(wt, 'native',
128
expected_unix, expected_win, 'native' in roundtrip_to)
128
expected_unix, expected_win, 'native' in roundtrip_to)
129
129
self.assertNewContentForSetting(wt, 'lf',
130
expected_unix, expected_unix, 'lf' in roundtrip_to)
130
expected_unix, expected_unix, 'lf' in roundtrip_to)
131
131
self.assertNewContentForSetting(wt, 'crlf',
132
expected_win, expected_win, 'crlf' in roundtrip_to)
132
expected_win, expected_win, 'crlf' in roundtrip_to)
133
133
self.assertNewContentForSetting(wt, 'native-with-crlf-in-repo',
134
expected_unix, expected_win,
135
'native-with-crlf-in-repo' in roundtrip_to)
134
expected_unix, expected_win,
135
'native-with-crlf-in-repo' in roundtrip_to)
136
136
self.assertNewContentForSetting(wt, 'lf-with-crlf-in-repo',
137
expected_unix, expected_unix,
138
'lf-with-crlf-in-repo' in roundtrip_to)
137
expected_unix, expected_unix,
138
'lf-with-crlf-in-repo' in roundtrip_to)
139
139
self.assertNewContentForSetting(wt, 'crlf-with-crlf-in-repo',
140
expected_win, expected_win,
141
'crlf-with-crlf-in-repo' in roundtrip_to)
140
expected_win, expected_win,
141
'crlf-with-crlf-in-repo' in roundtrip_to)
143
143
# Test binary files. These always roundtrip.
145
145
def test_eol_no_rules_binary(self):
146
146
wt, basis = self.prepare_tree(_sample_binary)
147
147
self.assertContent(wt, basis, _sample_binary, _sample_binary,
150
150
def test_eol_exact_binary(self):
151
151
wt, basis = self.prepare_tree(_sample_binary, eol='exact')
152
152
self.assertContent(wt, basis, _sample_binary, _sample_binary,
155
155
def test_eol_native_binary(self):
156
156
wt, basis = self.prepare_tree(_sample_binary, eol='native')
157
157
self.assertContent(wt, basis, _sample_binary, _sample_binary,
160
160
def test_eol_lf_binary(self):
161
161
wt, basis = self.prepare_tree(_sample_binary, eol='lf')
162
162
self.assertContent(wt, basis, _sample_binary, _sample_binary,
165
165
def test_eol_crlf_binary(self):
166
166
wt, basis = self.prepare_tree(_sample_binary, eol='crlf')
167
167
self.assertContent(wt, basis, _sample_binary, _sample_binary,
170
170
def test_eol_native_with_crlf_in_repo_binary(self):
171
171
wt, basis = self.prepare_tree(_sample_binary,
172
eol='native-with-crlf-in-repo')
172
eol='native-with-crlf-in-repo')
173
173
self.assertContent(wt, basis, _sample_binary, _sample_binary,
176
176
def test_eol_lf_with_crlf_in_repo_binary(self):
177
177
wt, basis = self.prepare_tree(_sample_binary,
178
eol='lf-with-crlf-in-repo')
178
eol='lf-with-crlf-in-repo')
179
179
self.assertContent(wt, basis, _sample_binary, _sample_binary,
182
182
def test_eol_crlf_with_crlf_in_repo_binary(self):
183
183
wt, basis = self.prepare_tree(_sample_binary,
184
eol='crlf-with-crlf-in-repo')
184
eol='crlf-with-crlf-in-repo')
185
185
self.assertContent(wt, basis, _sample_binary, _sample_binary,
188
188
# Test text with mixed line endings ("dirty text").
189
189
# This doesn't roundtrip so status always thinks something has changed.
191
191
def test_eol_no_rules_dirty(self):
192
192
wt, basis = self.prepare_tree(_sample_text)
193
193
self.assertContent(wt, basis, _sample_text,
194
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
194
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
196
196
def test_eol_exact_dirty(self):
197
197
wt, basis = self.prepare_tree(_sample_text, eol='exact')
198
198
self.assertContent(wt, basis, _sample_text,
199
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
199
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
201
201
def test_eol_native_dirty(self):
202
202
wt, basis = self.prepare_tree(_sample_text, eol='native')
203
203
self.assertContent(wt, basis, _sample_text_on_unix,
204
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
204
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
206
206
def test_eol_lf_dirty(self):
207
207
wt, basis = self.prepare_tree(_sample_text, eol='lf')
208
208
self.assertContent(wt, basis, _sample_text_on_unix,
209
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
209
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
211
211
def test_eol_crlf_dirty(self):
212
212
wt, basis = self.prepare_tree(_sample_text, eol='crlf')
213
213
self.assertContent(wt, basis, _sample_text_on_unix,
214
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
214
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
216
216
def test_eol_native_with_crlf_in_repo_dirty(self):
217
217
wt, basis = self.prepare_tree(_sample_text,
218
eol='native-with-crlf-in-repo')
218
eol='native-with-crlf-in-repo')
219
219
self.assertContent(wt, basis, _sample_text_on_win,
220
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
220
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
222
222
def test_eol_lf_with_crlf_in_repo_dirty(self):
223
223
wt, basis = self.prepare_tree(_sample_text,
224
eol='lf-with-crlf-in-repo')
224
eol='lf-with-crlf-in-repo')
225
225
self.assertContent(wt, basis, _sample_text_on_win,
226
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
226
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
228
228
def test_eol_crlf_with_crlf_in_repo_dirty(self):
229
229
wt, basis = self.prepare_tree(_sample_text,
230
eol='crlf-with-crlf-in-repo')
230
eol='crlf-with-crlf-in-repo')
231
231
self.assertContent(wt, basis, _sample_text_on_win,
232
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
232
_sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
234
234
# Test text with clean line endings, either always lf or always crlf.
235
235
# This selectively roundtrips (based on what's stored in the repo).
237
237
def test_eol_no_rules_clean_lf(self):
238
238
wt, basis = self.prepare_tree(_sample_clean_lf)
239
239
self.assertContent(wt, basis, _sample_clean_lf,
240
_sample_text_on_unix, _sample_text_on_win,
241
roundtrip_to=_LF_IN_REPO)
240
_sample_text_on_unix, _sample_text_on_win,
241
roundtrip_to=_LF_IN_REPO)
243
243
def test_eol_no_rules_clean_crlf(self):
244
244
wt, basis = self.prepare_tree(_sample_clean_crlf)
245
245
self.assertContent(wt, basis, _sample_clean_crlf,
246
_sample_text_on_unix, _sample_text_on_win,
247
roundtrip_to=_CRLF_IN_REPO)
246
_sample_text_on_unix, _sample_text_on_win,
247
roundtrip_to=_CRLF_IN_REPO)
249
249
def test_eol_exact_clean_lf(self):
250
250
wt, basis = self.prepare_tree(_sample_clean_lf, eol='exact')
251
251
self.assertContent(wt, basis, _sample_clean_lf,
252
_sample_text_on_unix, _sample_text_on_win,
253
roundtrip_to=_LF_IN_REPO)
252
_sample_text_on_unix, _sample_text_on_win,
253
roundtrip_to=_LF_IN_REPO)
255
255
def test_eol_exact_clean_crlf(self):
256
256
wt, basis = self.prepare_tree(_sample_clean_crlf, eol='exact')
257
257
self.assertContent(wt, basis, _sample_clean_crlf,
258
_sample_text_on_unix, _sample_text_on_win,
259
roundtrip_to=_CRLF_IN_REPO)
258
_sample_text_on_unix, _sample_text_on_win,
259
roundtrip_to=_CRLF_IN_REPO)
261
261
def test_eol_native_clean_lf(self):
262
262
wt, basis = self.prepare_tree(_sample_clean_lf, eol='native')
263
263
self.assertContent(wt, basis, _sample_text_on_unix,
264
_sample_text_on_unix, _sample_text_on_win,
265
roundtrip_to=_LF_IN_REPO)
264
_sample_text_on_unix, _sample_text_on_win,
265
roundtrip_to=_LF_IN_REPO)
267
267
def test_eol_native_clean_crlf(self):
268
268
wt, basis = self.prepare_tree(_sample_clean_crlf, eol='native')
269
269
self.assertContent(wt, basis, _sample_text_on_unix,
270
_sample_text_on_unix, _sample_text_on_win,
271
roundtrip_to=_LF_IN_REPO)
270
_sample_text_on_unix, _sample_text_on_win,
271
roundtrip_to=_LF_IN_REPO)
273
273
def test_eol_lf_clean_lf(self):
274
274
wt, basis = self.prepare_tree(_sample_clean_lf, eol='lf')
275
275
self.assertContent(wt, basis, _sample_text_on_unix,
276
_sample_text_on_unix, _sample_text_on_win,
277
roundtrip_to=_LF_IN_REPO)
276
_sample_text_on_unix, _sample_text_on_win,
277
roundtrip_to=_LF_IN_REPO)
279
279
def test_eol_lf_clean_crlf(self):
280
280
wt, basis = self.prepare_tree(_sample_clean_crlf, eol='lf')
281
281
self.assertContent(wt, basis, _sample_text_on_unix,
282
_sample_text_on_unix, _sample_text_on_win,
283
roundtrip_to=_LF_IN_REPO)
282
_sample_text_on_unix, _sample_text_on_win,
283
roundtrip_to=_LF_IN_REPO)
285
285
def test_eol_crlf_clean_lf(self):
286
286
wt, basis = self.prepare_tree(_sample_clean_lf, eol='crlf')
287
287
self.assertContent(wt, basis, _sample_text_on_unix,
288
_sample_text_on_unix, _sample_text_on_win,
289
roundtrip_to=_LF_IN_REPO)
288
_sample_text_on_unix, _sample_text_on_win,
289
roundtrip_to=_LF_IN_REPO)
291
291
def test_eol_crlf_clean_crlf(self):
292
292
wt, basis = self.prepare_tree(_sample_clean_crlf, eol='crlf')
293
293
self.assertContent(wt, basis, _sample_text_on_unix,
294
_sample_text_on_unix, _sample_text_on_win,
295
roundtrip_to=_LF_IN_REPO)
294
_sample_text_on_unix, _sample_text_on_win,
295
roundtrip_to=_LF_IN_REPO)
297
297
def test_eol_native_with_crlf_in_repo_clean_lf(self):
298
298
wt, basis = self.prepare_tree(_sample_clean_lf,
299
eol='native-with-crlf-in-repo')
299
eol='native-with-crlf-in-repo')
300
300
self.assertContent(wt, basis, _sample_text_on_win,
301
_sample_text_on_unix, _sample_text_on_win,
302
roundtrip_to=_CRLF_IN_REPO)
301
_sample_text_on_unix, _sample_text_on_win,
302
roundtrip_to=_CRLF_IN_REPO)
304
304
def test_eol_native_with_crlf_in_repo_clean_crlf(self):
305
305
wt, basis = self.prepare_tree(_sample_clean_crlf,
306
eol='native-with-crlf-in-repo')
306
eol='native-with-crlf-in-repo')
307
307
self.assertContent(wt, basis, _sample_text_on_win,
308
_sample_text_on_unix, _sample_text_on_win,
309
roundtrip_to=_CRLF_IN_REPO)
308
_sample_text_on_unix, _sample_text_on_win,
309
roundtrip_to=_CRLF_IN_REPO)
311
311
def test_eol_lf_with_crlf_in_repo_clean_lf(self):
312
312
wt, basis = self.prepare_tree(_sample_clean_lf,
313
eol='lf-with-crlf-in-repo')
313
eol='lf-with-crlf-in-repo')
314
314
self.assertContent(wt, basis, _sample_text_on_win,
315
_sample_text_on_unix, _sample_text_on_win,
316
roundtrip_to=_CRLF_IN_REPO)
315
_sample_text_on_unix, _sample_text_on_win,
316
roundtrip_to=_CRLF_IN_REPO)
318
318
def test_eol_lf_with_crlf_in_repo_clean_crlf(self):
319
319
wt, basis = self.prepare_tree(_sample_clean_crlf,
320
eol='lf-with-crlf-in-repo')
320
eol='lf-with-crlf-in-repo')
321
321
self.assertContent(wt, basis, _sample_text_on_win,
322
_sample_text_on_unix, _sample_text_on_win,
323
roundtrip_to=_CRLF_IN_REPO)
322
_sample_text_on_unix, _sample_text_on_win,
323
roundtrip_to=_CRLF_IN_REPO)
325
325
def test_eol_crlf_with_crlf_in_repo_clean_lf(self):
326
326
wt, basis = self.prepare_tree(_sample_clean_lf,
327
eol='crlf-with-crlf-in-repo')
327
eol='crlf-with-crlf-in-repo')
328
328
self.assertContent(wt, basis, _sample_text_on_win,
329
_sample_text_on_unix, _sample_text_on_win,
330
roundtrip_to=_CRLF_IN_REPO)
329
_sample_text_on_unix, _sample_text_on_win,
330
roundtrip_to=_CRLF_IN_REPO)
332
332
def test_eol_crlf_with_crlf_in_repo_clean_crlf(self):
333
333
wt, basis = self.prepare_tree(_sample_clean_crlf,
334
eol='crlf-with-crlf-in-repo')
334
eol='crlf-with-crlf-in-repo')
335
335
self.assertContent(wt, basis, _sample_text_on_win,
336
_sample_text_on_unix, _sample_text_on_win,
337
roundtrip_to=_CRLF_IN_REPO)
336
_sample_text_on_unix, _sample_text_on_win,
337
roundtrip_to=_CRLF_IN_REPO)