~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-05 13:02:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6434.
  • Revision ID: v.ladeuil+lp@free.fr-20120105130231-grtl31ovy72doqp9
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2012 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
83
83
        tip = wt1.commit('empty commit')
84
84
        wt2 = self.make_branch_and_tree('branch2')
85
85
        wt2.pull(wt1.branch)
86
 
        file('branch1/foo', 'wb').write('foo')
87
 
        file('branch1/bar', 'wb').write('bar')
 
86
        with file('branch1/foo', 'wb') as f:
 
87
            f.write('foo')
 
88
        with file('branch1/bar', 'wb') as f:
 
89
            f.write('bar')
88
90
        wt1.add('foo')
89
91
        wt1.add('bar')
90
92
        wt1.commit('add foobar')
91
 
        os.chdir('branch2')
92
 
        self.run_bzr('merge ../branch1/baz', retcode=3)
93
 
        self.run_bzr('merge ../branch1/foo')
94
 
        self.assertPathExists('foo')
95
 
        self.assertPathDoesNotExist('bar')
96
 
        wt2 = WorkingTree.open('.') # opens branch2
 
93
        self.run_bzr('merge ../branch1/baz', retcode=3, working_dir='branch2')
 
94
        self.run_bzr('merge ../branch1/foo', working_dir='branch2')
 
95
        self.assertPathExists('branch2/foo')
 
96
        self.assertPathDoesNotExist('branch2/bar')
 
97
        wt2 = WorkingTree.open('branch2')
97
98
        self.assertEqual([tip], wt2.get_parent_ids())
98
99
 
99
100
    def test_pending_with_null(self):