~bzr-pqm/bzr/bzr.dev

4988.10.5 by John Arbash Meinel
Merge bzr.dev 5021 to resolve NEWS
1
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
2
#
1551.2.17 by Aaron Bentley
Fixed conflict commands
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
7
#
1551.2.17 by Aaron Bentley
Fixed conflict commands
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
12
#
1551.2.17 by Aaron Bentley
Fixed conflict commands
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1551.2.17 by Aaron Bentley
Fixed conflict commands
16
2120.7.3 by Aaron Bentley
Update resolve command to automatically mark conflicts as resolved
17
from bzrlib import (
4597.3.20 by Vincent Ladeuil
Fix imports in bzrlib/tests/blackbox/test_conflicts.py.
18
    conflicts,
19
    tests,
20
    workingtree,
2120.7.3 by Aaron Bentley
Update resolve command to automatically mark conflicts as resolved
21
    )
5050.51.1 by Vincent Ladeuil
Don't crash when --take-other (or --take-this) is called for a text conflict
22
from bzrlib.tests import script
23
4597.9.19 by Vincent Ladeuil
resolve now reports conflicts resolved/remaining.
24
def make_tree_with_conflicts(test, this_path='this', other_path='other'):
25
    this_tree = test.make_branch_and_tree(this_path)
26
    test.build_tree_contents([
27
        ('%s/myfile' % (this_path,), 'this content\n'),
28
        ('%s/my_other_file' % (this_path,), 'this content\n'),
29
        ('%s/mydir/' % (this_path,),),
30
        ])
31
    this_tree.add('myfile')
32
    this_tree.add('my_other_file')
33
    this_tree.add('mydir')
34
    this_tree.commit(message="new")
35
    other_tree = this_tree.bzrdir.sprout(other_path).open_workingtree()
36
    test.build_tree_contents([
37
        ('%s/myfile' % (other_path,), 'contentsb\n'),
38
        ('%s/my_other_file' % (other_path,), 'contentsb\n'),
39
        ])
40
    other_tree.rename_one('mydir', 'mydir2')
41
    other_tree.commit(message="change")
42
    test.build_tree_contents([
43
        ('%s/myfile' % (this_path,), 'contentsa2\n'),
44
        ('%s/my_other_file' % (this_path,), 'contentsa2\n'),
45
        ])
46
    this_tree.rename_one('mydir', 'mydir3')
47
    this_tree.commit(message='change')
48
    this_tree.merge_from_branch(other_tree.branch)
49
    return this_tree, other_tree
50
1551.2.17 by Aaron Bentley
Fixed conflict commands
51
4597.9.20 by Vincent Ladeuil
Restore the modification lost in the loom pull :-/
52
class TestConflicts(script.TestCaseWithTransportAndScript):
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
53
1551.2.17 by Aaron Bentley
Fixed conflict commands
54
    def setUp(self):
4597.9.20 by Vincent Ladeuil
Restore the modification lost in the loom pull :-/
55
        super(TestConflicts, self).setUp()
56
        make_tree_with_conflicts(self, 'branch', 'other')
4597.3.21 by Vincent Ladeuil
Cleanup test classes.
57
1551.2.17 by Aaron Bentley
Fixed conflict commands
58
    def test_conflicts(self):
4597.9.20 by Vincent Ladeuil
Restore the modification lost in the loom pull :-/
59
        self.run_script("""\
60
$ cd branch
61
$ bzr conflicts
62
Text conflict in my_other_file
63
Path conflict: mydir3 / mydir2
64
Text conflict in myfile
65
""")
1551.9.8 by Aaron Bentley
Add --text parameter to conflicts
66
67
    def test_conflicts_text(self):
4597.9.20 by Vincent Ladeuil
Restore the modification lost in the loom pull :-/
68
        self.run_script("""\
69
$ cd branch
70
$ bzr conflicts --text
71
my_other_file
72
myfile
73
""")
1551.2.17 by Aaron Bentley
Fixed conflict commands
74
5171.3.13 by Martin von Gagern
Add --directory option to 7 more commands.
75
    def test_conflicts_directory(self):
4597.9.20 by Vincent Ladeuil
Restore the modification lost in the loom pull :-/
76
        self.run_script("""\
77
$ bzr conflicts  -d branch
78
Text conflict in my_other_file
79
Path conflict: mydir3 / mydir2
80
Text conflict in myfile
81
""")