~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-24 12:50:51 UTC
  • mfrom: (6437.23.15 2.5)
  • mto: This revision was merged to the branch mainline in revision 6475.
  • Revision ID: v.ladeuil+lp@free.fr-20120224125051-i7p1xmjxw56jhmj3
Merge 2.5 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
    self.addCleanup(tree.unlock)
128
128
    if not invalid_delta:
129
129
        tree._validate()
130
 
    return tree.inventory
 
130
    return tree.root_inventory
131
131
 
132
132
 
133
133
def _create_repo_revisions(repo, basis, delta, invalid_delta):
224
224
    basis_tree = tree.basis_tree()
225
225
    basis_tree.lock_read()
226
226
    test.addCleanup(basis_tree.unlock)
227
 
    basis_inv = basis_tree.inventory
 
227
    basis_inv = basis_tree.root_inventory
228
228
    if target_entries:
229
229
        basis_entries = list(basis_inv.iter_entries_by_dir())
230
230
        test.assertEqual(target_entries, basis_entries)
1393
1393
        self.assertEqual([u'ch\xefld'],
1394
1394
                         sorted(ie_dir._children.keys()))
1395
1395
 
 
1396
    def test_filter_change_in_renamed_subfolder(self):
 
1397
        inv = Inventory('tree-root')
 
1398
        src_ie = inv.add_path('src', 'directory', 'src-id')
 
1399
        inv.add_path('src/sub/', 'directory', 'sub-id')
 
1400
        a_ie = inv.add_path('src/sub/a', 'file', 'a-id')
 
1401
        a_ie.text_sha1 = osutils.sha_string('content\n')
 
1402
        a_ie.text_size = len('content\n')
 
1403
        chk_bytes = self.get_chk_bytes()
 
1404
        inv = CHKInventory.from_inventory(chk_bytes, inv)
 
1405
        inv = inv.create_by_apply_delta([
 
1406
            ("src/sub/a", "src/sub/a", "a-id", a_ie),
 
1407
            ("src", "src2", "src-id", src_ie),
 
1408
            ], 'new-rev-2')
 
1409
        new_inv = inv.filter(['a-id', 'src-id'])
 
1410
        self.assertEqual([
 
1411
            ('', 'tree-root'),
 
1412
            ('src', 'src-id'),
 
1413
            ('src/sub', 'sub-id'),
 
1414
            ('src/sub/a', 'a-id'),
 
1415
            ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])
1396
1416
 
1397
1417
class TestCHKInventoryExpand(tests.TestCaseWithMemoryTransport):
1398
1418
 
1547
1567
        self.assertEquals("a", inv['thefileid'].name)
1548
1568
        # The inventory should be mutable and independent of
1549
1569
        # the original tree
1550
 
        self.assertFalse(tree.inventory['thefileid'].executable)
 
1570
        self.assertFalse(tree.root_inventory['thefileid'].executable)
1551
1571
        inv['thefileid'].executable = True
1552
 
        self.assertFalse(tree.inventory['thefileid'].executable)
 
1572
        self.assertFalse(tree.root_inventory['thefileid'].executable)