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