~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib.branch import Branch
25
25
from bzrlib.bzrdir import BzrDir
 
26
from bzrlib.conflicts import ConflictList
 
27
from bzrlib.delta import compare_trees
26
28
from bzrlib.osutils import abspath
27
29
from bzrlib.tests.blackbox import ExternalBase
 
30
import bzrlib.urlutils as urlutils
28
31
from bzrlib.workingtree import WorkingTree
29
32
 
30
33
 
141
144
        os.chdir('branch_b')
142
145
        out = self.runbzr('merge', retcode=3)
143
146
        self.assertEquals(out,
144
 
                ('','bzr: ERROR: No merge branch known or specified.\n'))
 
147
                ('','bzr: ERROR: No location specified or remembered\n'))
145
148
        # test implicit --remember when no parent set, this merge conflicts
146
149
        self.build_tree(['d'])
147
150
        tree_b.add('d')
152
155
        # test implicit --remember after resolving conflict
153
156
        tree_b.commit('commit d')
154
157
        out, err = self.runbzr('merge')
155
 
        self.assertEquals(out, 'Using saved branch: ../branch_a\n')
 
158
        
 
159
        base = urlutils.local_path_from_url(branch_a.base)
 
160
        self.assertEquals(out, 'Merging from remembered location %s\n' % (base,))
156
161
        self.assertEquals(err, 'All changes applied successfully.\n')
157
162
        self.assertEquals(abspath(branch_b.get_parent()), abspath(parent))
158
163
        # re-open tree as external runbzr modified it
197
202
                                              tree_b.last_revision())
198
203
        self.assertEqualDiff(testament_a.as_text(),
199
204
                         testament_b.as_text())
 
205
        tree_a.set_conflicts(ConflictList())
 
206
        tree_a.commit('message')
 
207
        # it is legal to attempt to merge an already-merged bundle
 
208
        output = self.runbzr('merge ../bundle')[1]
 
209
        # but it does nothing
 
210
        self.assertFalse(compare_trees(tree_a.basis_tree(), 
 
211
                                       tree_a).has_changed())
 
212
        self.assertEqual('Nothing to do.\n', output)