1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
1 |
import os |
1185.12.36
by abentley
Removed all remaining use of readonly_path |
2 |
import stat |
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
3 |
import sys |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
4 |
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
5 |
import bzrlib |
1534.1.16
by Robert Collins
Merge from jam-integration. |
6 |
from bzrlib.add import smart_add_tree |
7 |
from bzrlib.builtins import merge |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
8 |
from bzrlib.conflicts import ContentsConflict, TextConflict, PathConflict |
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
9 |
from bzrlib.errors import (NotBranchError, NotVersionedError, |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
10 |
WorkingTreeNotRevision, BzrCommandError, NoDiff3) |
1399.1.10
by Robert Collins
remove kind from the InventoryEntry constructor - only child classes should be created now |
11 |
import bzrlib.inventory as inventory |
1534.7.140
by Aaron Bentley
Moved the merge stuff into merge.py |
12 |
from bzrlib.merge import Merge3Merger, Diff3Merger, WeaveMerger |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
13 |
from bzrlib.osutils import (file_kind, getcwd, mkdtemp, pathjoin, rename, rmtree, |
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
14 |
sha_file, |
15 |
)
|
|
1534.7.140
by Aaron Bentley
Moved the merge stuff into merge.py |
16 |
from bzrlib.transform import TreeTransform |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
17 |
from bzrlib.tests import TestCaseWithTransport, TestCase, TestSkipped |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
18 |
from bzrlib.workingtree import WorkingTree |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
19 |
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
20 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
21 |
class MergeBuilder(object): |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
22 |
def __init__(self, dir=None): |
23 |
self.dir = mkdtemp(prefix="merge-test", dir=dir) |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
24 |
def wt(name): |
25 |
path = pathjoin(self.dir, name) |
|
26 |
os.mkdir(path) |
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
27 |
wt = bzrlib.bzrdir.BzrDir.create_standalone_workingtree(path) |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
28 |
tt = TreeTransform(wt) |
29 |
return wt, tt |
|
30 |
self.base, self.base_tt = wt('base') |
|
31 |
self.this, self.this_tt = wt('this') |
|
32 |
self.other, self.other_tt = wt('other') |
|
1185.50.33
by John Arbash Meinel
Whitespace cleanups. |
33 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
34 |
def get_cset_path(self, parent, name): |
35 |
if name is None: |
|
36 |
assert (parent is None) |
|
37 |
return None |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
38 |
return pathjoin(self.cset.entries[parent].path, name) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
39 |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
40 |
def add_file(self, id, parent, name, contents, executable, this=True, |
41 |
base=True, other=True): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
42 |
def new_file(tt): |
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
43 |
parent_id = tt.trans_id_file_id(parent) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
44 |
tt.new_file(name, parent_id, contents, id, executable) |
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
45 |
for option, tt in self.selected_transforms(this, base, other): |
46 |
if option is True: |
|
47 |
new_file(tt) |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
48 |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
49 |
def merge(self, merge_type=Merge3Merger, interesting_ids=None, **kwargs): |
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
50 |
self.base_tt.apply() |
51 |
self.base.commit('base commit') |
|
52 |
for tt, wt in ((self.this_tt, self.this), (self.other_tt, self.other)): |
|
53 |
wt.branch.pull(self.base.branch) |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
54 |
wt.set_last_revision(wt.branch.last_revision()) |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
55 |
tt.apply() |
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
56 |
wt.commit('branch commit') |
57 |
assert len(wt.branch.revision_history()) == 2 |
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
58 |
self.this.branch.fetch(self.other.branch) |
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
59 |
other_basis = self.other.branch.basis_tree() |
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
60 |
merger = merge_type(self.this, self.this, self.base, other_basis, |
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
61 |
interesting_ids=interesting_ids, **kwargs) |
1534.7.131
by Aaron Bentley
Work on cooked conflicts |
62 |
return merger.cooked_conflicts |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
63 |
|
64 |
def list_transforms(self): |
|
65 |
return [self.this_tt, self.base_tt, self.other_tt] |
|
66 |
||
67 |
def selected_transforms(self, this, base, other): |
|
68 |
pairs = [(this, self.this_tt), (base, self.base_tt), |
|
69 |
(other, self.other_tt)] |
|
70 |
return [(v, tt) for (v, tt) in pairs if v is not None] |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
71 |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
72 |
def add_symlink(self, id, parent, name, contents): |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
73 |
for tt in self.list_transforms(): |
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
74 |
parent_id = tt.trans_id_file_id(parent) |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
75 |
tt.new_symlink(name, parent_id, contents, id) |
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
76 |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
77 |
def remove_file(self, file_id, base=False, this=False, other=False): |
78 |
for option, tt in self.selected_transforms(this, base, other): |
|
79 |
if option is True: |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
80 |
trans_id = tt.trans_id_file_id(file_id) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
81 |
tt.cancel_creation(trans_id) |
82 |
tt.cancel_versioning(trans_id) |
|
83 |
tt.set_executability(None, trans_id) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
84 |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
85 |
def add_dir(self, file_id, parent, name): |
86 |
for tt in self.list_transforms(): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
87 |
parent_id = tt.trans_id_file_id(parent) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
88 |
tt.new_directory(name, parent_id, file_id) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
89 |
|
90 |
def change_name(self, id, base=None, this=None, other=None): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
91 |
for val, tt in ((base, self.base_tt), (this, self.this_tt), |
92 |
(other, self.other_tt)): |
|
93 |
if val is None: |
|
94 |
continue
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
95 |
trans_id = tt.trans_id_file_id(id) |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
96 |
parent_id = tt.final_parent(trans_id) |
97 |
tt.adjust_path(val, parent_id, trans_id) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
98 |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
99 |
def change_parent(self, file_id, base=None, this=None, other=None): |
100 |
for parent, tt in self.selected_transforms(this, base, other): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
101 |
trans_id = tt.trans_id_file_id(file_id) |
102 |
parent_id = tt.trans_id_file_id(parent) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
103 |
tt.adjust_path(tt.final_name(trans_id), parent_id, trans_id) |
104 |
||
105 |
def change_contents(self, file_id, base=None, this=None, other=None): |
|
106 |
for contents, tt in self.selected_transforms(this, base, other): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
107 |
trans_id = tt.trans_id_file_id(file_id) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
108 |
tt.cancel_creation(trans_id) |
109 |
tt.create_file(contents, trans_id) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
110 |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
111 |
def change_target(self, id, base=None, this=None, other=None): |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
112 |
for target, tt in self.selected_transforms(this, base, other): |
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
113 |
trans_id = tt.trans_id_file_id(id) |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
114 |
tt.cancel_creation(trans_id) |
115 |
tt.create_symlink(target, trans_id) |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
116 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
117 |
def change_perms(self, id, base=None, this=None, other=None): |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
118 |
for executability, tt in self.selected_transforms(this, base, other): |
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
119 |
trans_id = tt.trans_id_file_id(id) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
120 |
tt.set_executability(None, trans_id) |
121 |
tt.set_executability(executability, trans_id) |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
122 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
123 |
def change_perms_tree(self, id, tree, mode): |
124 |
os.chmod(tree.full_path(id), mode) |
|
125 |
||
126 |
def apply_inv_change(self, inventory_change, orig_inventory): |
|
127 |
orig_inventory_by_path = {} |
|
128 |
for file_id, path in orig_inventory.iteritems(): |
|
129 |
orig_inventory_by_path[path] = file_id |
|
130 |
||
131 |
def parent_id(file_id): |
|
132 |
try: |
|
133 |
parent_dir = os.path.dirname(orig_inventory[file_id]) |
|
134 |
except: |
|
135 |
print file_id |
|
136 |
raise
|
|
137 |
if parent_dir == "": |
|
138 |
return None |
|
139 |
return orig_inventory_by_path[parent_dir] |
|
140 |
||
141 |
def new_path(file_id): |
|
142 |
if inventory_change.has_key(file_id): |
|
143 |
return inventory_change[file_id] |
|
144 |
else: |
|
145 |
parent = parent_id(file_id) |
|
146 |
if parent is None: |
|
147 |
return orig_inventory[file_id] |
|
148 |
dirname = new_path(parent) |
|
1185.50.31
by John Arbash Meinel
[merge] Denys Duchier, more tests for test_merge_core, and fixup of one test. |
149 |
return pathjoin(dirname, os.path.basename(orig_inventory[file_id])) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
150 |
|
151 |
new_inventory = {} |
|
152 |
for file_id in orig_inventory.iterkeys(): |
|
153 |
path = new_path(file_id) |
|
154 |
if path is None: |
|
155 |
continue
|
|
156 |
new_inventory[file_id] = path |
|
157 |
||
158 |
for file_id, path in inventory_change.iteritems(): |
|
159 |
if orig_inventory.has_key(file_id): |
|
160 |
continue
|
|
161 |
new_inventory[file_id] = path |
|
162 |
return new_inventory |
|
163 |
||
164 |
def cleanup(self): |
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
165 |
rmtree(self.dir) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
166 |
|
1448
by Robert Collins
revert symlinks correctly |
167 |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
168 |
class MergeTest(TestCaseWithTransport): |
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
169 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
170 |
def test_change_name(self): |
171 |
"""Test renames"""
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
172 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
173 |
builder.add_file("1", "TREE_ROOT", "name1", "hello1", True) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
174 |
builder.change_name("1", other="name2") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
175 |
builder.add_file("2", "TREE_ROOT", "name3", "hello2", True) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
176 |
builder.change_name("2", base="name4") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
177 |
builder.add_file("3", "TREE_ROOT", "name5", "hello3", True) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
178 |
builder.change_name("3", this="name6") |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
179 |
builder.merge() |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
180 |
builder.cleanup() |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
181 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
182 |
builder.add_file("1", "TREE_ROOT", "name1", "hello1", False) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
183 |
builder.change_name("1", other="name2", this="name3") |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
184 |
conflicts = builder.merge() |
1534.10.20
by Aaron Bentley
Got all tests passing |
185 |
self.assertEqual(conflicts, [PathConflict('name3', 'name2', '1')]) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
186 |
builder.cleanup() |
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
187 |
|
188 |
def test_merge_one(self): |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
189 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
190 |
builder.add_file("1", "TREE_ROOT", "name1", "hello1", True) |
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
191 |
builder.change_contents("1", other="text4") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
192 |
builder.add_file("2", "TREE_ROOT", "name2", "hello1", True) |
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
193 |
builder.change_contents("2", other="text4") |
194 |
builder.merge(interesting_ids=["1"]) |
|
195 |
self.assertEqual(builder.this.get_file("1").read(), "text4" ) |
|
196 |
self.assertEqual(builder.this.get_file("2").read(), "hello1" ) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
197 |
|
198 |
def test_file_moves(self): |
|
199 |
"""Test moves"""
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
200 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
201 |
builder.add_dir("1", "TREE_ROOT", "dir1") |
202 |
builder.add_dir("2", "TREE_ROOT", "dir2") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
203 |
builder.add_file("3", "1", "file1", "hello1", True) |
204 |
builder.add_file("4", "1", "file2", "hello2", True) |
|
205 |
builder.add_file("5", "1", "file3", "hello3", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
206 |
builder.change_parent("3", other="2") |
207 |
builder.change_parent("4", this="2") |
|
208 |
builder.change_parent("5", base="2") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
209 |
builder.merge() |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
210 |
builder.cleanup() |
211 |
||
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
212 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
213 |
builder.add_dir("1", "TREE_ROOT", "dir1") |
214 |
builder.add_dir("2", "TREE_ROOT", "dir2") |
|
215 |
builder.add_dir("3", "TREE_ROOT", "dir3") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
216 |
builder.add_file("4", "1", "file1", "hello1", False) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
217 |
builder.change_parent("4", other="2", this="3") |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
218 |
conflicts = builder.merge() |
1534.7.176
by abentley
Fixed up tests for Windows |
219 |
path2 = pathjoin('dir2', 'file1') |
220 |
path3 = pathjoin('dir3', 'file1') |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
221 |
self.assertEqual(conflicts, [PathConflict(path3, path2, '4')]) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
222 |
builder.cleanup() |
223 |
||
224 |
def test_contents_merge(self): |
|
225 |
"""Test merge3 merging"""
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
226 |
self.do_contents_test(Merge3Merger) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
227 |
|
228 |
def test_contents_merge2(self): |
|
229 |
"""Test diff3 merging"""
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
230 |
try: |
231 |
self.do_contents_test(Diff3Merger) |
|
232 |
except NoDiff3: |
|
233 |
raise TestSkipped("diff3 not available") |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
234 |
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
235 |
def test_contents_merge3(self): |
236 |
"""Test diff3 merging"""
|
|
237 |
self.do_contents_test(WeaveMerger) |
|
238 |
||
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
239 |
def test_reprocess_weave(self): |
240 |
# Reprocess works on weaves, and behaves as expected
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
241 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
242 |
builder.add_file('a', 'TREE_ROOT', 'blah', 'a', False) |
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
243 |
builder.change_contents('a', this='b\nc\nd\ne\n', other='z\nc\nd\ny\n') |
244 |
builder.merge(WeaveMerger, reprocess=True) |
|
245 |
expected = """<<<<<<< TREE |
|
246 |
b
|
|
247 |
=======
|
|
248 |
z
|
|
249 |
>>>>>>> MERGE-SOURCE
|
|
250 |
c
|
|
251 |
d
|
|
252 |
<<<<<<< TREE
|
|
253 |
e
|
|
254 |
=======
|
|
255 |
y
|
|
256 |
>>>>>>> MERGE-SOURCE
|
|
257 |
"""
|
|
258 |
self.assertEqualDiff(builder.this.get_file("a").read(), expected) |
|
259 |
||
260 |
||
261 |
||
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
262 |
def do_contents_test(self, merge_factory): |
263 |
"""Test merging with specified ContentsChange factory"""
|
|
264 |
builder = self.contents_test_success(merge_factory) |
|
265 |
builder.cleanup() |
|
266 |
self.contents_test_conflicts(merge_factory) |
|
267 |
||
268 |
def contents_test_success(self, merge_factory): |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
269 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
270 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
271 |
builder.change_contents("1", other="text4") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
272 |
builder.add_file("2", "TREE_ROOT", "name3", "text2", False) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
273 |
builder.change_contents("2", base="text5") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
274 |
builder.add_file("3", "TREE_ROOT", "name5", "text3", True) |
275 |
builder.add_file("4", "TREE_ROOT", "name6", "text4", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
276 |
builder.remove_file("4", base=True) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
277 |
builder.add_file("5", "TREE_ROOT", "name7", "a\nb\nc\nd\ne\nf\n", True) |
1558.6.4
by Aaron Bentley
Fixed merge-type weave |
278 |
builder.change_contents("5", other="a\nz\nc\nd\ne\nf\n", |
279 |
this="a\nb\nc\nd\ne\nz\n") |
|
280 |
builder.merge(merge_factory) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
281 |
self.assertEqual(builder.this.get_file("1").read(), "text4" ) |
282 |
self.assertEqual(builder.this.get_file("2").read(), "text2" ) |
|
1558.6.4
by Aaron Bentley
Fixed merge-type weave |
283 |
self.assertEqual(builder.this.get_file("5").read(), |
284 |
"a\nz\nc\nd\ne\nz\n") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
285 |
self.assertIs(builder.this.is_executable("1"), True) |
286 |
self.assertIs(builder.this.is_executable("2"), False) |
|
287 |
self.assertIs(builder.this.is_executable("3"), True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
288 |
return builder |
289 |
||
290 |
def contents_test_conflicts(self, merge_factory): |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
291 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
292 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
293 |
builder.change_contents("1", other="text4", this="text3") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
294 |
builder.add_file("2", "TREE_ROOT", "name2", "text1", True) |
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
295 |
builder.change_contents("2", other="\x00", this="text3") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
296 |
builder.add_file("3", "TREE_ROOT", "name3", "text5", False) |
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
297 |
builder.change_perms("3", this=True) |
298 |
builder.change_contents('3', this='moretext') |
|
299 |
builder.remove_file('3', other=True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
300 |
conflicts = builder.merge(merge_factory) |
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
301 |
self.assertEqual(conflicts, [TextConflict('name1', file_id='1'), |
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
302 |
ContentsConflict('name2', file_id='2'), |
303 |
ContentsConflict('name3', file_id='3')]) |
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
304 |
self.assertEqual(builder.this.get_file('2').read(), '\x00') |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
305 |
builder.cleanup() |
306 |
||
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
307 |
def test_symlink_conflicts(self): |
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
308 |
if sys.platform != "win32": |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
309 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
310 |
builder.add_symlink("2", "TREE_ROOT", "name2", "target1") |
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
311 |
builder.change_target("2", other="target4", base="text3") |
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
312 |
conflicts = builder.merge() |
1534.10.20
by Aaron Bentley
Got all tests passing |
313 |
self.assertEqual(conflicts, [ContentsConflict('name2', |
314 |
file_id='2')]) |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
315 |
builder.cleanup() |
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
316 |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
317 |
def test_symlink_merge(self): |
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
318 |
if sys.platform != "win32": |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
319 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
320 |
builder.add_symlink("1", "TREE_ROOT", "name1", "target1") |
321 |
builder.add_symlink("2", "TREE_ROOT", "name2", "target1") |
|
322 |
builder.add_symlink("3", "TREE_ROOT", "name3", "target1") |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
323 |
builder.change_target("1", this="target2") |
324 |
builder.change_target("2", base="target2") |
|
325 |
builder.change_target("3", other="target2") |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
326 |
builder.merge() |
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
327 |
self.assertEqual(builder.this.get_symlink_target("1"), "target2") |
328 |
self.assertEqual(builder.this.get_symlink_target("2"), "target1") |
|
329 |
self.assertEqual(builder.this.get_symlink_target("3"), "target2") |
|
330 |
builder.cleanup() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
331 |
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
332 |
def test_no_passive_add(self): |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
333 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
334 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
335 |
builder.remove_file("1", this=True) |
336 |
builder.merge() |
|
1534.7.146
by Aaron Bentley
Fixed merge so tree root is auto-preserved, not by conflict resolution |
337 |
builder.cleanup() |
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
338 |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
339 |
def test_perms_merge(self): |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
340 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
341 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
342 |
builder.change_perms("1", other=False) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
343 |
builder.add_file("2", "TREE_ROOT", "name2", "text2", True) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
344 |
builder.change_perms("2", base=False) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
345 |
builder.add_file("3", "TREE_ROOT", "name3", "text3", True) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
346 |
builder.change_perms("3", this=False) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
347 |
builder.add_file('4', 'TREE_ROOT', 'name4', 'text4', False) |
1534.7.142
by Aaron Bentley
Fixed executability conflicts |
348 |
builder.change_perms('4', this=True) |
349 |
builder.remove_file('4', base=True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
350 |
builder.merge() |
351 |
self.assertIs(builder.this.is_executable("1"), False) |
|
352 |
self.assertIs(builder.this.is_executable("2"), True) |
|
353 |
self.assertIs(builder.this.is_executable("3"), False) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
354 |
builder.cleanup(); |
1092.1.25
by Robert Collins
prepare to write merge tests |
355 |
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
356 |
def test_new_suffix(self): |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
357 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
358 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
359 |
builder.change_contents("1", other="text3") |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
360 |
builder.add_file("2", "TREE_ROOT", "name1.new", "text2", True) |
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
361 |
builder.merge() |
362 |
os.lstat(builder.this.id2abspath("2")) |
|
363 |
builder.cleanup() |
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
364 |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
365 |
def test_spurious_conflict(self): |
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
366 |
builder = MergeBuilder(getcwd()) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
367 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", False) |
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
368 |
builder.remove_file("1", other=True) |
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
369 |
builder.add_file("2", "TREE_ROOT", "name1", "text1", False, this=False, |
370 |
base=False) |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
371 |
conflicts = builder.merge() |
372 |
self.assertEqual(conflicts, []) |
|
373 |
||
1448
by Robert Collins
revert symlinks correctly |
374 |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
375 |
class FunctionalMergeTest(TestCaseWithTransport): |
1092.1.25
by Robert Collins
prepare to write merge tests |
376 |
|
377 |
def test_trivial_star_merge(self): |
|
378 |
"""Test that merges in a star shape Just Work."""
|
|
1092.1.33
by Robert Collins
pull the important stuff out of cmd_branch.run to branch.copy_branch |
379 |
# John starts a branch
|
1092.1.26
by Robert Collins
start writing star-topology test, realise we need smart-add change |
380 |
self.build_tree(("original/", "original/file1", "original/file2")) |
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
381 |
tree = self.make_branch_and_tree('original') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
382 |
branch = tree.branch |
1185.53.2
by Michael Ellerman
Add tests for bzr add --dry-run |
383 |
smart_add_tree(tree, ["original"]) |
1508.1.10
by Robert Collins
bzrlib.add.smart_add_branch is now smart_add_tree. (Robert Collins) |
384 |
tree.commit("start branch.", verbose=False) |
1092.1.33
by Robert Collins
pull the important stuff out of cmd_branch.run to branch.copy_branch |
385 |
# Mary branches it.
|
1092.1.34
by Robert Collins
unbreak cmd_branch now that something tests the core of it.. |
386 |
self.build_tree(("mary/",)) |
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
387 |
branch.bzrdir.clone("mary") |
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
388 |
# Now John commits a change
|
389 |
file = open("original/file1", "wt") |
|
390 |
file.write("John\n") |
|
391 |
file.close() |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
392 |
tree.commit("change file1") |
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
393 |
# Mary does too
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
394 |
mary_tree = WorkingTree.open('mary') |
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
395 |
mary_branch = mary_tree.branch |
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
396 |
file = open("mary/file2", "wt") |
397 |
file.write("Mary\n") |
|
398 |
file.close() |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
399 |
mary_tree.commit("change file2") |
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
400 |
# john should be able to merge with no conflicts.
|
1534.7.84
by Aaron Bentley
Added reprocess support, support for varying merge types |
401 |
merge_type = Merge3Merger |
1092.1.41
by Robert Collins
merge from abently, take his fixes for merge in preference |
402 |
base = [None, None] |
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
403 |
other = ("mary", -1) |
1185.12.87
by Aaron Bentley
Updated NEWS, error out if --show-base supplied and unsupported |
404 |
self.assertRaises(BzrCommandError, merge, other, base, check_clean=True, |
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
405 |
merge_type=WeaveMerger, this_dir="original", |
1185.12.87
by Aaron Bentley
Updated NEWS, error out if --show-base supplied and unsupported |
406 |
show_base=True) |
407 |
merge(other, base, check_clean=True, merge_type=merge_type, |
|
408 |
this_dir="original") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
409 |
self.assertEqual("John\n", open("original/file1", "rt").read()) |
410 |
self.assertEqual("Mary\n", open("original/file2", "rt").read()) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
411 |
|
412 |
def test_conflicts(self): |
|
413 |
os.mkdir('a') |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
414 |
wta = self.make_branch_and_tree('a') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
415 |
a = wta.branch |
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
416 |
file('a/file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
417 |
wta.add('file') |
418 |
wta.commit('base revision', allow_pointless=False) |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
419 |
d_b = a.bzrdir.clone('b') |
420 |
b = d_b.open_branch() |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
421 |
file('a/file', 'wb').write('other contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
422 |
wta.commit('other revision', allow_pointless=False) |
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
423 |
file('b/file', 'wb').write('this contents contents\n') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
424 |
wtb = d_b.open_workingtree() |
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
425 |
wtb.commit('this revision', allow_pointless=False) |
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
426 |
self.assertEqual(merge(['a', -1], [None, None], this_dir='b'), 1) |
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
427 |
self.assert_(os.path.lexists('b/file.THIS')) |
428 |
self.assert_(os.path.lexists('b/file.BASE')) |
|
429 |
self.assert_(os.path.lexists('b/file.OTHER')) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
430 |
self.assertRaises(WorkingTreeNotRevision, merge, ['a', -1], |
431 |
[None, None], this_dir='b', check_clean=False, |
|
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
432 |
merge_type=WeaveMerger) |
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
433 |
wtb.revert([]) |
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
434 |
self.assertEqual(merge(['a', -1], [None, None], this_dir='b', |
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
435 |
check_clean=False, merge_type=WeaveMerger), 1) |
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
436 |
self.assert_(os.path.lexists('b/file')) |
437 |
self.assert_(os.path.lexists('b/file.THIS')) |
|
438 |
self.assert_(not os.path.lexists('b/file.BASE')) |
|
439 |
self.assert_(os.path.lexists('b/file.OTHER')) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
440 |
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
441 |
def test_merge_unrelated(self): |
442 |
"""Sucessfully merges unrelated branches with no common names"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
443 |
wta = self.make_branch_and_tree('a') |
444 |
a = wta.branch |
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
445 |
file('a/a_file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
446 |
wta.add('a_file') |
447 |
wta.commit('a_revision', allow_pointless=False) |
|
448 |
wtb = self.make_branch_and_tree('b') |
|
449 |
b = wtb.branch |
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
450 |
file('b/b_file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
451 |
wtb.add('b_file') |
452 |
wtb.commit('b_revision', allow_pointless=False) |
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
453 |
merge(['b', -1], ['b', 0], this_dir='a') |
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
454 |
self.assert_(os.path.lexists('a/b_file')) |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
455 |
self.assertEqual(wta.pending_merges(), |
1457.1.14
by Robert Collins
Move pending_merges() to WorkingTree. |
456 |
[b.last_revision()]) |
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
457 |
|
458 |
def test_merge_unrelated_conflicting(self): |
|
459 |
"""Sucessfully merges unrelated branches with common names"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
460 |
wta = self.make_branch_and_tree('a') |
461 |
a = wta.branch |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
462 |
file('a/file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
463 |
wta.add('file') |
464 |
wta.commit('a_revision', allow_pointless=False) |
|
465 |
wtb = self.make_branch_and_tree('b') |
|
466 |
b = wtb.branch |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
467 |
file('b/file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
468 |
wtb.add('file') |
469 |
wtb.commit('b_revision', allow_pointless=False) |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
470 |
merge(['b', -1], ['b', 0], this_dir='a') |
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
471 |
self.assert_(os.path.lexists('a/file')) |
472 |
self.assert_(os.path.lexists('a/file.moved')) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
473 |
self.assertEqual(wta.pending_merges(), [b.last_revision()]) |
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
474 |
|
475 |
def test_merge_deleted_conflicts(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
476 |
wta = self.make_branch_and_tree('a') |
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
477 |
file('a/file', 'wb').write('contents\n') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
478 |
wta.add('file') |
479 |
wta.commit('a_revision', allow_pointless=False) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
480 |
self.run_bzr('branch', 'a', 'b') |
481 |
os.remove('a/file') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
482 |
wta.commit('removed file', allow_pointless=False) |
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
483 |
file('b/file', 'wb').write('changed contents\n') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
484 |
wtb = WorkingTree.open('b') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
485 |
wtb.commit('changed file', allow_pointless=False) |
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
486 |
merge(['a', -1], ['a', 1], this_dir='b') |
487 |
self.failIf(os.path.lexists('b/file')) |
|
488 |
||
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
489 |
def test_merge_metadata_vs_deletion(self): |
490 |
"""Conflict deletion vs metadata change"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
491 |
a_wt = self.make_branch_and_tree('a') |
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
492 |
file('a/file', 'wb').write('contents\n') |
1508.1.15
by Robert Collins
Merge from mpool. |
493 |
a_wt.add('file') |
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
494 |
a_wt.commit('r0') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
495 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
496 |
b_wt = WorkingTree.open('b') |
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
497 |
os.chmod('b/file', 0755) |
498 |
os.remove('a/file') |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
499 |
a_wt.commit('removed a') |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
500 |
self.assertEqual(a_wt.branch.revno(), 2) |
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
501 |
self.assertFalse(os.path.exists('a/file')) |
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
502 |
b_wt.commit('exec a') |
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
503 |
merge(['b', -1], ['b', 0], this_dir='a') |
504 |
self.assert_(os.path.exists('a/file')) |
|
1185.31.14
by John Arbash Meinel
[merge] bzr.dev |
505 |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
506 |
def test_merge_swapping_renames(self): |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
507 |
a_wt = self.make_branch_and_tree('a') |
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
508 |
file('a/un','wb').write('UN') |
509 |
file('a/deux','wb').write('DEUX') |
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
510 |
a_wt.add('un', 'un') |
511 |
a_wt.add('deux', 'deux') |
|
512 |
a_wt.commit('r0', rev_id='r0') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
513 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
514 |
b_wt = WorkingTree.open('b') |
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
515 |
b_wt.rename_one('un','tmp') |
516 |
b_wt.rename_one('deux','un') |
|
517 |
b_wt.rename_one('tmp','deux') |
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
518 |
b_wt.commit('r1', rev_id='r1') |
519 |
self.assertEqual(0, merge(['b', -1], ['b', 1], this_dir='a')) |
|
520 |
self.failUnlessExists('a/un') |
|
521 |
self.failUnless('a/deux') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
522 |
self.assertFalse(os.path.exists('a/tmp')) |
523 |
self.assertEqual(file('a/un').read(),'DEUX') |
|
524 |
self.assertEqual(file('a/deux').read(),'UN') |
|
525 |
||
526 |
def test_merge_delete_and_add_same(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
527 |
a_wt = self.make_branch_and_tree('a') |
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
528 |
file('a/file', 'wb').write('THIS') |
529 |
a_wt.add('file') |
|
530 |
a_wt.commit('r0') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
531 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
532 |
b_wt = WorkingTree.open('b') |
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
533 |
os.remove('b/file') |
534 |
b_wt.commit('r1') |
|
535 |
file('b/file', 'wb').write('THAT') |
|
536 |
b_wt.add('file') |
|
537 |
b_wt.commit('r2') |
|
538 |
merge(['b', -1],['b', 1],this_dir='a') |
|
539 |
self.assert_(os.path.exists('a/file')) |
|
540 |
self.assertEqual(file('a/file').read(),'THAT') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
541 |
|
542 |
def test_merge_rename_before_create(self): |
|
543 |
"""rename before create
|
|
544 |
|
|
545 |
This case requires that you must not do creates
|
|
546 |
before move-into-place:
|
|
547 |
||
548 |
$ touch foo
|
|
549 |
$ bzr add foo
|
|
550 |
$ bzr commit
|
|
551 |
$ bzr mv foo bar
|
|
552 |
$ touch foo
|
|
553 |
$ bzr add foo
|
|
554 |
$ bzr commit
|
|
555 |
"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
556 |
a_wt = self.make_branch_and_tree('a') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
557 |
file('a/foo', 'wb').write('A/FOO') |
558 |
a_wt.add('foo') |
|
559 |
a_wt.commit('added foo') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
560 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
561 |
b_wt = WorkingTree.open('b') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
562 |
b_wt.rename_one('foo', 'bar') |
563 |
file('b/foo', 'wb').write('B/FOO') |
|
564 |
b_wt.add('foo') |
|
565 |
b_wt.commit('moved foo to bar, added new foo') |
|
566 |
merge(['b', -1],['b', 1],this_dir='a') |
|
567 |
||
568 |
def test_merge_create_before_rename(self): |
|
569 |
"""create before rename, target parents before children
|
|
570 |
||
571 |
This case requires that you must not do move-into-place
|
|
572 |
before creates, and that you must not do children after
|
|
573 |
parents:
|
|
574 |
||
575 |
$ touch foo
|
|
576 |
$ bzr add foo
|
|
577 |
$ bzr commit
|
|
578 |
$ bzr mkdir bar
|
|
579 |
$ bzr add bar
|
|
580 |
$ bzr mv foo bar/foo
|
|
581 |
$ bzr commit
|
|
582 |
"""
|
|
583 |
os.mkdir('a') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
584 |
a_wt = self.make_branch_and_tree('a') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
585 |
file('a/foo', 'wb').write('A/FOO') |
586 |
a_wt.add('foo') |
|
587 |
a_wt.commit('added foo') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
588 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
589 |
b_wt = WorkingTree.open('b') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
590 |
os.mkdir('b/bar') |
591 |
b_wt.add('bar') |
|
592 |
b_wt.rename_one('foo', 'bar/foo') |
|
593 |
b_wt.commit('created bar dir, moved foo into bar') |
|
594 |
merge(['b', -1],['b', 1],this_dir='a') |
|
595 |
||
596 |
def test_merge_rename_to_temp_before_delete(self): |
|
597 |
"""rename to temp before delete, source children before parents
|
|
598 |
||
599 |
This case requires that you must not do deletes before
|
|
600 |
move-out-of-the-way, and that you must not do children
|
|
601 |
after parents:
|
|
602 |
|
|
603 |
$ mkdir foo
|
|
604 |
$ touch foo/bar
|
|
605 |
$ bzr add foo/bar
|
|
606 |
$ bzr commit
|
|
607 |
$ bzr mv foo/bar bar
|
|
608 |
$ rmdir foo
|
|
609 |
$ bzr commit
|
|
610 |
"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
611 |
a_wt = self.make_branch_and_tree('a') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
612 |
os.mkdir('a/foo') |
613 |
file('a/foo/bar', 'wb').write('A/FOO/BAR') |
|
614 |
a_wt.add('foo') |
|
615 |
a_wt.add('foo/bar') |
|
616 |
a_wt.commit('added foo/bar') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
617 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
618 |
b_wt = WorkingTree.open('b') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
619 |
b_wt.rename_one('foo/bar', 'bar') |
620 |
os.rmdir('b/foo') |
|
621 |
b_wt.remove('foo') |
|
622 |
b_wt.commit('moved foo/bar to bar, deleted foo') |
|
623 |
merge(['b', -1],['b', 1],this_dir='a') |
|
624 |
||
625 |
def test_merge_delete_before_rename_to_temp(self): |
|
626 |
"""delete before rename to temp
|
|
627 |
||
628 |
This case requires that you must not do
|
|
629 |
move-out-of-the-way before deletes:
|
|
630 |
|
|
631 |
$ touch foo
|
|
632 |
$ touch bar
|
|
633 |
$ bzr add foo bar
|
|
634 |
$ bzr commit
|
|
635 |
$ rm foo
|
|
636 |
$ bzr rm foo
|
|
637 |
$ bzr mv bar foo
|
|
638 |
$ bzr commit
|
|
639 |
"""
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
640 |
a_wt = self.make_branch_and_tree('a') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
641 |
file('a/foo', 'wb').write('A/FOO') |
642 |
file('a/bar', 'wb').write('A/BAR') |
|
643 |
a_wt.add('foo') |
|
644 |
a_wt.add('bar') |
|
645 |
a_wt.commit('added foo and bar') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
646 |
self.run_bzr('branch', 'a', 'b') |
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
647 |
b_wt = WorkingTree.open('b') |
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
648 |
os.unlink('b/foo') |
649 |
b_wt.remove('foo') |
|
650 |
b_wt.rename_one('bar', 'foo') |
|
651 |
b_wt.commit('deleted foo, renamed bar to foo') |
|
652 |
merge(['b', -1],['b', 1],this_dir='a') |
|
1185.50.30
by John Arbash Meinel
[patch] from duchier, include more tests of the merge core. |
653 |