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