~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testworkingtree.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:56:54 UTC
  • mfrom: (1185.16.59)
  • Revision ID: robertc@robertcollins.net-20051017115654-662239e1587524a8
mergeĀ fromĀ martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        tree = WorkingTree(branch.base)
80
80
        self.assertEqual('child',
81
81
                         tree.relpath(os.path.join(os.getcwd(), 'child')))
82
 
 
83
 
    def test_lock_locks_branch(self):
84
 
        branch = Branch.initialize('.')
85
 
        tree = WorkingTree(branch.base)
86
 
        tree.lock_read()
87
 
        self.assertEqual(1, tree.branch._lock_count)
88
 
        self.assertEqual('r', tree.branch._lock_mode)
89
 
        tree.unlock()
90
 
        self.assertEqual(None, tree.branch._lock_count)
91
 
        tree.lock_write()
92
 
        self.assertEqual(1, tree.branch._lock_count)
93
 
        self.assertEqual('w', tree.branch._lock_mode)
94
 
        tree.unlock()
95
 
        self.assertEqual(None, tree.branch._lock_count)
96
 
 
97
 
    def get_pullable_branches(self):
98
 
        self.build_tree(['from/', 'from/file', 'to/'])
99
 
        br_a = Branch.initialize('from')
100
 
        br_a.add('file')
101
 
        br_a.commit('foo', rev_id='A')
102
 
        br_b = Branch.initialize('to')
103
 
        return br_a, br_b
104
 
 
105
 
    def test_pull(self):
106
 
        br_a, br_b = self.get_pullable_branches()
107
 
        br_b.working_tree().pull(br_a)
108
 
        self.failUnless(br_b.has_revision('A'))
109
 
        self.assertEqual(['A'], br_b.revision_history())
110
 
 
111
 
    def test_pull_overwrites(self):
112
 
        br_a, br_b = self.get_pullable_branches()
113
 
        br_b.commit('foo', rev_id='B')
114
 
        self.assertEqual(['B'], br_b.revision_history())
115
 
        br_b.working_tree().pull(br_a, overwrite=True)
116
 
        self.failUnless(br_b.has_revision('A'))
117
 
        self.failUnless(br_b.has_revision('B'))
118
 
        self.assertEqual(['A'], br_b.revision_history())