~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-30 14:30:10 UTC
  • mfrom: (6615.3.7 merges)
  • mto: This revision was merged to the branch mainline in revision 6621.
  • Revision ID: v.ladeuil+lp@free.fr-20170130143010-p31t1ranfeqbaeki
Merge  2.7 into trunk including fix for bug #1657238

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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)
325
325
        inv = inventory.Inventory(root_id='someroot')
326
326
        inv.root.revision = 'therev'
327
327
        inv2 = inv.copy()
328
 
        self.assertEquals('someroot', inv2.root.file_id)
329
 
        self.assertEquals('therev', inv2.root.revision)
 
328
        self.assertEqual('someroot', inv2.root.file_id)
 
329
        self.assertEqual('therev', inv2.root.revision)
330
330
 
331
331
    def test_create_tree_reference(self):
332
332
        inv = inventory.Inventory('tree-root-123')
1101
1101
        delta = [("", None, base_inv.root.file_id, None),
1102
1102
            (None, "",  "myrootid", inv.root)]
1103
1103
        new_inv = base_inv.create_by_apply_delta(delta, "expectedid")
1104
 
        self.assertEquals(reference_inv.root, new_inv.root)
 
1104
        self.assertEqual(reference_inv.root, new_inv.root)
1105
1105
 
1106
1106
    def test_create_by_apply_delta_empty_add_child(self):
1107
1107
        inv = Inventory()
1552
1552
        repository = self.make_repository('.')
1553
1553
        tree = repository.revision_tree(revision.NULL_REVISION)
1554
1554
        inv = mutable_inventory_from_tree(tree)
1555
 
        self.assertEquals(revision.NULL_REVISION, inv.revision_id)
1556
 
        self.assertEquals(0, len(inv))
 
1555
        self.assertEqual(revision.NULL_REVISION, inv.revision_id)
 
1556
        self.assertEqual(0, len(inv))
1557
1557
 
1558
1558
    def test_some_files(self):
1559
1559
        wt = self.make_branch_and_tree('.')
1562
1562
        revid = wt.commit("commit")
1563
1563
        tree = wt.branch.repository.revision_tree(revid)
1564
1564
        inv = mutable_inventory_from_tree(tree)
1565
 
        self.assertEquals(revid, inv.revision_id)
1566
 
        self.assertEquals(2, len(inv))
1567
 
        self.assertEquals("a", inv['thefileid'].name)
 
1565
        self.assertEqual(revid, inv.revision_id)
 
1566
        self.assertEqual(2, len(inv))
 
1567
        self.assertEqual("a", inv['thefileid'].name)
1568
1568
        # The inventory should be mutable and independent of
1569
1569
        # the original tree
1570
 
        self.assertFalse(tree.inventory['thefileid'].executable)
 
1570
        self.assertFalse(tree.root_inventory['thefileid'].executable)
1571
1571
        inv['thefileid'].executable = True
1572
 
        self.assertFalse(tree.inventory['thefileid'].executable)
 
1572
        self.assertFalse(tree.root_inventory['thefileid'].executable)