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. |
1 |
# Copyright (C) 2006, 2007, 2009-2012 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 |
||
18 |
"""Tests of the 'bzr add' command."""
|
|
19 |
||
20 |
import os |
|
21 |
||
5012.1.1
by Vincent Ladeuil
Fix imports in blackbox/test_add.py. |
22 |
from bzrlib import ( |
23 |
osutils, |
|
24 |
tests, |
|
4163.2.2
by Ian Clatworthy
use multiply_tests rather than subclassing |
25 |
)
|
5346.3.1
by Martin Pool
* `PathNotChild` should not give a traceback. |
26 |
from bzrlib.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 |
)
|
|
5559.2.2
by Martin Pool
Change to using standard load_tests_apply_scenarios. |
30 |
from bzrlib.tests.scenarios import 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']) |
1765.1.1
by Robert Collins
Remove the default ignores list from bzr, lowering the minimum overhead in bzr add. |
51 |
self.build_tree_contents([('.bzrignore', '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
|
54 |
results = sorted(out.rstrip('\n').split('\n')) |
|
4595.1.1
by Jason Spashett
Further tweaks to bzr add |
55 |
self.assertEquals(['adding .bzrignore', |
3985.2.1
by Daniel Watkins
Updated tests for new behaviour. |
56 |
'adding dir', |
57 |
'adding dir/sub.txt', |
|
4595.1.1
by Jason Spashett
Further tweaks to bzr add |
58 |
'adding top.txt'], |
1711.1.3
by Robert Collins
Add new test_add file - should have been in last commit. |
59 |
results) |
2581.1.2
by Martin Pool
Remove unnecessary retcode=0 to run_bzr calls |
60 |
out = self.run_bzr('add -v')[0] |
1711.1.3
by Robert Collins
Add new test_add file - should have been in last commit. |
61 |
results = sorted(out.rstrip('\n').split('\n')) |
4595.1.1
by Jason Spashett
Further tweaks to bzr add |
62 |
self.assertEquals(['ignored CVS matching "CVS"'], |
1711.1.3
by Robert Collins
Add new test_add file - should have been in last commit. |
63 |
results) |
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
|
71 |
results = sorted(out.rstrip('\n').split('\n')) |
|
72 |
self.assertEquals([''], results) |
|
73 |
||
74 |
def test_add_in_unversioned(self): |
|
75 |
"""Try to add a file in an unversioned directory.
|
|
76 |
||
77 |
"bzr add" should add the parent(s) as necessary.
|
|
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']) |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
81 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
83 |
self.assertEquals(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']) |
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
87 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
89 |
self.assertEquals(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']) |
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
93 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
95 |
self.assertEquals(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']) |
|
100 |
self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n') |
|
101 |
self.run_bzr('add -N inertiatic') |
|
102 |
self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic/esp\n') |
|
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 |
||
107 |
"bzr add" should do this happily.
|
|
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']) |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
111 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
113 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
115 |
self.assertEquals(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') |
136 |
self.assertEquals('README\n', |
|
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
|
5012.1.1
by Vincent Ladeuil
Fix imports in blackbox/test_add.py. |
139 |
t = t.bzrdir.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()] |
5012.1.1
by Vincent Ladeuil
Fix imports in blackbox/test_add.py. |
141 |
self.assertEquals(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') |
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
145 |
self.assertEquals(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): |
|
149 |
"""bzr add foo where foo is missing should error."""
|
|
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') |
|
1911.3.2
by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree |
164 |
self.assertEqual('', err) |
3985.2.1
by Daniel Watkins
Updated tests for new behaviour. |
165 |
self.assertEqualDiff('adding a w/ file id from a\n' |
166 |
'adding b w/ file id from b\n' |
|
4075.1.1
by Robert Collins
add should not print 'add completed' unnecessarily. |
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) |
2255.2.171
by Martin Pool
Fix up blackbox test_add to avoid depending on inventory not being held in memory |
169 |
new_tree = new_tree.bzrdir.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') |
|
1911.3.2
by John Arbash Meinel
Adding the AddFromBaseAction, which tries to reuse file ids from another tree |
185 |
self.assertEqual('', err) |
3985.2.1
by Daniel Watkins
Updated tests for new behaviour. |
186 |
self.assertEqualDiff('adding c w/ file id from b/c\n' |
4075.1.1
by Robert Collins
add should not print 'add completed' unnecessarily. |
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 |
||
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. |
190 |
new_tree = new_tree.bzrdir.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] |
2279.5.1
by Matthias Rahlf
FastPath objects can now be printed nicely |
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] |
2279.5.1
by Matthias Rahlf
FastPath objects can now be printed nicely |
208 |
self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file') |
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] |
2279.5.1
by Matthias Rahlf
FastPath objects can now be printed nicely |
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] |
|
219 |
self.assertEquals(out, 'adding top.txt\n') |
|
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] |
|
4301.1.1
by Geoff Bache
Fixing bug 183831, where 'bzr add' fails with a python stack if the path contains a symbolic link |
226 |
self.assertEquals(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, ''' |
|
235 |
$ bzr add tree1/a tree2/b
|
|
236 |
2>bzr: ERROR: Path "...tree2/b" is not a child of path "...tree1"
|
|
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") |
|
245 |
self.assertEquals(out, "adding a\n" "adding b\n") |
|
246 |
self.assertEquals(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']) |
6046.2.1
by Shannon Weyrick
Add support for skipping large files during add, based on configurable threshold (default 1M). Fixes bug #54624 |
252 |
self.build_tree_contents([('small.txt', '0\n')]) |
253 |
self.build_tree_contents([('big.txt', '01234567890123456789\n')]) |
|
6046.2.9
by Shannon Weyrick
Make it explicit in docs that large file skips happen only in recursive mode. Add test. |
254 |
self.build_tree_contents([('big2.txt', '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] |
257 |
results = sorted(out.rstrip('\n').split('\n')) |
|
6421.3.1
by Vincent Ladeuil
Migrate more branch options to config stacks. |
258 |
self.assertEquals(['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"]) |
|
261 |
results = sorted(out.rstrip('\n').split('\n')) |
|
6421.3.1
by Vincent Ladeuil
Migrate more branch options to config stacks. |
262 |
self.assertEquals(['adding big2.txt'], results) |
263 |
self.assertEquals("", 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] |
266 |
results = sorted(out.rstrip('\n').split('\n')) |
|
6421.3.1
by Vincent Ladeuil
Migrate more branch options to config stacks. |
267 |
self.assertEquals(['adding big.txt'], results) |