bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5557.1.7
by John Arbash Meinel
Merge in the bzr.dev 5582 |
1 |
# Copyright (C) 2010, 2011 Canonical Ltd
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
2 |
#
|
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.
|
|
7 |
#
|
|
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.
|
|
12 |
#
|
|
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
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
17 |
from breezy import ( |
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
18 |
conflicts, |
19 |
tests, |
|
20 |
)
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
21 |
from breezy.tests import script |
22 |
from breezy.tests.blackbox import test_conflicts |
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
23 |
|
24 |
||
25 |
class TestResolve(script.TestCaseWithTransportAndScript): |
|
26 |
||
27 |
def setUp(self): |
|
28 |
super(TestResolve, self).setUp() |
|
29 |
test_conflicts.make_tree_with_conflicts(self, 'branch', 'other') |
|
30 |
||
31 |
def test_resolve_one_by_one(self): |
|
32 |
self.run_script("""\ |
|
33 |
$ cd branch
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
34 |
$ brz conflicts
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
35 |
Text conflict in my_other_file
|
36 |
Path conflict: mydir3 / mydir2
|
|
37 |
Text conflict in myfile
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
38 |
$ brz resolve myfile
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
39 |
2>1 conflict resolved, 2 remaining
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
40 |
$ brz resolve my_other_file
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
41 |
2>1 conflict resolved, 1 remaining
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
42 |
$ brz resolve mydir2
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
43 |
2>1 conflict resolved, 0 remaining
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
44 |
""") |
45 |
||
46 |
def test_resolve_all(self): |
|
47 |
self.run_script("""\ |
|
48 |
$ cd branch
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
49 |
$ brz resolve --all
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
50 |
2>3 conflicts resolved, 0 remaining
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
51 |
$ brz conflicts
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
52 |
""") |
53 |
||
54 |
def test_resolve_from_subdir(self): |
|
55 |
self.run_script("""\ |
|
56 |
$ mkdir branch/subdir
|
|
57 |
$ cd branch/subdir
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
58 |
$ brz resolve ../myfile
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
59 |
2>1 conflict resolved, 2 remaining
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
60 |
""") |
61 |
||
62 |
def test_resolve_via_directory_option(self): |
|
63 |
self.run_script("""\ |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
64 |
$ brz resolve -d branch myfile
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
65 |
2>1 conflict resolved, 2 remaining
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
66 |
""") |
67 |
||
68 |
def test_resolve_all_via_directory_option(self): |
|
69 |
self.run_script("""\ |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
70 |
$ brz resolve -d branch --all
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
71 |
2>3 conflicts resolved, 0 remaining
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
72 |
$ brz conflicts -d branch
|
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
73 |
""") |
74 |
||
75 |
||
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
76 |
class TestBug788000(script.TestCaseWithTransportAndScript): |
77 |
||
78 |
def test_bug_788000(self): |
|
79 |
self.run_script('''\ |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
80 |
$ brz init a
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
81 |
$ mkdir a/dir
|
82 |
$ echo foo > a/dir/file
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
83 |
$ brz add a/dir
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
84 |
$ cd a
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
85 |
$ brz commit -m one
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
86 |
$ cd ..
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
87 |
$ brz clone a b
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
88 |
$ echo bar > b/dir/file
|
89 |
$ cd a
|
|
90 |
$ rm -r dir
|
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
91 |
$ brz commit -m two
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
92 |
$ cd ../b
|
93 |
''', |
|
94 |
null_output_matches_anything=True) |
|
95 |
||
96 |
self.run_script('''\ |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
97 |
$ brz pull
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
98 |
Using saved parent location:...
|
99 |
Now on revision 2.
|
|
100 |
2>RM dir/file => dir/file.THIS
|
|
101 |
2>Conflict: can't delete dir because it is not empty. Not deleting.
|
|
102 |
2>Conflict because dir is not versioned, but has versioned children...
|
|
103 |
2>Contents conflict in dir/file
|
|
104 |
2>3 conflicts encountered.
|
|
105 |
''') |
|
106 |
self.run_script('''\ |
|
6622.1.29
by Jelmer Vernooij
Fix some more tests. |
107 |
$ brz resolve --take-other
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
108 |
2>deleted dir/file.THIS
|
109 |
2>deleted dir
|
|
6138.3.5
by Jonathan Riddell
make the test suite pass |
110 |
2>3 conflicts resolved, 0 remaining
|
5972.1.1
by Vincent Ladeuil
Make ContentConflict resolution more robust |
111 |
''') |
112 |
||
113 |
||
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
114 |
class TestResolveAuto(tests.TestCaseWithTransport): |
115 |
||
116 |
def test_auto_resolve(self): |
|
117 |
"""Text conflicts can be resolved automatically""" |
|
118 |
tree = self.make_branch_and_tree('tree') |
|
119 |
self.build_tree_contents([('tree/file', |
|
120 |
'<<<<<<<\na\n=======\n>>>>>>>\n')]) |
|
121 |
tree.add('file', 'file_id') |
|
122 |
self.assertEqual(tree.kind('file_id'), 'file') |
|
123 |
file_conflict = conflicts.TextConflict('file', file_id='file_id') |
|
124 |
tree.set_conflicts(conflicts.ConflictList([file_conflict])) |
|
125 |
note = self.run_bzr('resolve', retcode=1, working_dir='tree')[1] |
|
6143.1.4
by Jonathan Riddell
update tests |
126 |
self.assertContainsRe(note, '0 conflicts auto-resolved.') |
4597.9.19
by Vincent Ladeuil
resolve now reports conflicts resolved/remaining. |
127 |
self.assertContainsRe(note, |
128 |
'Remaining conflicts:\nText conflict in file') |
|
129 |
self.build_tree_contents([('tree/file', 'a\n')]) |
|
130 |
note = self.run_bzr('resolve', working_dir='tree')[1] |
|
131 |
self.assertContainsRe(note, 'All conflicts resolved.') |