/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
4232.1.1 by Ian Clatworthy
Integrated EOL conversion support (Ian Clatworthy)
1
# Copyright (C) 2009 Canonical Ltd
4208.4.1 by Ian Clatworthy
eol conversion support
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
4232.1.1 by Ian Clatworthy
Integrated EOL conversion support (Ian Clatworthy)
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
4208.4.1 by Ian Clatworthy
eol conversion support
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4232.1.1 by Ian Clatworthy
Integrated EOL conversion support (Ian Clatworthy)
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
4208.4.1 by Ian Clatworthy
eol conversion support
17
"""Tests for eol conversion."""
18
7479.2.1 by Jelmer Vernooij
Drop python2 support.
19
from io import BytesIO
4208.4.1 by Ian Clatworthy
eol conversion support
20
import sys
21
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
22
from ... import rules, status
23
from .. import TestSkipped
24
from . import TestCaseWithWorkingTree
25
from ...workingtree import WorkingTree
4208.4.1 by Ian Clatworthy
eol conversion support
26
27
28
# Sample files
7143.15.2 by Jelmer Vernooij
Run autopep8.
29
_sample_text = b"""hello\nworld\r\n"""
30
_sample_text_on_win = b"""hello\r\nworld\r\n"""
6855.4.1 by Jelmer Vernooij
Yet more bees.
31
_sample_text_on_unix = b"""hello\nworld\n"""
7143.15.2 by Jelmer Vernooij
Run autopep8.
32
_sample_binary = b"""hello\nworld\r\n\x00"""
33
_sample_clean_lf = _sample_text_on_unix
34
_sample_clean_crlf = _sample_text_on_win
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
35
36
37
# Lists of formats for each storage policy
38
_LF_IN_REPO = ['native', 'lf', 'crlf']
7143.15.2 by Jelmer Vernooij
Run autopep8.
39
_CRLF_IN_REPO = ['%s-with-crlf-in-repo' % (f,) for f in _LF_IN_REPO]
4208.4.1 by Ian Clatworthy
eol conversion support
40
41
42
class TestEolConversion(TestCaseWithWorkingTree):
43
44
    def setUp(self):
45
        # formats that don't support content filtering can skip these tests
46
        fmt = self.workingtree_format
47
        f = getattr(fmt, 'supports_content_filtering')
48
        if f is None:
49
            raise TestSkipped("format %s doesn't declare whether it "
7143.15.2 by Jelmer Vernooij
Run autopep8.
50
                              "supports content filtering, assuming not" % fmt)
4208.4.1 by Ian Clatworthy
eol conversion support
51
        if not f():
52
            raise TestSkipped("format %s doesn't support content filtering"
7143.15.2 by Jelmer Vernooij
Run autopep8.
53
                              % fmt)
6552.1.4 by Vincent Ladeuil
Remaining tests matching setup(self) that can be rewritten with super().
54
        super(TestEolConversion, self).setUp()
4208.4.1 by Ian Clatworthy
eol conversion support
55
56
    def patch_rules_searcher(self, eol):
57
        """Patch in a custom rules searcher with a given eol setting."""
58
        if eol is None:
59
            WorkingTree._get_rules_searcher = self.real_rules_searcher
60
        else:
61
            def custom_eol_rules_searcher(tree, default_searcher):
62
                return rules._IniBasedRulesSearcher([
63
                    '[name *]\n',
64
                    'eol=%s\n' % eol,
65
                    ])
66
            WorkingTree._get_rules_searcher = custom_eol_rules_searcher
67
68
    def prepare_tree(self, content, eol=None):
69
        """Prepare a working tree and commit some content."""
4985.1.5 by Vincent Ladeuil
Deploying the new overrideAttr facility further reduces the complexity
70
        self.real_rules_searcher = self.overrideAttr(
71
            WorkingTree, '_get_rules_searcher')
4208.4.1 by Ian Clatworthy
eol conversion support
72
        self.patch_rules_searcher(eol)
73
        t = self.make_branch_and_tree('tree1')
74
        self.build_tree_contents([('tree1/file1', content)])
7464.4.1 by Jelmer Vernooij
Add VersionedFiles.add_content.
75
        t.add('file1')
4208.4.1 by Ian Clatworthy
eol conversion support
76
        t.commit("add file1")
77
        basis = t.basis_tree()
78
        basis.lock_read()
79
        self.addCleanup(basis.unlock)
80
        return t, basis
81
4208.4.5 by Ian Clatworthy
add lf-always and crlf-always
82
    def assertNewContentForSetting(self, wt, eol, expected_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
83
                                   expected_win, roundtrip):
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
84
        """Clone a working tree and check the convenience content.
7143.15.2 by Jelmer Vernooij
Run autopep8.
85
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
86
        If roundtrip is True, status and commit should see no changes.
87
        """
4208.4.5 by Ian Clatworthy
add lf-always and crlf-always
88
        if expected_win is None:
89
            expected_win = expected_unix
4208.4.1 by Ian Clatworthy
eol conversion support
90
        self.patch_rules_searcher(eol)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
91
        wt2 = wt.controldir.sprout('tree-%s' % eol).open_workingtree()
4208.4.1 by Ian Clatworthy
eol conversion support
92
        # To see exactly what got written to disk, we need an unfiltered read
7464.4.1 by Jelmer Vernooij
Add VersionedFiles.add_content.
93
        with wt2.get_file('file1', filtered=False) as f:
94
            content = f.read()
4208.4.1 by Ian Clatworthy
eol conversion support
95
        if sys.platform == 'win32':
4208.4.3 by Ian Clatworthy
rename dos to windows
96
            self.assertEqual(expected_win, content)
4208.4.1 by Ian Clatworthy
eol conversion support
97
        else:
98
            self.assertEqual(expected_unix, content)
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
99
        # Confirm that status thinks nothing has changed if the text roundtrips
100
        if roundtrip:
6621.22.2 by Martin
Use BytesIO or StringIO from bzrlib.sixish
101
            status_io = BytesIO()
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
102
            status.show_tree_status(wt2, to_file=status_io)
6973.10.1 by Jelmer Vernooij
Fix some tests.
103
            self.assertEqual(b'', status_io.getvalue())
4208.4.1 by Ian Clatworthy
eol conversion support
104
105
    def assertContent(self, wt, basis, expected_raw, expected_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
106
                      expected_win, roundtrip_to=None):
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
107
        """Check the committed content and content in cloned trees.
7143.15.2 by Jelmer Vernooij
Run autopep8.
108
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
109
        :param roundtrip_to: the set of formats (excluding exact) we
110
          can round-trip to or None for all
111
        """
7464.4.1 by Jelmer Vernooij
Add VersionedFiles.add_content.
112
        with basis.get_file('file1') as f:
113
            basis_content = f.read()
4208.4.1 by Ian Clatworthy
eol conversion support
114
        self.assertEqual(expected_raw, basis_content)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
115
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
116
        # No setting and exact should always roundtrip
117
        self.assertNewContentForSetting(wt, None,
7143.15.2 by Jelmer Vernooij
Run autopep8.
118
                                        expected_raw, expected_raw, roundtrip=True)
4393.3.3 by Ian Clatworthy
add round-trip checking to eol tests
119
        self.assertNewContentForSetting(wt, 'exact',
7143.15.2 by Jelmer Vernooij
Run autopep8.
120
                                        expected_raw, expected_raw, roundtrip=True)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
121
122
        # Roundtripping is otherwise dependent on whether the original
123
        # text is clean - mixed line endings will prevent it. It also
124
        # depends on whether the format in the repository is being changed.
125
        if roundtrip_to is None:
126
            roundtrip_to = _LF_IN_REPO + _CRLF_IN_REPO
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
127
        self.assertNewContentForSetting(wt, 'native',
7143.15.2 by Jelmer Vernooij
Run autopep8.
128
                                        expected_unix, expected_win, 'native' in roundtrip_to)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
129
        self.assertNewContentForSetting(wt, 'lf',
7143.15.2 by Jelmer Vernooij
Run autopep8.
130
                                        expected_unix, expected_unix, 'lf' in roundtrip_to)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
131
        self.assertNewContentForSetting(wt, 'crlf',
7143.15.2 by Jelmer Vernooij
Run autopep8.
132
                                        expected_win, expected_win, 'crlf' in roundtrip_to)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
133
        self.assertNewContentForSetting(wt, 'native-with-crlf-in-repo',
7143.15.2 by Jelmer Vernooij
Run autopep8.
134
                                        expected_unix, expected_win,
135
                                        'native-with-crlf-in-repo' in roundtrip_to)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
136
        self.assertNewContentForSetting(wt, 'lf-with-crlf-in-repo',
7143.15.2 by Jelmer Vernooij
Run autopep8.
137
                                        expected_unix, expected_unix,
138
                                        'lf-with-crlf-in-repo' in roundtrip_to)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
139
        self.assertNewContentForSetting(wt, 'crlf-with-crlf-in-repo',
7143.15.2 by Jelmer Vernooij
Run autopep8.
140
                                        expected_win, expected_win,
141
                                        'crlf-with-crlf-in-repo' in roundtrip_to)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
142
143
    # Test binary files. These always roundtrip.
144
145
    def test_eol_no_rules_binary(self):
146
        wt, basis = self.prepare_tree(_sample_binary)
147
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
148
                           _sample_binary)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
149
150
    def test_eol_exact_binary(self):
151
        wt, basis = self.prepare_tree(_sample_binary, eol='exact')
152
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
153
                           _sample_binary)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
154
155
    def test_eol_native_binary(self):
156
        wt, basis = self.prepare_tree(_sample_binary, eol='native')
157
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
158
                           _sample_binary)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
159
4208.4.4 by Ian Clatworthy
unix/window -> cr/crlf based on mailing list feedback
160
    def test_eol_lf_binary(self):
161
        wt, basis = self.prepare_tree(_sample_binary, eol='lf')
4208.4.3 by Ian Clatworthy
rename dos to windows
162
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
163
                           _sample_binary)
4208.4.3 by Ian Clatworthy
rename dos to windows
164
4208.4.4 by Ian Clatworthy
unix/window -> cr/crlf based on mailing list feedback
165
    def test_eol_crlf_binary(self):
166
        wt, basis = self.prepare_tree(_sample_binary, eol='crlf')
4208.4.3 by Ian Clatworthy
rename dos to windows
167
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
168
                           _sample_binary)
4208.4.1 by Ian Clatworthy
eol conversion support
169
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
170
    def test_eol_native_with_crlf_in_repo_binary(self):
171
        wt, basis = self.prepare_tree(_sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
172
                                      eol='native-with-crlf-in-repo')
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
173
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
174
                           _sample_binary)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
175
176
    def test_eol_lf_with_crlf_in_repo_binary(self):
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
177
        wt, basis = self.prepare_tree(_sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
178
                                      eol='lf-with-crlf-in-repo')
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
179
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
180
                           _sample_binary)
4208.4.7 by Ian Clatworthy
tweak eol names based on mailing list discussion
181
182
    def test_eol_crlf_with_crlf_in_repo_binary(self):
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
183
        wt, basis = self.prepare_tree(_sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
184
                                      eol='crlf-with-crlf-in-repo')
4208.4.5 by Ian Clatworthy
add lf-always and crlf-always
185
        self.assertContent(wt, basis, _sample_binary, _sample_binary,
7143.15.2 by Jelmer Vernooij
Run autopep8.
186
                           _sample_binary)
4208.4.5 by Ian Clatworthy
add lf-always and crlf-always
187
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
188
    # Test text with mixed line endings ("dirty text").
189
    # This doesn't roundtrip so status always thinks something has changed.
190
191
    def test_eol_no_rules_dirty(self):
192
        wt, basis = self.prepare_tree(_sample_text)
193
        self.assertContent(wt, basis, _sample_text,
7143.15.2 by Jelmer Vernooij
Run autopep8.
194
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
195
196
    def test_eol_exact_dirty(self):
4208.4.3 by Ian Clatworthy
rename dos to windows
197
        wt, basis = self.prepare_tree(_sample_text, eol='exact')
198
        self.assertContent(wt, basis, _sample_text,
7143.15.2 by Jelmer Vernooij
Run autopep8.
199
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
200
201
    def test_eol_native_dirty(self):
202
        wt, basis = self.prepare_tree(_sample_text, eol='native')
203
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
204
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
205
206
    def test_eol_lf_dirty(self):
207
        wt, basis = self.prepare_tree(_sample_text, eol='lf')
208
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
209
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
210
211
    def test_eol_crlf_dirty(self):
212
        wt, basis = self.prepare_tree(_sample_text, eol='crlf')
213
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
214
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
215
216
    def test_eol_native_with_crlf_in_repo_dirty(self):
217
        wt, basis = self.prepare_tree(_sample_text,
7143.15.2 by Jelmer Vernooij
Run autopep8.
218
                                      eol='native-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
219
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
220
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
221
222
    def test_eol_lf_with_crlf_in_repo_dirty(self):
223
        wt, basis = self.prepare_tree(_sample_text,
7143.15.2 by Jelmer Vernooij
Run autopep8.
224
                                      eol='lf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
225
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
226
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
227
228
    def test_eol_crlf_with_crlf_in_repo_dirty(self):
229
        wt, basis = self.prepare_tree(_sample_text,
7143.15.2 by Jelmer Vernooij
Run autopep8.
230
                                      eol='crlf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
231
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
232
                           _sample_text_on_unix, _sample_text_on_win, roundtrip_to=[])
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
233
234
    # Test text with clean line endings, either always lf or always crlf.
235
    # This selectively roundtrips (based on what's stored in the repo).
236
237
    def test_eol_no_rules_clean_lf(self):
238
        wt, basis = self.prepare_tree(_sample_clean_lf)
239
        self.assertContent(wt, basis, _sample_clean_lf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
240
                           _sample_text_on_unix, _sample_text_on_win,
241
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
242
243
    def test_eol_no_rules_clean_crlf(self):
244
        wt, basis = self.prepare_tree(_sample_clean_crlf)
245
        self.assertContent(wt, basis, _sample_clean_crlf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
246
                           _sample_text_on_unix, _sample_text_on_win,
247
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
248
249
    def test_eol_exact_clean_lf(self):
250
        wt, basis = self.prepare_tree(_sample_clean_lf, eol='exact')
251
        self.assertContent(wt, basis, _sample_clean_lf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
252
                           _sample_text_on_unix, _sample_text_on_win,
253
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
254
255
    def test_eol_exact_clean_crlf(self):
256
        wt, basis = self.prepare_tree(_sample_clean_crlf, eol='exact')
257
        self.assertContent(wt, basis, _sample_clean_crlf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
258
                           _sample_text_on_unix, _sample_text_on_win,
259
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
260
261
    def test_eol_native_clean_lf(self):
262
        wt, basis = self.prepare_tree(_sample_clean_lf, eol='native')
263
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
264
                           _sample_text_on_unix, _sample_text_on_win,
265
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
266
267
    def test_eol_native_clean_crlf(self):
268
        wt, basis = self.prepare_tree(_sample_clean_crlf, eol='native')
269
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
270
                           _sample_text_on_unix, _sample_text_on_win,
271
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
272
273
    def test_eol_lf_clean_lf(self):
274
        wt, basis = self.prepare_tree(_sample_clean_lf, eol='lf')
275
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
276
                           _sample_text_on_unix, _sample_text_on_win,
277
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
278
279
    def test_eol_lf_clean_crlf(self):
280
        wt, basis = self.prepare_tree(_sample_clean_crlf, eol='lf')
281
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
282
                           _sample_text_on_unix, _sample_text_on_win,
283
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
284
285
    def test_eol_crlf_clean_lf(self):
286
        wt, basis = self.prepare_tree(_sample_clean_lf, eol='crlf')
287
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
288
                           _sample_text_on_unix, _sample_text_on_win,
289
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
290
291
    def test_eol_crlf_clean_crlf(self):
292
        wt, basis = self.prepare_tree(_sample_clean_crlf, eol='crlf')
293
        self.assertContent(wt, basis, _sample_text_on_unix,
7143.15.2 by Jelmer Vernooij
Run autopep8.
294
                           _sample_text_on_unix, _sample_text_on_win,
295
                           roundtrip_to=_LF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
296
297
    def test_eol_native_with_crlf_in_repo_clean_lf(self):
298
        wt, basis = self.prepare_tree(_sample_clean_lf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
299
                                      eol='native-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
300
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
301
                           _sample_text_on_unix, _sample_text_on_win,
302
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
303
304
    def test_eol_native_with_crlf_in_repo_clean_crlf(self):
305
        wt, basis = self.prepare_tree(_sample_clean_crlf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
306
                                      eol='native-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
307
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
308
                           _sample_text_on_unix, _sample_text_on_win,
309
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
310
311
    def test_eol_lf_with_crlf_in_repo_clean_lf(self):
312
        wt, basis = self.prepare_tree(_sample_clean_lf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
313
                                      eol='lf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
314
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
315
                           _sample_text_on_unix, _sample_text_on_win,
316
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
317
318
    def test_eol_lf_with_crlf_in_repo_clean_crlf(self):
319
        wt, basis = self.prepare_tree(_sample_clean_crlf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
320
                                      eol='lf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
321
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
322
                           _sample_text_on_unix, _sample_text_on_win,
323
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
324
325
    def test_eol_crlf_with_crlf_in_repo_clean_lf(self):
326
        wt, basis = self.prepare_tree(_sample_clean_lf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
327
                                      eol='crlf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
328
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
329
                           _sample_text_on_unix, _sample_text_on_win,
330
                           roundtrip_to=_CRLF_IN_REPO)
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
331
332
    def test_eol_crlf_with_crlf_in_repo_clean_crlf(self):
333
        wt, basis = self.prepare_tree(_sample_clean_crlf,
7143.15.2 by Jelmer Vernooij
Run autopep8.
334
                                      eol='crlf-with-crlf-in-repo')
4393.3.4 by Ian Clatworthy
add eol roundtripping tests
335
        self.assertContent(wt, basis, _sample_text_on_win,
7143.15.2 by Jelmer Vernooij
Run autopep8.
336
                           _sample_text_on_unix, _sample_text_on_win,
337
                           roundtrip_to=_CRLF_IN_REPO)