~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 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
26
26
 
27
27
from bzrlib import (
28
28
    branch,
29
 
    bzrdir,
30
29
    conflicts,
 
30
    controldir,
31
31
    merge_directive,
32
32
    osutils,
33
33
    tests,
75
75
        return tree, other
76
76
 
77
77
    def test_merge_reprocess(self):
78
 
        d = bzrdir.BzrDir.create_standalone_workingtree('.')
 
78
        d = controldir.ControlDir.create_standalone_workingtree('.')
79
79
        d.commit('h')
80
80
        self.run_bzr('merge . --reprocess --merge-type weave')
81
81
 
122
122
        self.assertTrue("Not a branch" in err)
123
123
        self.run_bzr('merge -r revno:%d:./..revno:%d:../b'
124
124
                    %(ancestor,b.revno()), working_dir='a')
125
 
        self.assertEquals(a.get_parent_ids(),
 
125
        self.assertEqual(a.get_parent_ids(),
126
126
                          [a.branch.last_revision(), b.last_revision()])
127
127
        self.check_file_contents('a/goodbye', 'quux')
128
128
        a_tree.revert(backups=False)
129
129
        self.run_bzr('merge -r revno:%d:../b'%b.revno(), working_dir='a')
130
 
        self.assertEquals(a.get_parent_ids(),
 
130
        self.assertEqual(a.get_parent_ids(),
131
131
                          [a.branch.last_revision(), b.last_revision()])
132
132
        a_tip = a.commit('merged')
133
133
        self.run_bzr('merge ../b -r last:1', working_dir='a')
263
263
        self.assertEqual(None, branch_b.get_parent())
264
264
        # test merge for failure without parent set
265
265
        out = self.run_bzr('merge', retcode=3, working_dir='branch_b')
266
 
        self.assertEquals(out,
 
266
        self.assertEqual(out,
267
267
                ('','bzr: ERROR: No location specified or remembered\n'))
268
268
 
269
269
        # test uncommitted changes
278
278
 
279
279
        base = urlutils.local_path_from_url(branch_a.base)
280
280
        self.assertEndsWith(err, '+N  b\nAll changes applied successfully.\n')
281
 
        self.assertEquals(osutils.abspath(branch_b.get_submit_branch()),
 
281
        # re-open branch as external run_bzr modified it
 
282
        branch_b = branch_b.bzrdir.open_branch()
 
283
        self.assertEqual(osutils.abspath(branch_b.get_submit_branch()),
282
284
                          osutils.abspath(parent))
283
285
        # test implicit --remember when committing new file
284
286
        self.build_tree(['branch_b/e'])
293
295
        # test explicit --remember
294
296
        out, err = self.run_bzr('merge ../branch_c --remember',
295
297
                                working_dir='branch_b')
296
 
        self.assertEquals(out, '')
297
 
        self.assertEquals(err, '+N  c\nAll changes applied successfully.\n')
298
 
        self.assertEquals(osutils.abspath(branch_b.get_submit_branch()),
 
298
        self.assertEqual(out, '')
 
299
        self.assertEqual(err, '+N  c\nAll changes applied successfully.\n')
 
300
        # re-open branch as external run_bzr modified it
 
301
        branch_b = branch_b.bzrdir.open_branch()
 
302
        self.assertEqual(osutils.abspath(branch_b.get_submit_branch()),
299
303
                          osutils.abspath(branch_c.bzrdir.root_transport.base))
300
304
        # re-open tree as external run_bzr modified it
301
305
        tree_b = branch_b.bzrdir.open_workingtree()
553
557
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
554
558
        tree_c = tree_a.bzrdir.sprout('c').open_workingtree()
555
559
        out, err = self.run_bzr(['merge', '-d', 'c'])
556
 
        self.assertContainsRe(err, 'Merging from remembered parent location .*a\/')
557
 
        tree_c.branch.set_submit_branch(tree_b.bzrdir.root_transport.base)
 
560
        self.assertContainsRe(err,
 
561
                              'Merging from remembered parent location .*a\/')
 
562
        tree_c.branch.lock_write()
 
563
        try:
 
564
            tree_c.branch.set_submit_branch(tree_b.bzrdir.root_transport.base)
 
565
        finally:
 
566
            tree_c.branch.unlock()
558
567
        out, err = self.run_bzr(['merge', '-d', 'c'])
559
 
        self.assertContainsRe(err, 'Merging from remembered submit location .*b\/')
 
568
        self.assertContainsRe(err,
 
569
                              'Merging from remembered submit location .*b\/')
560
570
 
561
571
    def test_remember_sets_submit(self):
562
572
        tree_a = self.make_branch_and_tree('a')
566
576
 
567
577
        # Remember should not happen if using default from parent
568
578
        out, err = self.run_bzr(['merge', '-d', 'b'])
569
 
        self.assertIs(tree_b.branch.get_submit_branch(), None)
 
579
        refreshed = workingtree.WorkingTree.open('b')
 
580
        self.assertIs(refreshed.branch.get_submit_branch(), None)
570
581
 
571
582
        # Remember should happen if user supplies location
572
583
        out, err = self.run_bzr(['merge', '-d', 'b', 'a'])
573
 
        self.assertEqual(tree_b.branch.get_submit_branch(),
 
584
        refreshed = workingtree.WorkingTree.open('b')
 
585
        self.assertEqual(refreshed.branch.get_submit_branch(),
574
586
                         tree_a.bzrdir.root_transport.base)
575
587
 
576
588
    def test_no_remember_dont_set_submit(self):
583
595
 
584
596
        # Remember should not happen if using default from parent
585
597
        out, err = self.run_bzr(['merge', '-d', 'b', '--no-remember'])
586
 
        self.assertEquals(None, tree_b.branch.get_submit_branch())
 
598
        self.assertEqual(None, tree_b.branch.get_submit_branch())
587
599
 
588
600
        # Remember should not happen if user supplies location but ask for not
589
601
        # remembering it