1
# Copyright (C) 2006 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
20
from bzrlib.tests.blackbox import ExternalBase
22
class TestConflicts(ExternalBase):
24
super(ExternalBase, self).setUp()
31
file('myfile', 'wb').write('contentsa\n')
32
file('my_other_file', 'wb').write('contentsa\n')
34
self.runbzr('commit -m new')
36
self.runbzr('branch a b')
38
file('myfile', 'wb').write('contentsb\n')
39
file('my_other_file', 'wb').write('contentsb\n')
40
self.runbzr('commit -m change')
42
file('myfile', 'wb').write('contentsa2\n')
43
file('my_other_file', 'wb').write('contentsa2\n')
44
self.runbzr('commit -m change')
45
self.runbzr('merge ../b', retcode=1)
47
def test_conflicts(self):
48
conflicts = self.runbzr('conflicts', backtick=True)
49
self.assertEqual(len(conflicts.splitlines()), 2)
51
def test_resolve(self):
52
self.runbzr('resolve', retcode=3)
53
self.runbzr('resolve myfile')
54
conflicts = self.runbzr('conflicts', backtick=True)
55
self.assertEqual(len(conflicts.splitlines()), 1)
56
self.runbzr('resolve my_other_file')
57
conflicts = self.runbzr('conflicts', backtick=True)
58
self.assertEqual(len(conflicts.splitlines()), 0)
60
def test_resolve_all(self):
61
self.runbzr('resolve --all')
62
conflicts = self.runbzr('conflicts', backtick=True)
63
self.assertEqual(len(conflicts.splitlines()), 0)