/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
1
# Copyright (C) 2006, 2007, 2009-2012, 2016 Canonical Ltd
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
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
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
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
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
16
#
17
6622.1.29 by Jelmer Vernooij
Fix some more tests.
18
"""Tests of the 'brz add' command."""
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
19
20
import os
21
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
22
from breezy import (
5012.1.1 by Vincent Ladeuil
Fix imports in blackbox/test_add.py.
23
    osutils,
24
    tests,
4163.2.2 by Ian Clatworthy
use multiply_tests rather than subclassing
25
    )
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
26
from breezy.tests import (
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
27
    features,
5346.3.1 by Martin Pool
* `PathNotChild` should not give a traceback.
28
    script,
29
    )
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
30
from breezy.tests.scenarios import load_tests_apply_scenarios
5559.2.2 by Martin Pool
Change to using standard load_tests_apply_scenarios.
31
32
33
load_tests = load_tests_apply_scenarios
34
35
36
class TestAdd(tests.TestCaseWithTransport):
37
4163.2.2 by Ian Clatworthy
use multiply_tests rather than subclassing
38
    scenarios = [
39
        ('pre-views', {'branch_tree_format': 'pack-0.92'}),
5546.1.1 by Andrew Bennetts
Remove RepositoryFormatCHK1 and RepositoryFormatCHK2.
40
        ('view-aware', {'branch_tree_format': '2a'}),
4163.2.2 by Ian Clatworthy
use multiply_tests rather than subclassing
41
        ]
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
42
4163.2.1 by Ian Clatworthy
Fix add in trees supports views
43
    def make_branch_and_tree(self, dir):
5012.1.1 by Vincent Ladeuil
Fix imports in blackbox/test_add.py.
44
        return super(TestAdd, self).make_branch_and_tree(
45
            dir, format=self.branch_tree_format)
4163.2.1 by Ian Clatworthy
Fix add in trees supports views
46
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
47
    def test_add_reports(self):
48
        """add command prints the names of added files."""
2664.3.1 by Daniel Watkins
tests.blackbox.test_add now uses internals where appropriate.
49
        tree = self.make_branch_and_tree('.')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
50
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
6855.4.1 by Jelmer Vernooij
Yet more bees.
51
        self.build_tree_contents([('.bzrignore', b'CVS\n')])
2581.1.2 by Martin Pool
Remove unnecessary retcode=0 to run_bzr calls
52
        out = self.run_bzr('add')[0]
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
53
        # the ordering is not defined at the moment
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
54
        results = sorted(out.rstrip('\n').split('\n'))
55
        self.assertEqual(['adding .bzrignore',
56
                          'adding dir',
57
                          'adding dir/sub.txt',
58
                          'adding top.txt'],
7143.15.2 by Jelmer Vernooij
Run autopep8.
59
                         results)
2581.1.2 by Martin Pool
Remove unnecessary retcode=0 to run_bzr calls
60
        out = self.run_bzr('add -v')[0]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
61
        results = sorted(out.rstrip('\n').split('\n'))
62
        self.assertEqual(['ignored CVS matching "CVS"'],
7143.15.2 by Jelmer Vernooij
Run autopep8.
63
                         results)
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
64
65
    def test_add_quiet_is(self):
66
        """add -q does not print the names of added files."""
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
67
        tree = self.make_branch_and_tree('.')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
68
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
2581.1.2 by Martin Pool
Remove unnecessary retcode=0 to run_bzr calls
69
        out = self.run_bzr('add -q')[0]
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
70
        # the ordering is not defined at the moment
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
71
        results = sorted(out.rstrip('\n').split('\n'))
72
        self.assertEqual([''], results)
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
73
74
    def test_add_in_unversioned(self):
75
        """Try to add a file in an unversioned directory.
76
6622.1.29 by Jelmer Vernooij
Fix some more tests.
77
        "brz add" should add the parent(s) as necessary.
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
78
        """
2664.3.1 by Daniel Watkins
tests.blackbox.test_add now uses internals where appropriate.
79
        tree = self.make_branch_and_tree('.')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
80
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
81
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
82
        self.run_bzr('add inertiatic/esp')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
83
        self.assertEqual(self.run_bzr('unknowns')[0], '')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
84
85
        # Multiple unversioned parents
86
        self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
87
        self.assertEqual(self.run_bzr('unknowns')[0], 'veil\n')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
88
        self.run_bzr('add veil/cerpin/taxt')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
89
        self.assertEqual(self.run_bzr('unknowns')[0], '')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
90
91
        # Check whacky paths work
92
        self.build_tree(['cicatriz/', 'cicatriz/esp'])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
93
        self.assertEqual(self.run_bzr('unknowns')[0], 'cicatriz\n')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
94
        self.run_bzr('add inertiatic/../cicatriz/esp')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
95
        self.assertEqual(self.run_bzr('unknowns')[0], '')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
96
6478.1.1 by Jelmer Vernooij
Add short option '-N' for '--no-recurse'.
97
    def test_add_no_recurse(self):
98
        tree = self.make_branch_and_tree('.')
99
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
100
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
6478.1.1 by Jelmer Vernooij
Add short option '-N' for '--no-recurse'.
101
        self.run_bzr('add -N inertiatic')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
102
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
6478.1.1 by Jelmer Vernooij
Add short option '-N' for '--no-recurse'.
103
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
104
    def test_add_in_versioned(self):
105
        """Try to add a file in a versioned directory.
106
6622.1.29 by Jelmer Vernooij
Fix some more tests.
107
        "brz add" should do this happily.
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
108
        """
2664.3.1 by Daniel Watkins
tests.blackbox.test_add now uses internals where appropriate.
109
        tree = self.make_branch_and_tree('.')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
110
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
111
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
112
        self.run_bzr('add --no-recurse inertiatic')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
113
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
114
        self.run_bzr('add inertiatic/esp')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
115
        self.assertEqual(self.run_bzr('unknowns')[0], '')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
116
117
    def test_subdir_add(self):
118
        """Add in subdirectory should add only things from there down"""
119
        eq = self.assertEqual
1836.1.16 by John Arbash Meinel
Cleanup some tests which don't expect .bazaar/ to show up. Some still fail.
120
        ass = self.assertTrue
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
121
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
122
        t = self.make_branch_and_tree('.')
123
        b = t.branch
124
        self.build_tree(['src/', 'README'])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
125
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
126
        eq(sorted(t.unknowns()),
127
           ['README', 'src'])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
128
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
129
        self.run_bzr('add src')
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
130
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
131
        self.build_tree(['src/foo.c'])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
132
2255.2.171 by Martin Pool
Fix up blackbox test_add to avoid depending on inventory not being held in memory
133
        # add with no arguments in a subdirectory gets only files below that
134
        # subdirectory
5012.1.1 by Vincent Ladeuil
Fix imports in blackbox/test_add.py.
135
        self.run_bzr('add', working_dir='src')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
136
        self.assertEqual('README\n',
7143.15.2 by Jelmer Vernooij
Run autopep8.
137
                         self.run_bzr('unknowns', working_dir='src')[0])
2255.2.176 by Martin Pool
Merge dirstate and some small cleanups
138
        # reopen to see the new changes
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
139
        t = t.controldir.open_workingtree('src')
2255.2.171 by Martin Pool
Fix up blackbox test_add to avoid depending on inventory not being held in memory
140
        versioned = [path for path, entry in t.iter_entries_by_dir()]
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
141
        self.assertEqual(versioned, ['', 'src', 'src/foo.c'])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
142
2255.2.171 by Martin Pool
Fix up blackbox test_add to avoid depending on inventory not being held in memory
143
        # add from the parent directory should pick up all file names
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
144
        self.run_bzr('add')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
145
        self.assertEqual(self.run_bzr('unknowns')[0], '')
1711.1.3 by Robert Collins
Add new test_add file - should have been in last commit.
146
        self.run_bzr('check')
1757.2.1 by Robert Collins
Add an explicit test that adding a missing file barfs.
147
148
    def test_add_missing(self):
6622.1.29 by Jelmer Vernooij
Fix some more tests.
149
        """brz add foo where foo is missing should error."""
1757.2.1 by Robert Collins
Add an explicit test that adding a missing file barfs.
150
        self.make_branch_and_tree('.')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
151
        self.run_bzr('add missing-file', retcode=3)
1911.3.2 by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree
152
153
    def test_add_from(self):
154
        base_tree = self.make_branch_and_tree('base')
155
        self.build_tree(['base/a', 'base/b/', 'base/b/c'])
156
        base_tree.add(['a', 'b', 'b/c'])
157
        base_tree.commit('foo')
158
159
        new_tree = self.make_branch_and_tree('new')
160
        self.build_tree(['new/a', 'new/b/', 'new/b/c', 'd'])
161
6423.1.1 by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened.
162
        out, err = self.run_bzr('add --file-ids-from ../base',
163
                                working_dir='new')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
164
        self.assertEqual('', err)
165
        self.assertEqualDiff('adding a w/ file id from a\n'
166
                             'adding b w/ file id from b\n'
167
                             'adding b/c w/ file id from b/c\n',
1911.3.2 by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree
168
                             out)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
169
        new_tree = new_tree.controldir.open_workingtree()
1911.3.2 by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree
170
        self.assertEqual(base_tree.path2id('a'), new_tree.path2id('a'))
171
        self.assertEqual(base_tree.path2id('b'), new_tree.path2id('b'))
172
        self.assertEqual(base_tree.path2id('b/c'), new_tree.path2id('b/c'))
173
174
    def test_add_from_subdir(self):
175
        base_tree = self.make_branch_and_tree('base')
176
        self.build_tree(['base/a', 'base/b/', 'base/b/c', 'base/b/d'])
177
        base_tree.add(['a', 'b', 'b/c', 'b/d'])
178
        base_tree.commit('foo')
179
180
        new_tree = self.make_branch_and_tree('new')
181
        self.build_tree(['new/c', 'new/d'])
182
6423.1.1 by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened.
183
        out, err = self.run_bzr('add --file-ids-from ../base/b',
184
                                working_dir='new')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
185
        self.assertEqual('', err)
186
        self.assertEqualDiff('adding c w/ file id from b/c\n'
187
                             'adding d w/ file id from b/d\n',
1911.3.2 by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree
188
                             out)
189
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
190
        new_tree = new_tree.controldir.open_workingtree('new')
1911.3.2 by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree
191
        self.assertEqual(base_tree.path2id('b/c'), new_tree.path2id('c'))
192
        self.assertEqual(base_tree.path2id('b/d'), new_tree.path2id('d'))
1928.1.1 by Alexander Belchenko
blackbox test for 'bzr add --dry-run'
193
194
    def test_add_dry_run(self):
2568.2.4 by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now
195
        """Test a dry run add, make sure nothing is added."""
196
        wt = self.make_branch_and_tree('.')
197
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
198
        self.assertEqual(list(wt.unknowns()), ['inertiatic'])
199
        self.run_bzr('add --dry-run')
200
        self.assertEqual(list(wt.unknowns()), ['inertiatic'])
2279.5.1 by Matthias Rahlf
FastPath objects can now be printed nicely
201
202
    def test_add_control_dir(self):
203
        """The control dir and its content should be refused."""
2279.6.1 by Alexander Belchenko
Instead of __str__ method for FastPath object we use .raw_path attribute (note from Aaron).
204
        self.make_branch_and_tree('.')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
205
        err = self.run_bzr('add .bzr', retcode=3)[1]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
206
        self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
207
        err = self.run_bzr('add .bzr/README', retcode=3)[1]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
208
        self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
2279.5.1 by Matthias Rahlf
FastPath objects can now be printed nicely
209
        self.build_tree(['.bzr/crescent'])
2530.3.3 by Martin Pool
Clean up some callers that use varargs syntax for run_bzr, but don't
210
        err = self.run_bzr('add .bzr/crescent', retcode=3)[1]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
211
        self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
2617.5.3 by Kuno Meyer
Blackbox test for adding with wildcards (Win32).
212
4301.1.1 by Geoff Bache
Fixing bug 183831, where 'bzr add' fails with a python stack if the path contains a symbolic link
213
    def test_add_via_symlink(self):
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
214
        self.requireFeature(features.SymlinkFeature)
4301.1.1 by Geoff Bache
Fixing bug 183831, where 'bzr add' fails with a python stack if the path contains a symbolic link
215
        self.make_branch_and_tree('source')
216
        self.build_tree(['source/top.txt'])
217
        os.symlink('source', 'link')
218
        out = self.run_bzr(['add', 'link/top.txt'])[0]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
219
        self.assertEqual(out, 'adding top.txt\n')
4301.1.1 by Geoff Bache
Fixing bug 183831, where 'bzr add' fails with a python stack if the path contains a symbolic link
220
221
    def test_add_symlink_to_abspath(self):
5967.12.1 by Martin Pool
Move all test features into bzrlib.tests.features
222
        self.requireFeature(features.SymlinkFeature)
4301.2.4 by Aaron Bentley
Further cleanups
223
        self.make_branch_and_tree('tree')
224
        os.symlink(osutils.abspath('target'), 'tree/link')
225
        out = self.run_bzr(['add', 'tree/link'])[0]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
226
        self.assertEqual(out, 'adding link\n')
4634.169.1 by Martin
Don't use normalizepath in smart_add unless symlinks are supported which avoids unicode breakage on windows
227
5346.3.1 by Martin Pool
* `PathNotChild` should not give a traceback.
228
    def test_add_not_child(self):
229
        # https://bugs.launchpad.net/bzr/+bug/98735
230
        sr = script.ScriptRunner()
231
        self.make_branch_and_tree('tree1')
232
        self.make_branch_and_tree('tree2')
233
        self.build_tree(['tree1/a', 'tree2/b'])
234
        sr.run_script(self, '''
6622.1.29 by Jelmer Vernooij
Fix some more tests.
235
        $ brz add tree1/a tree2/b
236
        2>brz: ERROR: Path "...tree2/b" is not a child of path "...tree1"
5346.3.1 by Martin Pool
* `PathNotChild` should not give a traceback.
237
        ''')
5573.1.1 by Martin
Merge 2.2 for fixes to lp:686611 and lp:687653
238
4634.169.1 by Martin
Don't use normalizepath in smart_add unless symlinks are supported which avoids unicode breakage on windows
239
    def test_add_multiple_files_in_unicode_cwd(self):
240
        """Adding multiple files in a non-ascii cwd, see lp:686611"""
5967.12.3 by Martin Pool
Unify duplicated UnicodeFilename and _PosixPermissionsFeature
241
        self.requireFeature(features.UnicodeFilenameFeature)
4634.169.1 by Martin
Don't use normalizepath in smart_add unless symlinks are supported which avoids unicode breakage on windows
242
        self.make_branch_and_tree(u"\xA7")
243
        self.build_tree([u"\xA7/a", u"\xA7/b"])
244
        out, err = self.run_bzr(["add", "a", "b"], working_dir=u"\xA7")
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
245
        self.assertEqual(out, "adding a\n" "adding b\n")
246
        self.assertEqual(err, "")
6421.3.1 by Vincent Ladeuil
Migrate more branch options to config stacks.
247
6046.2.1 by Shannon Weyrick
Add support for skipping large files during add, based on configurable threshold (default 1M). Fixes bug #54624
248
    def test_add_skip_large_files(self):
6046.2.4 by Shannon Weyrick
Change AddAction interface to include a method for deciding whether to
249
        """Test skipping files larger than add.maximum_file_size"""
6046.2.1 by Shannon Weyrick
Add support for skipping large files during add, based on configurable threshold (default 1M). Fixes bug #54624
250
        tree = self.make_branch_and_tree('.')
6046.2.9 by Shannon Weyrick
Make it explicit in docs that large file skips happen only in recursive mode. Add test.
251
        self.build_tree(['small.txt', 'big.txt', 'big2.txt'])
6855.4.1 by Jelmer Vernooij
Yet more bees.
252
        self.build_tree_contents([('small.txt', b'0\n')])
253
        self.build_tree_contents([('big.txt', b'01234567890123456789\n')])
254
        self.build_tree_contents([('big2.txt', b'01234567890123456789\n')])
6449.6.1 by Jelmer Vernooij
Use config stacks in a few more places in the test suite.
255
        tree.branch.get_config_stack().set('add.maximum_file_size', 5)
6046.2.1 by Shannon Weyrick
Add support for skipping large files during add, based on configurable threshold (default 1M). Fixes bug #54624
256
        out = self.run_bzr('add')[0]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
257
        results = sorted(out.rstrip('\n').split('\n'))
258
        self.assertEqual(['adding small.txt'], results)
6046.2.9 by Shannon Weyrick
Make it explicit in docs that large file skips happen only in recursive mode. Add test.
259
        # named items never skipped, even if over max
260
        out, err = self.run_bzr(["add", "big2.txt"])
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
261
        results = sorted(out.rstrip('\n').split('\n'))
262
        self.assertEqual(['adding big2.txt'], results)
263
        self.assertEqual("", err)
6404.6.7 by Vincent Ladeuil
Change set/remove to require a lock for the branch config files.
264
        tree.branch.get_config_stack().set('add.maximum_file_size', 30)
6046.2.1 by Shannon Weyrick
Add support for skipping large files during add, based on configurable threshold (default 1M). Fixes bug #54624
265
        out = self.run_bzr('add')[0]
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
266
        results = sorted(out.rstrip('\n').split('\n'))
267
        self.assertEqual(['adding big.txt'], results)
7121.2.1 by Jelmer Vernooij
Support adding/removing files with a name that consists of just
268
269
    def test_add_backslash(self):
270
        # pad.lv/165151
271
        if os.path.sep == '\\':
272
            # TODO(jelmer): Test that backslashes are appropriately
273
            # ignored?
274
            raise tests.TestNotApplicable(
275
                'unable to add filenames with backslashes where '
276
                ' it is the path separator')
277
        tree = self.make_branch_and_tree('.')
278
        self.build_tree(['\\'])
279
        self.assertEqual('adding \\\n', self.run_bzr('add \\\\')[0])
280
        self.assertEqual('\\\n', self.run_bzr('ls --versioned')[0])