~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_changeset.py

  • Committer: Aaron Bentley
  • Date: 2006-05-15 14:16:44 UTC
  • mto: (1185.82.108 w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: abentley@panoramicfeedback.com-20060515141644-121f7718a83d0049
Switch to merge_changeset in test suite

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from StringIO import StringIO
18
18
 
 
19
from bzrlib.builtins import merge_changeset
19
20
from bzrlib.tests import TestCaseInTempDir, TestCase
20
21
from bzrlib.bzrdir import BzrDir
21
22
from bzrlib.errors import BzrError
24
25
from bzrlib.changeset.apply_changeset import install_changeset
25
26
from bzrlib.changeset.read_changeset import ChangesetTree, ChangesetReader
26
27
from bzrlib.changeset import serializer 
 
28
from bzrlib.merge import Merge3Merger
27
29
from bzrlib.workingtree import WorkingTree
28
30
 
29
31
class MockTree(object):
362
364
                    continue
363
365
                self.assertEqual(old_file.read(),
364
366
                                 new.get_file(inventory_id).read())
 
367
        if rev_id is not None:
 
368
            rh = self.b1.revision_history()
 
369
            tree.branch.set_revision_history(rh[:rh.index(rev_id)+1])
 
370
            tree.update()
365
371
        return tree
366
372
 
367
373
    def valid_apply_changeset(self, base_rev_id, cset,
379
385
            self.assert_(not repository.has_revision(rev.revision_id),
380
386
                'Revision {%s} present before applying changeset' 
381
387
                % rev.revision_id)
382
 
        auto_committed = _apply_cset(to_tree, cset, auto_commit=auto_commit)
 
388
        merge_changeset(cset[0], cset[1], to_tree, True, Merge3Merger, False, 
 
389
                        False)
383
390
 
384
391
        for rev in info.real_revisions:
385
392
            self.assert_(repository.has_revision(rev.revision_id),
389
396
        self.assert_(to_tree.branch.repository.has_revision(info.target))
390
397
        # Do we also want to verify that all the texts have been added?
391
398
 
392
 
 
393
 
        # Don't call get_valid_cset(auto_commit=True) unless you
394
 
        # expect the auto-commit to succeed.
395
 
        self.assertEqual(auto_commit, auto_committed)
396
 
 
397
 
        if auto_committed:
398
 
            # We might also check that all revisions are in the
399
 
            # history for some changeset applications which
400
 
            # merge multiple revisions.
401
 
            self.assertEqual(to_tree.branch.last_patch(), info.target)
402
 
        else:
403
 
            self.assert_(info.target in to_tree.pending_merges())
 
399
        self.assert_(info.target in to_tree.pending_merges())
404
400
 
405
401
 
406
402
        rev = info.real_revisions[-1]