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