1
# Copyright (C) 2005 by Canonical Ltd
2
# -*- coding: utf-8 -*-
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
"""Black-box tests for bzr merge.
25
from bzrlib.branch import Branch
26
from bzrlib.tests.blackbox import ExternalBase
27
from bzrlib.osutils import abspath
29
class TestMerge(ExternalBase):
31
def example_branch(test):
33
file('hello', 'wt').write('foo')
34
test.runbzr('add hello')
35
test.runbzr('commit -m setup hello')
36
file('goodbye', 'wt').write('baz')
37
test.runbzr('add goodbye')
38
test.runbzr('commit -m setup goodbye')
40
def test_merge_remember(self):
41
"""Merge changes from one branch to another and test parent location."""
46
self.runbzr('branch . ../b')
47
self.runbzr('branch . ../c')
48
file('bottles', 'wt').write('99 bottles of beer on the wall')
49
self.runbzr('add bottles')
50
self.runbzr('commit -m 99_bottles')
53
parent = b.get_parent()
55
self.assertEqual(None, b.get_parent())
56
out = self.runbzr('merge', retcode=3)
57
self.assertEquals(out,
58
('','bzr: ERROR: No merge branch known or specified.\n'))
59
self.runbzr('merge ../a')
60
self.assertEquals(abspath(b.get_parent()), abspath(parent))
61
self.runbzr('commit -m merge_a')
62
self.runbzr('merge ../c --remember')
63
self.assertEquals(abspath(b.get_parent()), abspath('../c'))
64
self.runbzr('commit -m merge_c --unchanged')