~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_interbranch/test_pull.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for InterBranch.pull behaviour."""
18
18
 
 
19
import os
 
20
 
19
21
from bzrlib.branch import Branch
20
22
from bzrlib.bzrdir import BzrDir
21
23
from bzrlib import errors
40
42
        parent.merge_from_branch(mine.branch)
41
43
        parent.commit('merge my change', rev_id='P2')
42
44
        mine.pull(parent.branch)
43
 
        self.assertEqual('P2', mine.branch.last_revision())
 
45
        self.assertEqual(['P1', 'P2'], mine.branch.revision_history())
44
46
 
45
47
    def test_pull_merged_indirect(self):
46
48
        # it should be possible to do a pull from one branch into another
57
59
        parent.merge_from_branch(other.branch)
58
60
        parent.commit('merge other', rev_id='P2')
59
61
        mine.pull(parent.branch)
60
 
        self.assertEqual('P2', mine.branch.last_revision())
 
62
        self.assertEqual(['P1', 'P2'], mine.branch.revision_history())
61
63
 
62
64
    def test_pull_updates_checkout_and_master(self):
63
65
        """Pulling into a checkout updates the checkout and the master branch"""
68
70
        rev2 = other.commit('other commit')
69
71
        # now pull, which should update both checkout and master.
70
72
        checkout.branch.pull(other.branch)
71
 
        self.assertEqual(rev2, checkout.branch.last_revision())
72
 
        self.assertEqual(rev2, master_tree.branch.last_revision())
 
73
        self.assertEqual([rev1, rev2], checkout.branch.revision_history())
 
74
        self.assertEqual([rev1, rev2], master_tree.branch.revision_history())
73
75
 
74
76
    def test_pull_raises_specific_error_on_master_connection_error(self):
75
77
        master_tree = self.make_from_branch_and_tree('master')
77
79
        other = self.sprout_to(master_tree.branch.bzrdir, 'other').open_branch()
78
80
        # move the branch out of the way on disk to cause a connection
79
81
        # error.
80
 
        master_tree.branch.bzrdir.destroy_branch()
 
82
        os.rename('master', 'master_gone')
81
83
        # try to pull, which should raise a BoundBranchConnectionFailure.
82
84
        self.assertRaises(errors.BoundBranchConnectionFailure,
83
85
                checkout.branch.pull, other)
97
99
        self.assertEqual('P1', result.old_revid)
98
100
        self.assertEqual(2, result.new_revno)
99
101
        self.assertEqual('M1', result.new_revid)
100
 
        self.assertEqual([], result.tag_conflicts)
 
102
        self.assertEqual(None, result.tag_conflicts)
101
103
 
102
104
    def test_pull_overwrite(self):
103
105
        tree_a = self.make_from_branch_and_tree('tree_a')
110
112
                          tree_a.branch.pull, tree_b.branch,
111
113
                          overwrite=False, stop_revision='rev2b')
112
114
        # It should not have updated the branch tip, but it should have fetched
113
 
        # the revision if the repository supports "invisible" revisions.
 
115
        # the revision
114
116
        self.assertEqual('rev2a', tree_a.branch.last_revision())
115
 
        if tree_a.branch.repository._format.supports_unreferenced_revisions:
116
 
            self.assertTrue(tree_a.branch.repository.has_revision('rev2b'))
 
117
        self.assertTrue(tree_a.branch.repository.has_revision('rev2b'))
117
118
        tree_a.branch.pull(tree_b.branch, overwrite=True,
118
119
                           stop_revision='rev2b')
119
120
        self.assertEqual('rev2b', tree_a.branch.last_revision())
120
 
        self.assertEqual(tree_b.branch.last_revision(),
121
 
                         tree_a.branch.last_revision())
 
121
        self.assertEqual(tree_b.branch.revision_history(),
 
122
                         tree_a.branch.revision_history())
122
123
 
123
124
 
124
125
class TestPullHook(TestCaseWithInterBranch):