~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_diff.py

Move working tree initialisation out from  Branch.initialize, deprecated Branch.initialize to Branch.create.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        self.runbzr('diff')
53
53
 
54
54
    def test_diff_branches(self):
55
 
        self.build_tree(['branch1/', 'branch1/file', 'branch2/'], line_endings='binary')
56
 
        branch = Branch.initialize('branch1')
57
 
        branch.working_tree().add(['file'])
58
 
        branch.working_tree().commit('add file')
59
 
        copy_branch(branch, 'branch2')
 
55
        self.build_tree(['branch1/', 'branch1/file'], line_endings='binary')
 
56
        self.capture('init branch1')
 
57
        self.capture('add branch1/file')
 
58
        self.run_bzr_captured(['commit', '-m', 'add file', 'branch1'])
 
59
        self.capture('branch branch1 branch2')
60
60
        print >> open('branch2/file', 'wb'), 'new content'
61
 
        branch2 = Branch.open('branch2')
62
 
        branch2.working_tree().commit('update file')
 
61
        self.run_bzr_captured(['commit', '-m', 'update file', 'branch2'])
63
62
        # should open branch1 and diff against branch2, 
64
63
        output = self.run_bzr_captured(['diff', '-r', 'branch:branch2', 
65
64
                                        'branch1'],
83
82
 
84
83
    def test_diff_to_working_tree(self):
85
84
        self.build_tree(['branch1/', 'branch1/file1'], line_endings='binary')
86
 
        branch = Branch.initialize('branch1')
87
 
        branch.working_tree().add(['file1'])
 
85
        self.capture('init branch1')
 
86
        self.capture('add branch1/file1')
88
87
        print >> open('branch1/file1', 'wb'), 'original line'
89
 
        branch.working_tree().commit('first commit')
 
88
        self.run_bzr_captured(['commit', '-m', 'first commit', 'branch1'])
90
89
        
91
90
        print >> open('branch1/file1', 'wb'), 'repo line'
92
 
        branch.working_tree().commit('second commit')
 
91
        self.run_bzr_captured(['commit', '-m', 'second commit', 'branch1'])
93
92
        
94
93
        print >> open('branch1/file1', 'wb'), 'new line'
95
94
        output = self.run_bzr_captured(['diff', '-r', '1..', 'branch1'], retcode=1)