bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
1 |
# Copyright (C) 2008-2011 Canonical Ltd
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
2 |
#
|
|
0.12.80
by Aaron Bentley
Re-format GPL notifications |
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
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
16 |
|
|
0.12.17
by Aaron Bentley
Handle creating symlinks |
17 |
import os |
18 |
||
|
6670.4.1
by Jelmer Vernooij
Update imports. |
19 |
from .. import ( |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
20 |
errors, |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
21 |
ignores, |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
22 |
osutils, |
23 |
shelf, |
|
24 |
tests, |
|
25 |
transform, |
|
26 |
workingtree, |
|
27 |
)
|
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
28 |
from ..bzr import ( |
29 |
pack, |
|
30 |
)
|
|
31 |
from . import ( |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
32 |
features, |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
33 |
KnownFailure, |
34 |
)
|
|
|
6833.3.2
by Jelmer Vernooij
Fix import. |
35 |
from ..errors import ( |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
36 |
MalformedTransform, |
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
37 |
)
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
38 |
|
39 |
||
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
40 |
EMPTY_SHELF = (b"Bazaar pack format 1 (introduced in 0.18)\n" |
41 |
b"B23\n" |
|
42 |
b"metadata\n\n" |
|
43 |
b"d11:revision_id5:null:e" |
|
44 |
b"B159\n" |
|
45 |
b"attribs\n\n" |
|
46 |
b"d10:_id_numberi0e18:_new_executabilityde7:_new_idde" |
|
47 |
b"9:_new_namede11:_new_parentde16:_non_present_idsde" |
|
48 |
b"17:_removed_contentsle11:_removed_idle14:_tree_path_idsdeeE") |
|
|
0.14.34
by Aaron Bentley
Factor out the empty shelf |
49 |
|
50 |
||
|
6734.1.1
by Jelmer Vernooij
Fix more imports. |
51 |
class TestErrors(tests.TestCase): |
52 |
||
53 |
def test_invalid_shelf_id(self): |
|
54 |
invalid_id = "foo" |
|
55 |
err = shelf.InvalidShelfId(invalid_id) |
|
56 |
self.assertEqual('"foo" is not a valid shelf id, ' |
|
57 |
'try a number instead.', str(err)) |
|
58 |
||
59 |
||
|
0.12.12
by Aaron Bentley
Implement shelf creator |
60 |
class TestPrepareShelf(tests.TestCaseWithTransport): |
61 |
||
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
62 |
def prepare_shelve_rename(self): |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
63 |
tree = self.make_branch_and_tree('.') |
64 |
self.build_tree(['foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
65 |
tree.add(['foo'], [b'foo-id']) |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
66 |
tree.commit('foo') |
67 |
tree.rename_one('foo', 'bar') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
68 |
tree.lock_tree_write() |
69 |
self.addCleanup(tree.unlock) |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
70 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
71 |
self.addCleanup(creator.finalize) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
72 |
self.assertEqual([('rename', b'foo-id', 'foo', 'bar')], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
73 |
list(creator.iter_shelvable())) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
74 |
return creator |
75 |
||
76 |
def check_shelve_rename(self, creator): |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
77 |
work_trans_id = creator.work_transform.trans_id_file_id(b'foo-id') |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
78 |
self.assertEqual('foo', creator.work_transform.final_name( |
79 |
work_trans_id)) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
80 |
shelf_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
81 |
self.assertEqual('bar', creator.shelf_transform.final_name( |
82 |
shelf_trans_id)) |
|
83 |
||
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
84 |
def test_shelve_rename(self): |
85 |
creator = self.prepare_shelve_rename() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
86 |
creator.shelve_rename(b'foo-id') |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
87 |
self.check_shelve_rename(creator) |
88 |
||
89 |
def test_shelve_change_handles_rename(self): |
|
90 |
creator = self.prepare_shelve_rename() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
91 |
creator.shelve_change(('rename', b'foo-id', 'foo', 'bar')) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
92 |
self.check_shelve_rename(creator) |
93 |
||
94 |
def prepare_shelve_move(self): |
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
95 |
tree = self.make_branch_and_tree('.') |
96 |
self.build_tree(['foo/', 'bar/', 'foo/baz']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
97 |
tree.add(['foo', 'bar', 'foo/baz'], [b'foo-id', b'bar-id', b'baz-id']) |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
98 |
tree.commit('foo') |
99 |
tree.rename_one('foo/baz', 'bar/baz') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
100 |
tree.lock_tree_write() |
101 |
self.addCleanup(tree.unlock) |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
102 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.12.12
by Aaron Bentley
Implement shelf creator |
103 |
self.addCleanup(creator.finalize) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
104 |
self.assertEqual([('rename', b'baz-id', 'foo/baz', 'bar/baz')], |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
105 |
list(creator.iter_shelvable())) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
106 |
return creator, tree |
107 |
||
108 |
def check_shelve_move(self, creator, tree): |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
109 |
work_trans_id = creator.work_transform.trans_id_file_id(b'baz-id') |
110 |
work_foo = creator.work_transform.trans_id_file_id(b'foo-id') |
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
111 |
self.assertEqual(work_foo, creator.work_transform.final_parent( |
112 |
work_trans_id)) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
113 |
shelf_trans_id = creator.shelf_transform.trans_id_file_id(b'baz-id') |
114 |
shelf_bar = creator.shelf_transform.trans_id_file_id(b'bar-id') |
|
|
0.12.12
by Aaron Bentley
Implement shelf creator |
115 |
self.assertEqual(shelf_bar, creator.shelf_transform.final_parent( |
116 |
shelf_trans_id)) |
|
|
0.12.13
by Aaron Bentley
Implement shelving content |
117 |
creator.transform() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
118 |
self.assertEqual('foo/baz', tree.id2path(b'baz-id')) |
|
0.12.13
by Aaron Bentley
Implement shelving content |
119 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
120 |
def test_shelve_move(self): |
121 |
creator, tree = self.prepare_shelve_move() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
122 |
creator.shelve_rename(b'baz-id') |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
123 |
self.check_shelve_move(creator, tree) |
124 |
||
125 |
def test_shelve_change_handles_move(self): |
|
126 |
creator, tree = self.prepare_shelve_move() |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
127 |
creator.shelve_change(('rename', b'baz-id', 'foo/baz', 'bar/baz')) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
128 |
self.check_shelve_move(creator, tree) |
129 |
||
|
4634.123.6
by John Arbash Meinel
Add a direct ShelfCreator test for changing root id. |
130 |
def test_shelve_changed_root_id(self): |
131 |
tree = self.make_branch_and_tree('.') |
|
132 |
self.build_tree(['foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
133 |
tree.set_root_id(b'first-root-id') |
134 |
tree.add(['foo'], [b'foo-id']) |
|
|
4634.123.6
by John Arbash Meinel
Add a direct ShelfCreator test for changing root id. |
135 |
tree.commit('foo') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
136 |
tree.set_root_id(b'second-root-id') |
|
4634.123.6
by John Arbash Meinel
Add a direct ShelfCreator test for changing root id. |
137 |
tree.lock_tree_write() |
138 |
self.addCleanup(tree.unlock) |
|
139 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
140 |
self.addCleanup(creator.finalize) |
|
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
141 |
self.expectFailure( |
142 |
'shelf doesn\'t support shelving root changes yet', |
|
143 |
self.assertEqual, [ |
|
144 |
('delete file', b'first-root-id', 'directory', ''), |
|
145 |
('add file', b'second-root-id', 'directory', ''), |
|
146 |
('rename', b'foo-id', u'foo', u'foo'), |
|
147 |
], list(creator.iter_shelvable())) |
|
|
4634.123.6
by John Arbash Meinel
Add a direct ShelfCreator test for changing root id. |
148 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
149 |
self.assertEqual([('delete file', b'first-root-id', 'directory', ''), |
150 |
('add file', b'second-root-id', 'directory', ''), |
|
151 |
('rename', b'foo-id', u'foo', u'foo'), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
152 |
], list(creator.iter_shelvable())) |
|
4634.123.6
by John Arbash Meinel
Add a direct ShelfCreator test for changing root id. |
153 |
|
|
0.12.14
by Aaron Bentley
Add shelving of created files |
154 |
def assertShelvedFileEqual(self, expected_content, creator, file_id): |
155 |
s_trans_id = creator.shelf_transform.trans_id_file_id(file_id) |
|
156 |
shelf_file = creator.shelf_transform._limbo_name(s_trans_id) |
|
157 |
self.assertFileEqual(expected_content, shelf_file) |
|
158 |
||
|
4595.8.1
by Aaron Bentley
shelve_change handles text modification. |
159 |
def prepare_content_change(self): |
|
0.12.13
by Aaron Bentley
Implement shelving content |
160 |
tree = self.make_branch_and_tree('.') |
161 |
tree.lock_write() |
|
162 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
163 |
self.build_tree_contents([('foo', b'a\n')]) |
164 |
tree.add('foo', b'foo-id') |
|
|
0.12.13
by Aaron Bentley
Implement shelving content |
165 |
tree.commit('Committed foo') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
166 |
self.build_tree_contents([('foo', b'b\na\nc\n')]) |
|
0.14.7
by Aaron Bentley
Misc test cleanup |
167 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.12.13
by Aaron Bentley
Implement shelving content |
168 |
self.addCleanup(creator.finalize) |
|
4595.8.2
by Aaron Bentley
Implement shelve_all |
169 |
return creator |
170 |
||
171 |
def test_shelve_content_change(self): |
|
172 |
creator = self.prepare_content_change() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
173 |
self.assertEqual([('modify text', b'foo-id')], |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
174 |
list(creator.iter_shelvable())) |
|
6973.6.1
by Jelmer Vernooij
More bees. |
175 |
creator.shelve_lines(b'foo-id', [b'a\n', b'c\n']) |
|
0.12.13
by Aaron Bentley
Implement shelving content |
176 |
creator.transform() |
|
6973.6.1
by Jelmer Vernooij
More bees. |
177 |
self.assertFileEqual(b'a\nc\n', 'foo') |
178 |
self.assertShelvedFileEqual(b'b\na\n', creator, b'foo-id') |
|
|
0.12.14
by Aaron Bentley
Add shelving of created files |
179 |
|
|
4595.8.1
by Aaron Bentley
shelve_change handles text modification. |
180 |
def test_shelve_change_handles_modify_text(self): |
181 |
creator = self.prepare_content_change() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
182 |
creator.shelve_change(('modify text', b'foo-id')) |
|
4595.8.1
by Aaron Bentley
shelve_change handles text modification. |
183 |
creator.transform() |
|
6973.6.1
by Jelmer Vernooij
More bees. |
184 |
self.assertFileEqual(b'a\n', 'foo') |
185 |
self.assertShelvedFileEqual(b'b\na\nc\n', creator, b'foo-id') |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
186 |
|
|
4595.8.2
by Aaron Bentley
Implement shelve_all |
187 |
def test_shelve_all(self): |
188 |
creator = self.prepare_content_change() |
|
189 |
creator.shelve_all() |
|
190 |
creator.transform() |
|
|
6973.6.1
by Jelmer Vernooij
More bees. |
191 |
self.assertFileEqual(b'a\n', 'foo') |
192 |
self.assertShelvedFileEqual(b'b\na\nc\n', creator, b'foo-id') |
|
|
4595.8.2
by Aaron Bentley
Implement shelve_all |
193 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
194 |
def prepare_shelve_creation(self): |
|
0.12.14
by Aaron Bentley
Add shelving of created files |
195 |
tree = self.make_branch_and_tree('.') |
196 |
tree.lock_write() |
|
197 |
self.addCleanup(tree.unlock) |
|
198 |
tree.commit('Empty tree') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
199 |
self.build_tree_contents([('foo', b'a\n'), ('bar/',)]) |
200 |
tree.add(['foo', 'bar'], [b'foo-id', b'bar-id']) |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
201 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.12.14
by Aaron Bentley
Add shelving of created files |
202 |
self.addCleanup(creator.finalize) |
|
7045.1.1
by Jelmer Vernooij
Fix another 300 tests. |
203 |
self.assertEqual([('add file', b'bar-id', 'directory', 'bar'), |
204 |
('add file', b'foo-id', 'file', 'foo')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
205 |
sorted(list(creator.iter_shelvable()))) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
206 |
return creator, tree |
207 |
||
208 |
def check_shelve_creation(self, creator, tree): |
|
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
209 |
self.assertRaises( |
210 |
StopIteration, next, |
|
211 |
tree.iter_entries_by_dir(specific_files=['foo'])) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
212 |
s_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
213 |
self.assertEqual(b'foo-id', |
|
|
0.12.15
by Aaron Bentley
Handle file-id when shelving creation |
214 |
creator.shelf_transform.final_file_id(s_trans_id)) |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
215 |
self.assertPathDoesNotExist('foo') |
216 |
self.assertPathDoesNotExist('bar') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
217 |
self.assertShelvedFileEqual('a\n', creator, b'foo-id') |
218 |
s_bar_trans_id = creator.shelf_transform.trans_id_file_id(b'bar-id') |
|
|
0.12.16
by Aaron Bentley
Handle shelving directory creation |
219 |
self.assertEqual('directory', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
220 |
creator.shelf_transform.final_kind(s_bar_trans_id)) |
|
0.12.17
by Aaron Bentley
Handle creating symlinks |
221 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
222 |
def test_shelve_creation(self): |
223 |
creator, tree = self.prepare_shelve_creation() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
224 |
creator.shelve_creation(b'foo-id') |
225 |
creator.shelve_creation(b'bar-id') |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
226 |
creator.transform() |
227 |
self.check_shelve_creation(creator, tree) |
|
228 |
||
229 |
def test_shelve_change_handles_creation(self): |
|
230 |
creator, tree = self.prepare_shelve_creation() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
231 |
creator.shelve_change(('add file', b'foo-id', 'file', 'foo')) |
232 |
creator.shelve_change(('add file', b'bar-id', 'directory', 'bar')) |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
233 |
creator.transform() |
234 |
self.check_shelve_creation(creator, tree) |
|
235 |
||
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
236 |
def test_shelve_directory_with_ignored(self): |
237 |
tree = self.make_branch_and_tree('.') |
|
238 |
tree.lock_write() |
|
239 |
self.addCleanup(tree.unlock) |
|
240 |
tree.commit('Empty tree') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
241 |
self.build_tree_contents( |
242 |
[('foo', b'a\n'), ('bar/',), ('bar/ignored', b'ign\n')]) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
243 |
tree.add(['foo', 'bar'], [b'foo-id', b'bar-id']) |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
244 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
245 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
246 |
self.assertEqual([('add file', b'bar-id', 'directory', 'bar'), |
247 |
('add file', b'foo-id', 'file', 'foo')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
248 |
sorted(list(creator.iter_shelvable()))) |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
249 |
ignores._set_user_ignores([]) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
250 |
in_patterns = ['ignored', ] |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
251 |
ignores.add_unique_user_ignores(in_patterns) |
252 |
||
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
253 |
creator.shelve_change(('add file', b'bar-id', 'directory', 'bar')) |
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
254 |
try: |
255 |
creator.transform() |
|
256 |
self.check_shelve_creation(creator, tree) |
|
257 |
except MalformedTransform: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
258 |
raise KnownFailure( |
259 |
'shelving directory with ignored file: see bug #611739') |
|
|
6571.3.1
by Daniel Clemente
test for bug #611739 (shelving directory with ignored file). Known failure |
260 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
261 |
def _test_shelve_symlink_creation(self, link_name, link_target, |
262 |
shelve_change=False): |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
263 |
self.requireFeature(features.SymlinkFeature) |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
264 |
tree = self.make_branch_and_tree('.') |
265 |
tree.lock_write() |
|
266 |
self.addCleanup(tree.unlock) |
|
267 |
tree.commit('Empty tree') |
|
268 |
os.symlink(link_target, link_name) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
269 |
tree.add(link_name, b'foo-id') |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
270 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
271 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
272 |
self.assertEqual([('add file', b'foo-id', 'symlink', link_name)], |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
273 |
list(creator.iter_shelvable())) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
274 |
if shelve_change: |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
275 |
creator.shelve_change( |
276 |
('add file', b'foo-id', 'symlink', link_name)) |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
277 |
else: |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
278 |
creator.shelve_creation(b'foo-id') |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
279 |
creator.transform() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
280 |
s_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
281 |
self.assertPathDoesNotExist(link_name) |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
282 |
limbo_name = creator.shelf_transform._limbo_name(s_trans_id) |
283 |
self.assertEqual(link_target, osutils.readlink(limbo_name)) |
|
284 |
ptree = creator.shelf_transform.get_preview_tree() |
|
|
6809.4.15
by Jelmer Vernooij
Fix some more tests. |
285 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
286 |
link_target, |
|
7143.15.15
by Jelmer Vernooij
Merge trunk. |
287 |
ptree.get_symlink_target(ptree.id2path(b'foo-id'))) |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
288 |
|
|
0.12.17
by Aaron Bentley
Handle creating symlinks |
289 |
def test_shelve_symlink_creation(self): |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
290 |
self._test_shelve_symlink_creation('foo', 'bar') |
291 |
||
292 |
def test_shelve_unicode_symlink_creation(self): |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
293 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
294 |
self._test_shelve_symlink_creation(u'fo\N{Euro Sign}o', |
295 |
u'b\N{Euro Sign}ar') |
|
|
0.12.19
by Aaron Bentley
Add support for writing shelves |
296 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
297 |
def test_shelve_change_handles_symlink_creation(self): |
298 |
self._test_shelve_symlink_creation('foo', 'bar', shelve_change=True) |
|
299 |
||
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
300 |
def _test_shelve_symlink_target_change(self, link_name, |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
301 |
old_target, new_target, |
302 |
shelve_change=False): |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
303 |
self.requireFeature(features.SymlinkFeature) |
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
304 |
tree = self.make_branch_and_tree('.') |
305 |
tree.lock_write() |
|
306 |
self.addCleanup(tree.unlock) |
|
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
307 |
os.symlink(old_target, link_name) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
308 |
tree.add(link_name, b'foo-id') |
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
309 |
tree.commit("commit symlink") |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
310 |
os.unlink(link_name) |
311 |
os.symlink(new_target, link_name) |
|
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
312 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
313 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
314 |
self.assertEqual([('modify target', b'foo-id', link_name, |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
315 |
old_target, new_target)], |
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
316 |
list(creator.iter_shelvable())) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
317 |
if shelve_change: |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
318 |
creator.shelve_change(('modify target', b'foo-id', link_name, |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
319 |
old_target, new_target)) |
320 |
else: |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
321 |
creator.shelve_modify_target(b'foo-id') |
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
322 |
creator.transform() |
|
4241.14.21
by Vincent Ladeuil
More cleanup. |
323 |
self.assertEqual(old_target, osutils.readlink(link_name)) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
324 |
s_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
325 |
limbo_name = creator.shelf_transform._limbo_name(s_trans_id) |
|
4241.14.21
by Vincent Ladeuil
More cleanup. |
326 |
self.assertEqual(new_target, osutils.readlink(limbo_name)) |
|
4241.14.16
by Vincent Ladeuil
Fix _PreviewTree.get_symlink_target for unicode symlinks. |
327 |
ptree = creator.shelf_transform.get_preview_tree() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
328 |
self.assertEqual(new_target, ptree.get_symlink_target( |
329 |
ptree.id2path(b'foo-id'))) |
|
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
330 |
|
331 |
def test_shelve_symlink_target_change(self): |
|
332 |
self._test_shelve_symlink_target_change('foo', 'bar', 'baz') |
|
333 |
||
334 |
def test_shelve_unicode_symlink_target_change(self): |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
335 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
336 |
self._test_shelve_symlink_target_change( |
337 |
u'fo\N{Euro Sign}o', u'b\N{Euro Sign}ar', u'b\N{Euro Sign}az') |
|
|
4119.5.1
by James Westby
Shelve can now shelve changes to a symlink's target. |
338 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
339 |
def test_shelve_change_handles_symlink_target_change(self): |
340 |
self._test_shelve_symlink_target_change('foo', 'bar', 'baz', |
|
341 |
shelve_change=True) |
|
342 |
||
|
0.14.12
by Aaron Bentley
Handle new dangling ids |
343 |
def test_shelve_creation_no_contents(self): |
344 |
tree = self.make_branch_and_tree('.') |
|
345 |
tree.lock_write() |
|
346 |
self.addCleanup(tree.unlock) |
|
347 |
tree.commit('Empty tree') |
|
348 |
self.build_tree(['foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
349 |
tree.add('foo', b'foo-id') |
|
0.14.12
by Aaron Bentley
Handle new dangling ids |
350 |
os.unlink('foo') |
351 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
352 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
353 |
self.assertEqual([('add file', b'foo-id', None, 'foo')], |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
354 |
sorted(list(creator.iter_shelvable()))) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
355 |
creator.shelve_creation(b'foo-id') |
|
0.14.12
by Aaron Bentley
Handle new dangling ids |
356 |
creator.transform() |
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
357 |
self.assertRaises( |
358 |
StopIteration, next, |
|
359 |
tree.iter_entries_by_dir(specific_files=['foo'])) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
360 |
self.assertShelvedFileEqual('', creator, b'foo-id') |
361 |
s_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
|
362 |
self.assertEqual(b'foo-id', |
|
|
0.14.12
by Aaron Bentley
Handle new dangling ids |
363 |
creator.shelf_transform.final_file_id(s_trans_id)) |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
364 |
self.assertPathDoesNotExist('foo') |
|
0.14.12
by Aaron Bentley
Handle new dangling ids |
365 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
366 |
def prepare_shelve_deletion(self): |
|
0.14.4
by Aaron Bentley
Implement shelving deletion |
367 |
tree = self.make_branch_and_tree('tree') |
|
0.14.11
by Aaron Bentley
Fix re-versioning |
368 |
tree.lock_write() |
369 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
370 |
self.build_tree_contents([('tree/foo/',), ('tree/foo/bar', b'baz')]) |
371 |
tree.add(['foo', 'foo/bar'], [b'foo-id', b'bar-id']) |
|
|
0.14.4
by Aaron Bentley
Implement shelving deletion |
372 |
tree.commit('Added file and directory') |
|
6809.4.25
by Jelmer Vernooij
Add paths argument to .unversion. |
373 |
tree.unversion(['foo', 'foo/bar']) |
|
0.14.4
by Aaron Bentley
Implement shelving deletion |
374 |
os.unlink('tree/foo/bar') |
375 |
os.rmdir('tree/foo') |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
376 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.14.4
by Aaron Bentley
Implement shelving deletion |
377 |
self.addCleanup(creator.finalize) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
378 |
self.assertEqual([('delete file', b'bar-id', 'file', 'foo/bar'), |
379 |
('delete file', b'foo-id', 'directory', 'foo')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
380 |
sorted(list(creator.iter_shelvable()))) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
381 |
return creator, tree |
382 |
||
383 |
def check_shelve_deletion(self, tree): |
|
|
7397.4.7
by Jelmer Vernooij
Remove Tree.has_id. |
384 |
self.assertEqual(tree.id2path(b'foo-id'), 'foo') |
385 |
self.assertEqual(tree.id2path(b'bar-id'), 'foo/bar') |
|
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
386 |
self.assertFileEqual(b'baz', 'tree/foo/bar') |
|
0.14.4
by Aaron Bentley
Implement shelving deletion |
387 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
388 |
def test_shelve_deletion(self): |
389 |
creator, tree = self.prepare_shelve_deletion() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
390 |
creator.shelve_deletion(b'foo-id') |
391 |
creator.shelve_deletion(b'bar-id') |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
392 |
creator.transform() |
393 |
self.check_shelve_deletion(tree) |
|
394 |
||
395 |
def test_shelve_change_handles_deletion(self): |
|
396 |
creator, tree = self.prepare_shelve_deletion() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
397 |
creator.shelve_change(('delete file', b'foo-id', 'directory', 'foo')) |
398 |
creator.shelve_change(('delete file', b'bar-id', 'file', 'foo/bar')) |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
399 |
creator.transform() |
400 |
self.check_shelve_deletion(tree) |
|
401 |
||
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
402 |
def test_shelve_delete_contents(self): |
403 |
tree = self.make_branch_and_tree('tree') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
404 |
self.build_tree(['tree/foo', ]) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
405 |
tree.add('foo', b'foo-id') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
406 |
tree.commit('Added file and directory') |
407 |
os.unlink('tree/foo') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
408 |
tree.lock_tree_write() |
409 |
self.addCleanup(tree.unlock) |
|
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
410 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
411 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
412 |
self.assertEqual([('delete file', b'foo-id', 'file', 'foo')], |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
413 |
sorted(list(creator.iter_shelvable()))) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
414 |
creator.shelve_deletion(b'foo-id') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
415 |
creator.transform() |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
416 |
self.assertPathExists('tree/foo') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
417 |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
418 |
def prepare_shelve_change_kind(self): |
|
0.14.23
by Aaron Bentley
Allow shelving kind change |
419 |
tree = self.make_branch_and_tree('tree') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
420 |
self.build_tree_contents([('tree/foo', b'bar')]) |
421 |
tree.add('foo', b'foo-id') |
|
|
0.14.23
by Aaron Bentley
Allow shelving kind change |
422 |
tree.commit('Added file and directory') |
423 |
os.unlink('tree/foo') |
|
424 |
os.mkdir('tree/foo') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
425 |
tree.lock_tree_write() |
426 |
self.addCleanup(tree.unlock) |
|
|
0.14.23
by Aaron Bentley
Allow shelving kind change |
427 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
428 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
429 |
self.assertEqual([('change kind', b'foo-id', 'file', 'directory', |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
430 |
'foo')], sorted(list(creator.iter_shelvable()))) |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
431 |
return creator |
432 |
||
433 |
def check_shelve_change_kind(self, creator): |
|
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
434 |
self.assertFileEqual(b'bar', 'tree/foo') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
435 |
s_trans_id = creator.shelf_transform.trans_id_file_id(b'foo-id') |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
436 |
self.assertEqual('directory', |
437 |
creator.shelf_transform._new_contents[s_trans_id]) |
|
438 |
||
439 |
def test_shelve_change_kind(self): |
|
440 |
creator = self.prepare_shelve_change_kind() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
441 |
creator.shelve_content_change(b'foo-id') |
|
0.14.23
by Aaron Bentley
Allow shelving kind change |
442 |
creator.transform() |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
443 |
self.check_shelve_change_kind(creator) |
444 |
||
445 |
def test_shelve_change_handles_change_kind(self): |
|
446 |
creator = self.prepare_shelve_change_kind() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
447 |
creator.shelve_change(('change kind', b'foo-id', 'file', 'directory', |
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
448 |
'foo')) |
449 |
creator.transform() |
|
450 |
self.check_shelve_change_kind(creator) |
|
451 |
||
452 |
def test_shelve_change_unknown_change(self): |
|
453 |
tree = self.make_branch_and_tree('tree') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
454 |
tree.lock_tree_write() |
455 |
self.addCleanup(tree.unlock) |
|
|
4526.7.3
by Aaron Bentley
Test shelve_change. |
456 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
457 |
self.addCleanup(creator.finalize) |
|
458 |
e = self.assertRaises(ValueError, creator.shelve_change, ('unknown',)) |
|
459 |
self.assertEqual('Unknown change kind: "unknown"', str(e)) |
|
|
0.14.23
by Aaron Bentley
Allow shelving kind change |
460 |
|
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
461 |
def test_shelve_unversion(self): |
462 |
tree = self.make_branch_and_tree('tree') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
463 |
self.build_tree(['tree/foo', ]) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
464 |
tree.add('foo', b'foo-id') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
465 |
tree.commit('Added file and directory') |
|
6809.4.25
by Jelmer Vernooij
Add paths argument to .unversion. |
466 |
tree.unversion(['foo']) |
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
467 |
tree.lock_tree_write() |
468 |
self.addCleanup(tree.unlock) |
|
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
469 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
470 |
self.addCleanup(creator.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
471 |
self.assertEqual([('delete file', b'foo-id', 'file', 'foo')], |
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
472 |
sorted(list(creator.iter_shelvable()))) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
473 |
creator.shelve_deletion(b'foo-id') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
474 |
creator.transform() |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
475 |
self.assertPathExists('tree/foo') |
|
0.14.10
by Aaron Bentley
Fix behavior with deletions, unversioning, ... |
476 |
|
|
0.14.33
by Aaron Bentley
Add explicit test of shelf on-disk format |
477 |
def test_shelve_serialization(self): |
478 |
tree = self.make_branch_and_tree('.') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
479 |
tree.lock_tree_write() |
480 |
self.addCleanup(tree.unlock) |
|
|
0.14.33
by Aaron Bentley
Add explicit test of shelf on-disk format |
481 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
482 |
self.addCleanup(creator.finalize) |
|
|
0.12.76
by Aaron Bentley
Convert failing tests |
483 |
shelf_file = open('shelf', 'wb') |
484 |
self.addCleanup(shelf_file.close) |
|
485 |
try: |
|
486 |
creator.write_shelf(shelf_file) |
|
487 |
finally: |
|
488 |
shelf_file.close() |
|
489 |
self.assertFileEqual(EMPTY_SHELF, 'shelf') |
|
|
0.14.33
by Aaron Bentley
Add explicit test of shelf on-disk format |
490 |
|
|
0.12.19
by Aaron Bentley
Add support for writing shelves |
491 |
def test_write_shelf(self): |
492 |
tree = self.make_branch_and_tree('tree') |
|
493 |
self.build_tree(['tree/foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
494 |
tree.add('foo', b'foo-id') |
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
495 |
tree.lock_tree_write() |
496 |
self.addCleanup(tree.unlock) |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
497 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
498 |
self.addCleanup(creator.finalize) |
|
|
0.14.32
by Aaron Bentley
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable |
499 |
list(creator.iter_shelvable()) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
500 |
creator.shelve_creation(b'foo-id') |
501 |
with open('shelf', 'wb') as shelf_file: |
|
|
0.12.61
by Aaron Bentley
Stop assigning result of write_shelf |
502 |
creator.write_shelf(shelf_file) |
|
0.12.19
by Aaron Bentley
Add support for writing shelves |
503 |
parser = pack.ContainerPushParser() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
504 |
with open('shelf', 'rb') as shelf_file: |
|
0.12.19
by Aaron Bentley
Add support for writing shelves |
505 |
parser.accept_bytes(shelf_file.read()) |
506 |
tt = transform.TransformPreview(tree) |
|
|
0.14.7
by Aaron Bentley
Misc test cleanup |
507 |
self.addCleanup(tt.finalize) |
|
0.12.29
by Aaron Bentley
Update failing tests |
508 |
records = iter(parser.read_pending_records()) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
509 |
# skip revision-id
|
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
510 |
next(records) |
|
0.15.26
by Aaron Bentley
Merge with prepare-shelf |
511 |
tt.deserialize(records) |
|
0.12.21
by Aaron Bentley
Add failing test of unshelver |
512 |
|
|
3873.2.4
by Benoît Pierre
Add a test: test_shelve_unversioned; check if tree is in a clean state |
513 |
def test_shelve_unversioned(self): |
514 |
tree = self.make_branch_and_tree('tree') |
|
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
515 |
with tree.lock_tree_write(): |
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
516 |
self.assertRaises(errors.PathsNotVersionedError, |
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
517 |
shelf.ShelfCreator, tree, tree.basis_tree(), |
518 |
['foo']) |
|
|
3873.2.4
by Benoît Pierre
Add a test: test_shelve_unversioned; check if tree is in a clean state |
519 |
# We should be able to lock/unlock the tree if ShelfCreator cleaned
|
520 |
# after itself.
|
|
521 |
wt = workingtree.WorkingTree.open('tree') |
|
522 |
wt.lock_tree_write() |
|
523 |
wt.unlock() |
|
524 |
# And a second tentative should raise the same error (no
|
|
525 |
# limbo/pending_deletion leftovers).
|
|
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
526 |
with tree.lock_tree_write(): |
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
527 |
self.assertRaises(errors.PathsNotVersionedError, |
|
7143.15.5
by Jelmer Vernooij
More PEP8 fixes. |
528 |
shelf.ShelfCreator, tree, tree.basis_tree(), |
529 |
['foo']) |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
530 |
|
|
4595.9.1
by Aaron Bentley
Fix shelve in uncommitted trees. |
531 |
def test_shelve_skips_added_root(self): |
532 |
"""Skip adds of the root when iterating through shelvable changes.""" |
|
533 |
tree = self.make_branch_and_tree('tree') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
534 |
tree.lock_tree_write() |
535 |
self.addCleanup(tree.unlock) |
|
|
4595.9.1
by Aaron Bentley
Fix shelve in uncommitted trees. |
536 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
537 |
self.addCleanup(creator.finalize) |
|
538 |
self.assertEqual([], list(creator.iter_shelvable())) |
|
539 |
||
540 |
def test_shelve_skips_added_root(self): |
|
541 |
"""Skip adds of the root when iterating through shelvable changes.""" |
|
542 |
tree = self.make_branch_and_tree('tree') |
|
|
4596.1.6
by Martin Pool
merge trunk |
543 |
tree.lock_tree_write() |
544 |
self.addCleanup(tree.unlock) |
|
|
4595.9.1
by Aaron Bentley
Fix shelve in uncommitted trees. |
545 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
546 |
self.addCleanup(creator.finalize) |
|
547 |
self.assertEqual([], list(creator.iter_shelvable())) |
|
548 |
||
|
0.12.21
by Aaron Bentley
Add failing test of unshelver |
549 |
|
550 |
class TestUnshelver(tests.TestCaseWithTransport): |
|
551 |
||
|
0.15.31
by Aaron Bentley
Remove 'unshelve' method, test make_merger |
552 |
def test_make_merger(self): |
|
0.12.21
by Aaron Bentley
Add failing test of unshelver |
553 |
tree = self.make_branch_and_tree('tree') |
|
0.12.30
by Aaron Bentley
Fix test by using non NULL base tree |
554 |
tree.commit('first commit') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
555 |
self.build_tree_contents([('tree/foo', b'bar')]) |
|
0.12.24
by Aaron Bentley
Get unshelve using merge codepath, not applying transform directly |
556 |
tree.lock_write() |
557 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
558 |
tree.add('foo', b'foo-id') |
|
0.15.5
by Aaron Bentley
Rename to shelf |
559 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
560 |
self.addCleanup(creator.finalize) |
|
|
0.12.73
by Aaron Bentley
Merge unshelve into shelf-manager |
561 |
list(creator.iter_shelvable()) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
562 |
creator.shelve_creation(b'foo-id') |
563 |
with open('shelf-file', 'w+b') as shelf_file: |
|
|
0.12.61
by Aaron Bentley
Stop assigning result of write_shelf |
564 |
creator.write_shelf(shelf_file) |
|
0.12.29
by Aaron Bentley
Update failing tests |
565 |
creator.transform() |
566 |
shelf_file.seek(0) |
|
|
0.12.34
by Aaron Bentley
merge with unshelve |
567 |
unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file) |
|
0.12.66
by Aaron Bentley
Merge with unshelve |
568 |
unshelver.make_merger().do_merge() |
|
4659.2.3
by Vincent Ladeuil
Cleanup more bzr-limbo-XXXXXX leaks in /tmp during selftest. |
569 |
self.addCleanup(unshelver.finalize) |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
570 |
self.assertFileEqual(b'bar', 'tree/foo') |
|
0.12.26
by Aaron Bentley
Use correct base for shelving |
571 |
|
|
0.15.23
by Aaron Bentley
Use correct tree for desrializing transform |
572 |
def test_unshelve_changed(self): |
573 |
tree = self.make_branch_and_tree('tree') |
|
574 |
tree.lock_write() |
|
575 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
576 |
self.build_tree_contents([('tree/foo', b'a\nb\nc\n')]) |
577 |
tree.add('foo', b'foo-id') |
|
|
0.15.23
by Aaron Bentley
Use correct tree for desrializing transform |
578 |
tree.commit('first commit') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
579 |
self.build_tree_contents([('tree/foo', b'a\nb\nd\n')]) |
|
0.15.23
by Aaron Bentley
Use correct tree for desrializing transform |
580 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
581 |
self.addCleanup(creator.finalize) |
|
|
0.12.73
by Aaron Bentley
Merge unshelve into shelf-manager |
582 |
list(creator.iter_shelvable()) |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
583 |
creator.shelve_lines(b'foo-id', [b'a\n', b'b\n', b'c\n']) |
|
0.12.57
by Aaron Bentley
Update for new Shelf API |
584 |
shelf_file = open('shelf', 'w+b') |
585 |
self.addCleanup(shelf_file.close) |
|
586 |
creator.write_shelf(shelf_file) |
|
|
0.15.23
by Aaron Bentley
Use correct tree for desrializing transform |
587 |
creator.transform() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
588 |
self.build_tree_contents([('tree/foo', b'z\na\nb\nc\n')]) |
|
0.12.57
by Aaron Bentley
Update for new Shelf API |
589 |
shelf_file.seek(0) |
590 |
unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file) |
|
|
4659.2.3
by Vincent Ladeuil
Cleanup more bzr-limbo-XXXXXX leaks in /tmp during selftest. |
591 |
self.addCleanup(unshelver.finalize) |
|
0.15.31
by Aaron Bentley
Remove 'unshelve' method, test make_merger |
592 |
unshelver.make_merger().do_merge() |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
593 |
self.assertFileEqual(b'z\na\nb\nd\n', 'tree/foo') |
|
0.15.23
by Aaron Bentley
Use correct tree for desrializing transform |
594 |
|
|
3981.1.1
by Robert Collins
Fix bug 319790 - unshelve of deleted paths failing. |
595 |
def test_unshelve_deleted(self): |
596 |
tree = self.make_branch_and_tree('tree') |
|
597 |
tree.lock_write() |
|
598 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
599 |
self.build_tree_contents([('tree/foo/',), ('tree/foo/bar', b'baz')]) |
600 |
tree.add(['foo', 'foo/bar'], [b'foo-id', b'bar-id']) |
|
|
3981.1.1
by Robert Collins
Fix bug 319790 - unshelve of deleted paths failing. |
601 |
tree.commit('Added file and directory') |
|
6809.4.25
by Jelmer Vernooij
Add paths argument to .unversion. |
602 |
tree.unversion(['foo', 'foo/bar']) |
|
3981.1.1
by Robert Collins
Fix bug 319790 - unshelve of deleted paths failing. |
603 |
os.unlink('tree/foo/bar') |
604 |
os.rmdir('tree/foo') |
|
605 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
606 |
list(creator.iter_shelvable()) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
607 |
creator.shelve_deletion(b'foo-id') |
608 |
creator.shelve_deletion(b'bar-id') |
|
|
5954.5.1
by Vincent Ladeuil
Tweak comment in Merge3Merger._merge_names and the corresponding test. |
609 |
with open('shelf', 'w+b') as shelf_file: |
610 |
creator.write_shelf(shelf_file) |
|
611 |
creator.transform() |
|
612 |
creator.finalize() |
|
|
3981.1.1
by Robert Collins
Fix bug 319790 - unshelve of deleted paths failing. |
613 |
# validate the test setup
|
|
7397.4.7
by Jelmer Vernooij
Remove Tree.has_id. |
614 |
self.assertEqual(tree.id2path(b'foo-id'), 'foo') |
615 |
self.assertEqual(tree.id2path(b'bar-id'), 'foo/bar') |
|
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
616 |
self.assertFileEqual(b'baz', 'tree/foo/bar') |
|
5954.5.1
by Vincent Ladeuil
Tweak comment in Merge3Merger._merge_names and the corresponding test. |
617 |
with open('shelf', 'r+b') as shelf_file: |
618 |
unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file) |
|
619 |
self.addCleanup(unshelver.finalize) |
|
620 |
unshelver.make_merger().do_merge() |
|
|
7397.4.7
by Jelmer Vernooij
Remove Tree.has_id. |
621 |
self.assertRaises(errors.NoSuchId, tree.id2path, b'foo-id') |
622 |
self.assertRaises(errors.NoSuchId, tree.id2path, b'bar-id') |
|
|
3981.1.1
by Robert Collins
Fix bug 319790 - unshelve of deleted paths failing. |
623 |
|
|
0.12.26
by Aaron Bentley
Use correct base for shelving |
624 |
def test_unshelve_base(self): |
625 |
tree = self.make_branch_and_tree('tree') |
|
626 |
tree.lock_write() |
|
627 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
628 |
tree.commit('rev1', rev_id=b'rev1') |
|
0.15.5
by Aaron Bentley
Rename to shelf |
629 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
0.12.59
by Aaron Bentley
Fix locking bugs in tests |
630 |
self.addCleanup(creator.finalize) |
|
0.12.42
by Aaron Bentley
Get shelf from tree |
631 |
manager = tree.get_shelf_manager() |
|
0.12.29
by Aaron Bentley
Update failing tests |
632 |
shelf_id, shelf_file = manager.new_shelf() |
633 |
try: |
|
|
0.12.61
by Aaron Bentley
Stop assigning result of write_shelf |
634 |
creator.write_shelf(shelf_file) |
|
0.12.29
by Aaron Bentley
Update failing tests |
635 |
finally: |
636 |
shelf_file.close() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
637 |
tree.commit('rev2', rev_id=b'rev2') |
|
0.12.29
by Aaron Bentley
Update failing tests |
638 |
shelf_file = manager.read_shelf(1) |
|
0.12.59
by Aaron Bentley
Fix locking bugs in tests |
639 |
self.addCleanup(shelf_file.close) |
640 |
unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file) |
|
641 |
self.addCleanup(unshelver.finalize) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
642 |
self.assertEqual(b'rev1', unshelver.base_tree.get_revision_id()) |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
643 |
|
|
0.15.41
by Aaron Bentley
Replace assert with proper error handling |
644 |
def test_unshelve_serialization(self): |
645 |
tree = self.make_branch_and_tree('.') |
|
646 |
self.build_tree_contents([('shelf', EMPTY_SHELF)]) |
|
|
0.12.76
by Aaron Bentley
Convert failing tests |
647 |
shelf_file = open('shelf', 'rb') |
648 |
self.addCleanup(shelf_file.close) |
|
649 |
unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file) |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
650 |
unshelver.finalize() |
|
0.15.41
by Aaron Bentley
Replace assert with proper error handling |
651 |
|
652 |
def test_corrupt_shelf(self): |
|
653 |
tree = self.make_branch_and_tree('.') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
654 |
self.build_tree_contents([('shelf', EMPTY_SHELF.replace(b'metadata', |
655 |
b'foo'))]) |
|
|
0.12.76
by Aaron Bentley
Convert failing tests |
656 |
shelf_file = open('shelf', 'rb') |
657 |
self.addCleanup(shelf_file.close) |
|
|
6734.1.1
by Jelmer Vernooij
Fix more imports. |
658 |
e = self.assertRaises(shelf.ShelfCorrupt, |
|
0.15.41
by Aaron Bentley
Replace assert with proper error handling |
659 |
shelf.Unshelver.from_tree_and_shelf, tree, |
|
0.12.76
by Aaron Bentley
Convert failing tests |
660 |
shelf_file) |
|
0.15.41
by Aaron Bentley
Replace assert with proper error handling |
661 |
self.assertEqual('Shelf corrupt.', str(e)) |
|
0.12.75
by Aaron Bentley
Merge unshelve into shelf-manager |
662 |
|
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
663 |
def test_unshelve_subdir_in_now_removed_dir(self): |
664 |
tree = self.make_branch_and_tree('.') |
|
665 |
self.addCleanup(tree.lock_write().unlock) |
|
666 |
self.build_tree(['dir/', 'dir/subdir/', 'dir/subdir/foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
667 |
tree.add(['dir'], [b'dir-id']) |
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
668 |
tree.commit('versioned dir') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
669 |
tree.add(['dir/subdir', 'dir/subdir/foo'], [b'subdir-id', b'foo-id']) |
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
670 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
671 |
self.addCleanup(creator.finalize) |
|
672 |
for change in creator.iter_shelvable(): |
|
673 |
creator.shelve_change(change) |
|
674 |
shelf_manager = tree.get_shelf_manager() |
|
675 |
shelf_id = shelf_manager.shelve_changes(creator) |
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
676 |
self.assertPathDoesNotExist('dir/subdir') |
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
677 |
tree.remove(['dir']) |
678 |
unshelver = shelf_manager.get_unshelver(shelf_id) |
|
679 |
self.addCleanup(unshelver.finalize) |
|
680 |
unshelver.make_merger().do_merge() |
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
681 |
self.assertPathExists('dir/subdir/foo') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
682 |
self.assertEqual(b'dir-id', tree.path2id('dir')) |
683 |
self.assertEqual(b'subdir-id', tree.path2id('dir/subdir')) |
|
684 |
self.assertEqual(b'foo-id', tree.path2id('dir/subdir/foo')) |
|
|
5599.1.1
by John Arbash Meinel
Move away from using Tree.inventory[] just to check if this is a root. |
685 |
|
|
0.12.27
by Aaron Bentley
Implement shelf manager |
686 |
|
687 |
class TestShelfManager(tests.TestCaseWithTransport): |
|
688 |
||
|
0.12.42
by Aaron Bentley
Get shelf from tree |
689 |
def test_get_shelf_manager(self): |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
690 |
tree = self.make_branch_and_tree('.') |
|
0.12.42
by Aaron Bentley
Get shelf from tree |
691 |
manager = tree.get_shelf_manager() |
|
0.12.41
by Aaron Bentley
Change shelf to use WT control dir for shelves |
692 |
self.assertEqual(tree._transport.base + 'shelf/', |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
693 |
manager.transport.base) |
694 |
||
695 |
def get_manager(self): |
|
|
0.12.42
by Aaron Bentley
Get shelf from tree |
696 |
return self.make_branch_and_tree('.').get_shelf_manager() |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
697 |
|
|
0.12.77
by Aaron Bentley
Use names of the form shelf-5 for shelves |
698 |
def test_get_shelf_filename(self): |
699 |
tree = self.make_branch_and_tree('.') |
|
700 |
manager = tree.get_shelf_manager() |
|
701 |
self.assertEqual('shelf-1', manager.get_shelf_filename(1)) |
|
702 |
||
703 |
def test_get_shelf_ids(self): |
|
704 |
tree = self.make_branch_and_tree('.') |
|
705 |
manager = tree.get_shelf_manager() |
|
706 |
self.assertEqual([1, 3], manager.get_shelf_ids( |
|
707 |
['shelf-1', 'shelf-02', 'shelf-3'])) |
|
708 |
||
|
0.12.27
by Aaron Bentley
Implement shelf manager |
709 |
def test_new_shelf(self): |
710 |
manager = self.get_manager() |
|
711 |
shelf_id, shelf_file = manager.new_shelf() |
|
712 |
shelf_file.close() |
|
713 |
self.assertEqual(1, shelf_id) |
|
714 |
shelf_id, shelf_file = manager.new_shelf() |
|
715 |
shelf_file.close() |
|
716 |
self.assertEqual(2, shelf_id) |
|
717 |
manager.delete_shelf(1) |
|
718 |
shelf_id, shelf_file = manager.new_shelf() |
|
719 |
shelf_file.close() |
|
720 |
self.assertEqual(3, shelf_id) |
|
721 |
||
722 |
def test_active_shelves(self): |
|
723 |
manager = self.get_manager() |
|
724 |
self.assertEqual([], manager.active_shelves()) |
|
725 |
shelf_id, shelf_file = manager.new_shelf() |
|
726 |
shelf_file.close() |
|
727 |
self.assertEqual([1], manager.active_shelves()) |
|
728 |
||
729 |
def test_delete_shelf(self): |
|
730 |
manager = self.get_manager() |
|
731 |
shelf_id, shelf_file = manager.new_shelf() |
|
732 |
shelf_file.close() |
|
733 |
self.assertEqual([1], manager.active_shelves()) |
|
734 |
manager.delete_shelf(1) |
|
735 |
self.assertEqual([], manager.active_shelves()) |
|
736 |
||
737 |
def test_last_shelf(self): |
|
738 |
manager = self.get_manager() |
|
739 |
self.assertIs(None, manager.last_shelf()) |
|
740 |
shelf_id, shelf_file = manager.new_shelf() |
|
741 |
shelf_file.close() |
|
742 |
self.assertEqual(1, manager.last_shelf()) |
|
743 |
||
744 |
def test_read_shelf(self): |
|
745 |
manager = self.get_manager() |
|
746 |
shelf_id, shelf_file = manager.new_shelf() |
|
747 |
try: |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
748 |
shelf_file.write(b'foo') |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
749 |
finally: |
750 |
shelf_file.close() |
|
751 |
shelf_id, shelf_file = manager.new_shelf() |
|
752 |
try: |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
753 |
shelf_file.write(b'bar') |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
754 |
finally: |
755 |
shelf_file.close() |
|
756 |
shelf_file = manager.read_shelf(1) |
|
757 |
try: |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
758 |
self.assertEqual(b'foo', shelf_file.read()) |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
759 |
finally: |
760 |
shelf_file.close() |
|
761 |
shelf_file = manager.read_shelf(2) |
|
762 |
try: |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
763 |
self.assertEqual(b'bar', shelf_file.read()) |
|
0.12.27
by Aaron Bentley
Implement shelf manager |
764 |
finally: |
765 |
shelf_file.close() |
|
|
0.12.43
by Aaron Bentley
Make ShelfManager consume ShelfCreator and produce Unshelver |
766 |
|
|
0.12.50
by Aaron Bentley
Improve error handling for non-existant shelf-ids |
767 |
def test_read_non_existant(self): |
768 |
manager = self.get_manager() |
|
|
6734.1.1
by Jelmer Vernooij
Fix more imports. |
769 |
e = self.assertRaises(shelf.NoSuchShelfId, manager.read_shelf, 1) |
|
0.12.50
by Aaron Bentley
Improve error handling for non-existant shelf-ids |
770 |
self.assertEqual('No changes are shelved with id "1".', str(e)) |
771 |
||
|
0.12.43
by Aaron Bentley
Make ShelfManager consume ShelfCreator and produce Unshelver |
772 |
def test_shelve_changes(self): |
773 |
tree = self.make_branch_and_tree('tree') |
|
|
0.12.44
by Aaron Bentley
Give manager responsibility for applying transform |
774 |
tree.commit('no-change commit') |
775 |
tree.lock_write() |
|
776 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
777 |
self.build_tree_contents([('tree/foo', b'bar')]) |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
778 |
self.assertFileEqual(b'bar', 'tree/foo') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
779 |
tree.add('foo', b'foo-id') |
|
0.12.43
by Aaron Bentley
Make ShelfManager consume ShelfCreator and produce Unshelver |
780 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
781 |
self.addCleanup(creator.finalize) |
|
|
0.12.74
by Aaron Bentley
Update to use iter_shelvable |
782 |
list(creator.iter_shelvable()) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
783 |
creator.shelve_creation(b'foo-id') |
|
0.12.43
by Aaron Bentley
Make ShelfManager consume ShelfCreator and produce Unshelver |
784 |
shelf_manager = tree.get_shelf_manager() |
785 |
shelf_id = shelf_manager.shelve_changes(creator) |
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
786 |
self.assertPathDoesNotExist('tree/foo') |
|
0.12.43
by Aaron Bentley
Make ShelfManager consume ShelfCreator and produce Unshelver |
787 |
unshelver = shelf_manager.get_unshelver(shelf_id) |
|
4659.2.3
by Vincent Ladeuil
Cleanup more bzr-limbo-XXXXXX leaks in /tmp during selftest. |
788 |
self.addCleanup(unshelver.finalize) |
|
0.12.67
by Aaron Bentley
Update for new Unshelver API |
789 |
unshelver.make_merger().do_merge() |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
790 |
self.assertFileEqual(b'bar', 'tree/foo') |
|
0.16.112
by Aaron Bentley
Add tests |
791 |
|
792 |
def test_get_metadata(self): |
|
793 |
tree = self.make_branch_and_tree('.') |
|
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
794 |
tree.lock_tree_write() |
795 |
self.addCleanup(tree.unlock) |
|
|
0.16.112
by Aaron Bentley
Add tests |
796 |
creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
|
4595.13.2
by Alexander Belchenko
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006) |
797 |
self.addCleanup(creator.finalize) |
|
0.16.112
by Aaron Bentley
Add tests |
798 |
shelf_manager = tree.get_shelf_manager() |
799 |
shelf_id = shelf_manager.shelve_changes(creator, 'foo') |
|
800 |
metadata = shelf_manager.get_metadata(shelf_id) |
|
|
7045.3.1
by Jelmer Vernooij
Fix another ~500 tests. |
801 |
self.assertEqual('foo', metadata[b'message']) |
802 |
self.assertEqual(b'null:', metadata[b'revision_id']) |