~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit_merge.py

  • Committer: abentley
  • Date: 2005-10-14 03:50:50 UTC
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1460.
  • Revision ID: abentley@lappy-20051014035050-d779472ccb599a51
semi-broke merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import os
19
19
import shutil
20
20
 
21
 
from bzrlib.tests import TestCaseInTempDir
 
21
from bzrlib.selftest import TestCaseInTempDir
22
22
from bzrlib.branch import Branch
23
23
from bzrlib.commit import commit
24
24
from bzrlib.errors import PointlessCommit, BzrError, PointlessCommit
25
 
from bzrlib.tests.test_revision import make_branches
 
25
from bzrlib.selftest.testrevision import make_branches
26
26
from bzrlib.fetch import fetch
27
27
from bzrlib.check import check
28
28
 
44
44
        commit(bx, 'commit one', rev_id='x@u-0-1', allow_pointless=True)
45
45
        commit(by, 'commit two', rev_id='y@u-0-1', allow_pointless=True)
46
46
 
47
 
        fetcher = fetch(from_branch=bx, to_branch=by)
48
 
        self.assertEqual(1, fetcher.count_copied)
49
 
        self.assertEqual([], fetcher.failed_revisions)
 
47
        fetch(from_branch=bx, to_branch=by)
50
48
        # just having the history there does nothing
51
49
        self.assertRaises(PointlessCommit,
52
50
                          commit,
53
51
                          by, 'no changes yet', rev_id='y@u-0-2',
54
52
                          allow_pointless=False)
55
 
        by.working_tree().add_pending_merge('x@u-0-1')
 
53
        by.add_pending_merge('x@u-0-1')
56
54
        commit(by, 'merge from x', rev_id='y@u-0-2', allow_pointless=False)
57
55
 
58
56
        self.assertEquals(by.revno(), 2)
62
60
        self.assertEquals(rev.parent_ids,
63
61
                          ['y@u-0-1', 'x@u-0-1'])
64
62
 
 
63
 
 
64
 
65
65
    def test_merge_new_file(self):
66
66
        """Commit merge of two trees with no overlapping files."""
67
67
        self.build_tree(['x/', 'x/ecks', 'y/', 'y/why'])
68
68
 
69
69
        bx = Branch.initialize('x')
70
70
        by = Branch.initialize('y')
71
 
        bx.working_tree().add(['ecks'], ['ecks-id'])
72
 
        by.working_tree().add(['why'], ['why-id'])
 
71
        bx.add(['ecks'], ['ecks-id'])
 
72
        by.add(['why'], ['why-id'])
73
73
 
74
74
        commit(bx, 'commit one', rev_id='x@u-0-1', allow_pointless=True)
75
75
        commit(by, 'commit two', rev_id='y@u-0-1', allow_pointless=True)
77
77
        fetch(from_branch=bx, to_branch=by)
78
78
        # we haven't merged the texts, but let's fake it
79
79
        shutil.copyfile('x/ecks', 'y/ecks')
80
 
        by.working_tree().add(['ecks'], ['ecks-id'])
81
 
        by.working_tree().add_pending_merge('x@u-0-1')
 
80
        by.add(['ecks'], ['ecks-id'])
 
81
        by.add_pending_merge('x@u-0-1')
82
82
 
83
83
        # partial commit of merges is currently not allowed, because
84
84
        # it would give different merge graphs for each file which