~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
#
17
17
# Author: Aaron Bentley <aaron.bentley@utoronto.ca>
18
18
 
236
236
        out = self.run_bzr('merge', retcode=3)
237
237
        self.assertEquals(out,
238
238
                ('','bzr: ERROR: No location specified or remembered\n'))
239
 
 
240
 
        # test uncommitted changes
 
239
        # test implicit --remember when no parent set, this merge conflicts
241
240
        self.build_tree(['d'])
242
241
        tree_b.add('d')
243
242
        self.run_bzr_error(['Working tree ".*" has uncommitted changes'],
244
 
                           'merge')
245
 
 
246
 
        # merge should now pass and implicitly remember merge location
 
243
                           'merge ../branch_a')
 
244
        self.assertEquals(abspath(branch_b.get_submit_branch()),
 
245
                          abspath(parent))
 
246
        # test implicit --remember after resolving conflict
247
247
        tree_b.commit('commit d')
248
 
        out, err = self.run_bzr('merge ../branch_a')
 
248
        out, err = self.run_bzr('merge')
249
249
 
250
250
        base = urlutils.local_path_from_url(branch_a.base)
251
 
        self.assertEndsWith(err, '+N  b\nAll changes applied successfully.\n')
252
 
        self.assertEquals(abspath(branch_b.get_submit_branch()),
253
 
                          abspath(parent))
254
 
        # test implicit --remember when committing new file
255
 
        self.build_tree(['e'])
256
 
        tree_b.add('e')
257
 
        tree_b.commit('commit e')
258
 
        out, err = self.run_bzr('merge')
259
251
        self.assertStartsWith(err,
260
252
                          'Merging from remembered submit location %s\n' % (base,))
 
253
        self.assertEndsWith(err, '+N  b\nAll changes applied successfully.\n')
 
254
        self.assertEquals(abspath(branch_b.get_submit_branch()),
 
255
                          abspath(parent))
261
256
        # re-open tree as external run_bzr modified it
262
257
        tree_b = branch_b.bzrdir.open_workingtree()
263
258
        tree_b.commit('merge branch_a')
491
486
        out, err = self.run_bzr(['merge', '-d', 'a', 'b'])
492
487
        self.assertContainsRe(err, 'Warning: criss-cross merge encountered.')
493
488
 
494
 
    def test_merge_force(self):
495
 
        tree_a = self.make_branch_and_tree('a')
496
 
        self.build_tree(['a/foo'])
497
 
        tree_a.add(['foo'])
498
 
        tree_a.commit('add file')
499
 
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
500
 
        self.build_tree_contents([('a/foo', 'change 1')])
501
 
        tree_a.commit('change file')
502
 
        tree_b.merge_from_branch(tree_a.branch)
503
 
        tree_a.commit('empty change to allow merge to run')
504
 
        self.run_bzr(['merge', '../a', '--force'], working_dir='b')
505
 
 
506
489
    def test_merge_from_submit(self):
507
490
        tree_a = self.make_branch_and_tree('a')
508
491
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()