~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/changeset/old_tests.py

  • Committer: Aaron Bentley
  • Date: 2006-05-12 05:06:27 UTC
  • mto: (1185.82.108 w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: aaron.bentley@utoronto.ca-20060512050627-577a244f0cf0fb4d
More API updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib.diff import internal_diff
23
23
from bzrlib.changeset.read_changeset import ChangesetTree
 
24
from bzrlib.workingtree import WorkingTree
24
25
 
25
26
class MockTree(object):
26
27
    def __init__(self):
316
317
            # since it computes the sha1 hash for the revision, which
317
318
            # only will match if everything is okay, but lets be
318
319
            # explicit about it
319
 
            branch_rev = self.b1.get_revision(cset_rev.revision_id)
 
320
            branch_rev = self.b1.repository.get_revision(cset_rev.revision_id)
320
321
            for a in ('inventory_sha1', 'revision_id', 'parent_ids'
321
322
                    , 'timestamp', 'timezone', 'message', 'committer'):
322
323
                self.assertEqual(getattr(branch_rev, a), getattr(cset_rev, a))
330
331
    def get_checkout(self, rev_id, checkout_dir=None):
331
332
        """Get a new tree, with the specified revision in it.
332
333
        """
333
 
        from bzrlib.clone import copy_branch
334
334
        from bzrlib.branch import Branch
335
335
        import tempfile
336
336
 
340
340
            import os
341
341
            if not os.path.exists(checkout_dir):
342
342
                os.mkdir(checkout_dir)
343
 
        copy_branch(self.b1, checkout_dir, None)
344
 
        return Branch.open(checkout_dir)
 
343
        self.tree1.bzrdir.clone(checkout_dir)
 
344
        return WorkingTree.open(checkout_dir)
345
345
 
346
346
    def valid_apply_changeset(self, base_rev_id, cset,
347
347
            auto_commit=False, checkout_dir=None):
348
348
        """Get the base revision, apply the changes, and make
349
349
        sure everything matches the builtin branch.
350
350
        """
351
 
        from apply_changeset import _apply_cset
 
351
        from bzrlib.changeset.apply_changeset import _apply_cset
352
352
 
353
 
        to_branch = self.get_checkout(base_rev_id, checkout_dir=checkout_dir)
354
 
        auto_committed = _apply_cset(to_branch, cset, auto_commit=auto_commit)
 
353
        to_tree = self.get_checkout(base_rev_id, checkout_dir=checkout_dir)
 
354
        auto_committed = _apply_cset(to_tree, cset, auto_commit=auto_commit)
355
355
 
356
356
        info = cset[0]
 
357
        repository = to_tree.branch.repository
357
358
        for rev in info.real_revisions:
358
 
            self.assert_(rev.revision_id in to_branch.revision_store,
 
359
            self.assert_(repository.has_revision(rev.revision_id),
359
360
                'Missing revision {%s} after applying changeset' 
360
361
                % rev.revision_id)
361
362
 
362
 
        self.assert_(to_branch.has_revision(info.target))
 
363
        self.assert_(to_tree.branch.repository.has_revision(info.target))
363
364
        # Do we also want to verify that all the texts have been added?
364
365
 
365
366
 
371
372
            # We might also check that all revisions are in the
372
373
            # history for some changeset applications which
373
374
            # merge multiple revisions.
374
 
            self.assertEqual(to_branch.last_patch(), info.target)
 
375
            self.assertEqual(to_tree.branch.last_patch(), info.target)
375
376
        else:
376
 
            self.assert_(info.target in to_branch.pending_merges())
 
377
            self.assert_(info.target in to_tree.pending_merges())
377
378
 
378
379
 
379
380
        rev = info.real_revisions[-1]
380
 
        base_tree = self.b1.revision_tree(rev.revision_id)
381
 
        to_tree = to_branch.revision_tree(rev.revision_id)
 
381
        base_tree = self.b1.repository.revision_tree(rev.revision_id)
 
382
        to_tree = to_tree.branch.repository.revision_tree(rev.revision_id)
382
383
        
383
384
        # TODO: make sure the target tree is identical to base tree
384
385
        #       we might also check the working tree.