~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Robert Collins
  • Date: 2005-11-07 20:29:51 UTC
  • mfrom: (1457.1.17)
  • Revision ID: robertc@robertcollins.net-20051107202951-6ae936c7a3e57f6f
Branch.commit() has moved to WorkingTree.commit(). (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        b2 = Branch.initialize('b2')
52
52
        file(os.sep.join(['b1', 'foo']), 'w').write('hello')
53
53
        b1.add(['foo'], ['foo-id'])
54
 
        b1.commit('lala!', rev_id='revision-1', allow_pointless=False)
 
54
        b1.working_tree().commit('lala!', rev_id='revision-1', allow_pointless=False)
55
55
 
56
56
        mutter('start fetch')
57
57
        f = Fetcher(from_branch=b1, to_branch=b2)
65
65
 
66
66
    def test_revision_tree(self):
67
67
        b1 = Branch.initialize('.')
68
 
        b1.commit('lala!', rev_id='revision-1', allow_pointless=True)
 
68
        b1.working_tree().commit('lala!', rev_id='revision-1', allow_pointless=True)
69
69
        tree = b1.revision_tree('revision-1')
70
70
        tree = b1.revision_tree(None)
71
71
        self.assertEqual(len(tree.list_files()), 0)
117
117
        self.build_tree(['a/', 'a/one'])
118
118
        br_a = Branch.initialize('a')
119
119
        br_a.add(['one'])
120
 
        br_a.commit('commit one', rev_id='u@d-1')
 
120
        br_a.working_tree().commit('commit one', rev_id='u@d-1')
121
121
        self.build_tree(['a/two'])
122
122
        br_a.add(['two'])
123
 
        br_a.commit('commit two', rev_id='u@d-2')
 
123
        br_a.working_tree().commit('commit two', rev_id='u@d-2')
124
124
        br_b = copy_branch(br_a, 'b', revision='u@d-1')
125
125
        self.assertEqual(br_b.last_revision(), 'u@d-1')
126
126
        self.assertTrue(os.path.exists('b/one'))
130
130
        """A pending merge with no revision present is still a merge."""
131
131
        branch = Branch.initialize('.')
132
132
        branch.working_tree().add_pending_merge('non:existent@rev--ision--0--2')
133
 
        branch.commit('pretend to merge nonexistent-revision', rev_id='first')
 
133
        branch.working_tree().commit('pretend to merge nonexistent-revision', rev_id='first')
134
134
        rev = branch.get_revision(branch.last_revision())
135
135
        self.assertEqual(len(rev.parent_ids), 1)
136
136
        # parent_sha1s is not populated now, WTF. rbc 20051003
159
159
        self.assertEquals(wt.pending_merges(),
160
160
                          ['foo@azkhazan-123123-abcabc',
161
161
                           'wibble@fofof--20050401--1928390812'])
162
 
        b.commit("commit from base with two merges")
 
162
        b.working_tree().commit("commit from base with two merges")
163
163
        rev = b.get_revision(b.revision_history()[0])
164
164
        self.assertEquals(len(rev.parent_ids), 2)
165
165
        self.assertEquals(rev.parent_ids[0],
171
171
 
172
172
    def test_sign_existing_revision(self):
173
173
        branch = Branch.initialize('.')
174
 
        branch.commit("base", allow_pointless=True, rev_id='A')
 
174
        branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
175
175
        from bzrlib.testament import Testament
176
176
        branch.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
177
177
        self.assertEqual(Testament.from_revision(branch, 'A').as_short_text(),