~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_inv.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:
19
19
 
20
20
import os
21
21
 
22
 
from bzrlib import inventory
 
22
from bzrlib import inventory, tests
23
23
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
24
24
 
25
25
 
151
151
        wt.apply_inventory_delta([('', None, root_id, None),
152
152
            (None, '', 'root-id',
153
153
             inventory.InventoryDirectory('root-id', '', None))])
 
154
 
 
155
 
 
156
class TestTreeReference(TestCaseWithWorkingTree):
 
157
 
 
158
    def test_tree_reference_matches_inv(self):
 
159
        base = self.make_branch_and_tree('base')
 
160
        if not base.supports_tree_reference():
 
161
            raise tests.TestNotApplicable("wt doesn't support nested trees")
 
162
        # We add it as a directory, but it becomes a tree-reference
 
163
        base.add(['subdir'], ['subdir-id'], ['directory'])
 
164
        subdir = self.make_branch_and_tree('base/subdir')
 
165
        self.addCleanup(base.lock_read().unlock)
 
166
        # Note: we aren't strict about ie.kind being 'directory' here, what we
 
167
        # are strict about is that wt.inventory should match
 
168
        # wt.current_dirstate()'s idea about what files are where.
 
169
        ie = base.inventory['subdir-id']
 
170
        self.assertEqual('directory', ie.kind)
 
171
        path, ie = base.iter_entries_by_dir(['subdir-id']).next()
 
172
        self.assertEqual('subdir', path)
 
173
        self.assertEqual('tree-reference', ie.kind)