~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

  • Committer: Aaron Bentley
  • Date: 2008-10-26 21:10:55 UTC
  • mto: (0.15.36 unshelve)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081026211055-bjazoi748wsofa80
Replace ShelfCreator.__iter__ with ShelfCreator.iter_shelvable

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        tree.rename_one('foo', 'bar')
30
30
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
31
31
        self.addCleanup(creator.finalize)
32
 
        self.assertEqual([('rename', 'foo-id', 'foo', 'bar')], list(creator))
 
32
        self.assertEqual([('rename', 'foo-id', 'foo', 'bar')],
 
33
                          list(creator.iter_shelvable()))
33
34
        creator.shelve_rename('foo-id')
34
35
        work_trans_id = creator.work_transform.trans_id_file_id('foo-id')
35
36
        self.assertEqual('foo', creator.work_transform.final_name(
47
48
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
48
49
        self.addCleanup(creator.finalize)
49
50
        self.assertEqual([('rename', 'baz-id', 'foo/baz', 'bar/baz')],
50
 
                         list(creator))
 
51
                         list(creator.iter_shelvable()))
51
52
        creator.shelve_rename('baz-id')
52
53
        work_trans_id = creator.work_transform.trans_id_file_id('baz-id')
53
54
        work_foo = creator.work_transform.trans_id_file_id('foo-id')
75
76
        self.build_tree_contents([('foo', 'b\na\nc\n')])
76
77
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
77
78
        self.addCleanup(creator.finalize)
78
 
        self.assertEqual([('modify text', 'foo-id')], list(creator))
 
79
        self.assertEqual([('modify text', 'foo-id')],
 
80
                         list(creator.iter_shelvable()))
79
81
        creator.shelve_lines('foo-id', ['a\n', 'c\n'])
80
82
        creator.transform()
81
83
        self.assertFileEqual('a\nc\n', 'foo')
92
94
        self.addCleanup(creator.finalize)
93
95
        self.assertEqual([('add file', 'bar-id', 'directory', 'bar'),
94
96
                          ('add file', 'foo-id', 'file', 'foo')],
95
 
                          sorted(list(creator)))
 
97
                          sorted(list(creator.iter_shelvable())))
96
98
        creator.shelve_creation('foo-id')
97
99
        creator.shelve_creation('bar-id')
98
100
        creator.transform()
119
121
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
120
122
        self.addCleanup(creator.finalize)
121
123
        self.assertEqual([('add file', 'foo-id', 'symlink', 'foo')],
122
 
                         list(creator))
 
124
                         list(creator.iter_shelvable()))
123
125
        creator.shelve_creation('foo-id')
124
126
        creator.transform()
125
127
        s_trans_id = creator.shelf_transform.trans_id_file_id('foo-id')
138
140
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
139
141
        self.addCleanup(creator.finalize)
140
142
        self.assertEqual([('add file', 'foo-id', None, 'foo')],
141
 
                         sorted(list(creator)))
 
143
                         sorted(list(creator.iter_shelvable())))
142
144
        creator.shelve_creation('foo-id')
143
145
        creator.transform()
144
146
        self.assertRaises(StopIteration,
163
165
        self.addCleanup(creator.finalize)
164
166
        self.assertEqual([('delete file', 'bar-id', 'file', 'foo/bar'),
165
167
                          ('delete file', 'foo-id', 'directory', 'foo')],
166
 
                          sorted(list(creator)))
 
168
                          sorted(list(creator.iter_shelvable())))
167
169
        creator.shelve_deletion('foo-id')
168
170
        creator.shelve_deletion('bar-id')
169
171
        creator.transform()
180
182
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
181
183
        self.addCleanup(creator.finalize)
182
184
        self.assertEqual([('delete file', 'foo-id', 'file', 'foo')],
183
 
                         sorted(list(creator)))
 
185
                         sorted(list(creator.iter_shelvable())))
184
186
        creator.shelve_deletion('foo-id')
185
187
        creator.transform()
186
188
        self.failUnlessExists('tree/foo')
195
197
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
196
198
        self.addCleanup(creator.finalize)
197
199
        self.assertEqual([('change kind', 'foo-id', 'file', 'directory',
198
 
                           'foo')], sorted(list(creator)))
 
200
                           'foo')], sorted(list(creator.iter_shelvable())))
199
201
        creator.shelve_content_change('foo-id')
200
202
        creator.transform()
201
203
        self.assertFileEqual('bar', 'tree/foo')
212
214
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
213
215
        self.addCleanup(creator.finalize)
214
216
        self.assertEqual([('delete file', 'foo-id', 'file', 'foo')],
215
 
                         sorted(list(creator)))
 
217
                         sorted(list(creator.iter_shelvable())))
216
218
        creator.shelve_deletion('foo-id')
217
219
        creator.transform()
218
220
        self.failUnlessExists('tree/foo')
223
225
        tree.add('foo', 'foo-id')
224
226
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
225
227
        self.addCleanup(creator.finalize)
226
 
        list(creator)
 
228
        list(creator.iter_shelvable())
227
229
        creator.shelve_creation('foo-id')
228
230
        filename = creator.write_shelf()
229
231
        self.assertContainsRe(filename, 'tree/.shelf2/01$')