~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: INADA Naoki
  • Date: 2011-05-17 00:45:09 UTC
  • mfrom: (5875 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5891.
  • Revision ID: songofacandy@gmail.com-20110517004509-q58negjbdjh7t6u1
mergeĀ fromĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
                workingtree.WorkingTreeFormat.get_formats))
237
237
 
238
238
 
 
239
class TestWorkingTreeIterEntriesByDir_wSubtrees(TestCaseWithTransport):
 
240
 
 
241
    def make_simple_tree(self):
 
242
        tree = self.make_branch_and_tree('tree', format='development-subtree')
 
243
        self.build_tree(['tree/a/', 'tree/a/b/', 'tree/a/b/c'])
 
244
        tree.set_root_id('root-id')
 
245
        tree.add(['a', 'a/b', 'a/b/c'], ['a-id', 'b-id', 'c-id'])
 
246
        tree.commit('initial')
 
247
        return tree
 
248
 
 
249
    def test_just_directory(self):
 
250
        tree = self.make_simple_tree()
 
251
        self.assertEqual([('directory', 'root-id'),
 
252
                          ('directory', 'a-id'),
 
253
                          ('directory', 'b-id'),
 
254
                          ('file', 'c-id')],
 
255
                         [(ie.kind, ie.file_id)
 
256
                          for path, ie in tree.iter_entries_by_dir()])
 
257
        subtree = self.make_branch_and_tree('tree/a/b')
 
258
        self.assertEqual([('tree-reference', 'b-id')],
 
259
                         [(ie.kind, ie.file_id)
 
260
                          for path, ie in tree.iter_entries_by_dir(['b-id'])])
 
261
 
 
262
    def test_direct_subtree(self):
 
263
        tree = self.make_simple_tree()
 
264
        subtree = self.make_branch_and_tree('tree/a/b')
 
265
        self.assertEqual([('directory', 'root-id'),
 
266
                          ('directory', 'a-id'),
 
267
                          ('tree-reference', 'b-id')],
 
268
                         [(ie.kind, ie.file_id)
 
269
                          for path, ie in tree.iter_entries_by_dir()])
 
270
 
 
271
    def test_indirect_subtree(self):
 
272
        tree = self.make_simple_tree()
 
273
        subtree = self.make_branch_and_tree('tree/a')
 
274
        self.assertEqual([('directory', 'root-id'),
 
275
                          ('tree-reference', 'a-id')],
 
276
                         [(ie.kind, ie.file_id)
 
277
                          for path, ie in tree.iter_entries_by_dir()])
 
278
 
 
279
 
239
280
class TestWorkingTreeFormatRegistry(TestCase):
240
281
 
241
282
    def setUp(self):