~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

Merge bzr.dev and fully converted uses of new parents api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.bundle.serializer import write_bundle, read_bundle
28
28
from bzrlib.branch import Branch
29
29
from bzrlib.diff import internal_diff
30
 
from bzrlib.errors import BzrError, TestamentMismatch, NotABundle, BadBundle
 
30
from bzrlib.errors import (BzrError, TestamentMismatch, NotABundle, BadBundle, 
 
31
                           NoSuchFile,)
31
32
from bzrlib.merge import Merge3Merger
32
33
from bzrlib.osutils import has_symlinks, sha_file
33
34
from bzrlib.tests import (TestCaseInTempDir, TestCaseWithTransport,
38
39
 
39
40
class MockTree(object):
40
41
    def __init__(self):
41
 
        from bzrlib.inventory import RootEntry, ROOT_ID
 
42
        from bzrlib.inventory import InventoryDirectory, ROOT_ID
42
43
        object.__init__(self)
43
44
        self.paths = {ROOT_ID: ""}
44
45
        self.ids = {"": ROOT_ID}
45
46
        self.contents = {}
46
 
        self.root = RootEntry(ROOT_ID)
 
47
        self.root = InventoryDirectory(ROOT_ID, '', None)
47
48
 
48
49
    inventory = property(lambda x:x)
49
50
 
411
412
            for inventory_id in old:
412
413
                try:
413
414
                    old_file = old.get_file(inventory_id)
414
 
                except:
 
415
                except NoSuchFile:
415
416
                    continue
416
417
                if old_file is None:
417
418
                    continue
433
434
        to_tree = self.get_checkout(base_rev_id, checkout_dir=checkout_dir)
434
435
        original_parents = to_tree.get_parent_ids()
435
436
        repository = to_tree.branch.repository
 
437
        original_parents = to_tree.get_parent_ids()
436
438
        self.assertIs(repository.has_revision(base_rev_id), True)
437
439
        for rev in info.real_revisions:
438
440
            self.assert_(not repository.has_revision(rev.revision_id),
447
449
 
448
450
        self.assert_(to_tree.branch.repository.has_revision(info.target))
449
451
        # Do we also want to verify that all the texts have been added?
450
 
        
 
452
 
451
453
        self.assertEqual(original_parents + [info.target],
452
454
            to_tree.get_parent_ids())
453
455
 
800
802
        self.assertEqual(19800, rev.timezone)
801
803
        self.assertEqual(1152544886.0, rev.timestamp)
802
804
 
 
805
    def test_bundle_root_id(self):
 
806
        self.tree1 = self.make_branch_and_tree('b1')
 
807
        self.b1 = self.tree1.branch
 
808
        self.tree1.commit('message', rev_id='revid1')
 
809
        bundle = self.get_valid_bundle(None, 'revid1')
 
810
        tree = bundle.revision_tree(self.b1.repository, 'revid1')
 
811
        self.assertEqual('revid1', tree.inventory.root.revision)
 
812
 
803
813
 
804
814
class MungedBundleTester(TestCaseWithTransport):
805
815