~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-03-06 11:20:10 UTC
  • mfrom: (1593 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060306112010-17c0170dde5d1eea
[merge] large merge to sync with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 by Canonical Ltd
 
2
# -*- coding: utf-8 -*-
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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
 
17
 
 
18
import os
 
19
 
 
20
from bzrlib.tests.blackbox import ExternalBase
 
21
 
 
22
class TestConflicts(ExternalBase):
 
23
    def setUp(self):
 
24
        super(ExternalBase, self).setUp()
 
25
        try:
 
26
            os.mkdir('a')
 
27
        except:
 
28
            raise os.getcwd()
 
29
        os.chdir('a')
 
30
        self.runbzr('init')
 
31
        file('myfile', 'wb').write('contentsa\n')
 
32
        file('my_other_file', 'wb').write('contentsa\n')
 
33
        self.runbzr('add')
 
34
        self.runbzr('commit -m new')
 
35
        os.chdir('..')
 
36
        self.runbzr('branch a b')
 
37
        os.chdir('b')
 
38
        file('myfile', 'wb').write('contentsb\n')
 
39
        file('my_other_file', 'wb').write('contentsb\n')
 
40
        self.runbzr('commit -m change')
 
41
        os.chdir('../a')
 
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)
 
46
 
 
47
    def test_conflicts(self):
 
48
        conflicts = self.runbzr('conflicts', backtick=True)
 
49
        self.assertEqual(len(conflicts.splitlines()), 2)
 
50
 
 
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)
 
59
 
 
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)
 
64