/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2011-06-02 07:25:33 UTC
  • mfrom: (5952 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5955.
  • Revision ID: andrew.bennetts@canonical.com-20110602072533-v0pe1ivh27cp0pd8
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 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
34
34
    urlutils,
35
35
    workingtree,
36
36
    )
 
37
from bzrlib.tests import script
37
38
 
38
39
 
39
40
class TestMerge(tests.TestCaseWithTransport):
352
353
        self.assertPathExists('file1')
353
354
        self.assertPathDoesNotExist('file2')
354
355
 
 
356
    def test_merge_nonexistent_file(self):
 
357
        """It should not be possible to merge changes from a file which
 
358
        does not exist."""
 
359
        tree_a = self.make_branch_and_tree('tree_a')
 
360
        self.build_tree_contents([('tree_a/file', 'bar\n')])
 
361
        tree_a.add(['file'])
 
362
        tree_a.commit('commit 1')
 
363
        os.chdir('tree_a')
 
364
        self.run_bzr_error(('Path\(s\) do not exist: non/existing',),
 
365
                           ['merge', 'non/existing'])
 
366
 
355
367
    def pullable_branch(self):
356
368
        tree_a = self.make_branch_and_tree('a')
357
369
        self.build_tree_contents([('a/file', 'bar\n')])
533
545
 
534
546
    def test_merge_from_submit(self):
535
547
        tree_a = self.make_branch_and_tree('a')
 
548
        tree_a.commit('test')
536
549
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
537
550
        tree_c = tree_a.bzrdir.sprout('c').open_workingtree()
538
551
        out, err = self.run_bzr(['merge', '-d', 'c'])
543
556
 
544
557
    def test_remember_sets_submit(self):
545
558
        tree_a = self.make_branch_and_tree('a')
 
559
        tree_a.commit('rev1')
546
560
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
547
561
        self.assertIs(tree_b.branch.get_submit_branch(), None)
548
562
 
557
571
 
558
572
    def test_no_remember_dont_set_submit(self):
559
573
        tree_a = self.make_branch_and_tree('a')
 
574
        self.build_tree_contents([('a/file', "a\n")])
 
575
        tree_a.add('file')
 
576
        tree_a.commit('rev1')
560
577
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
561
578
        self.assertIs(tree_b.branch.get_submit_branch(), None)
562
579
 
638
655
 
639
656
    def test_merge_interactive_unlocks_branch(self):
640
657
        this = self.make_branch_and_tree('this')
641
 
        other = self.make_branch_and_tree('other')
642
 
        other.commit('empty commit')
 
658
        this.commit('empty commit')
 
659
        other = this.bzrdir.sprout('other').open_workingtree()
 
660
        other.commit('empty commit 2')
643
661
        self.run_bzr('merge -i -d this other')
644
662
        this.lock_write()
645
663
        this.unlock()
677
695
        self.assertEqual('rev-2a', target.tags.lookup_tag('tag-a'))
678
696
        target.repository.get_revision('rev-2a')
679
697
 
 
698
class TestMergeScript(script.TestCaseWithTransportAndScript):
 
699
    def test_merge_empty_branch(self):
 
700
        source = self.make_branch_and_tree('source')
 
701
        self.build_tree(['source/a'])
 
702
        source.add('a')
 
703
        source.commit('Added a', rev_id='rev1')
 
704
        target = self.make_branch_and_tree('target')
 
705
        self.run_script("""\
 
706
$ bzr merge -d target source
 
707
2>bzr: ERROR: Merging into empty branches not currently supported, https://bugs.launchpad.net/bzr/+bug/308562
 
708
""")
680
709
 
681
710
class TestMergeForce(tests.TestCaseWithTransport):
682
711