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 |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
18 |
from bzrlib.workingtree import WorkingTree |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
19 |
|
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
20 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
21 |
class MergeBuilder(object): |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
22 |
def __init__(self, dir=None): |
23 |
self.dir = mkdtemp(prefix="merge-test", dir=dir) |
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
24 |
def wt(name): |
25 |
path = pathjoin(self.dir, name) |
|
26 |
os.mkdir(path) |
|
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
27 |
wt = bzrlib.bzrdir.BzrDir.create_standalone_workingtree(path) |
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
28 |
# the tests perform pulls, so need a branch that is writeable.
|
29 |
wt.lock_write() |
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
30 |
tt = TreeTransform(wt) |
31 |
return wt, tt |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
32 |
self.base, self.base_tt = wt('base') |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
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): |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
168 |
self.base.unlock() |
169 |
self.this.unlock() |
|
170 |
self.other.unlock() |
|
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
171 |
rmtree(self.dir) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
172 |
|
|
1448
by Robert Collins
revert symlinks correctly |
173 |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
174 |
class MergeTest(TestCaseWithTransport): |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
175 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
176 |
def test_change_name(self): |
177 |
"""Test renames""" |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
178 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
179 |
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 |
180 |
builder.change_name("1", other="name2") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
181 |
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 |
182 |
builder.change_name("2", base="name4") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
183 |
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 |
184 |
builder.change_name("3", this="name6") |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
185 |
builder.merge() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
186 |
builder.cleanup() |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
187 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
188 |
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 |
189 |
builder.change_name("1", other="name2", this="name3") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
190 |
conflicts = builder.merge() |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
191 |
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 |
192 |
builder.cleanup() |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
193 |
|
194 |
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 |
195 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
196 |
builder.add_file("1", "TREE_ROOT", "name1", "hello1", True) |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
197 |
builder.change_contents("1", other="text4") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
198 |
builder.add_file("2", "TREE_ROOT", "name2", "hello1", True) |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
199 |
builder.change_contents("2", other="text4") |
200 |
builder.merge(interesting_ids=["1"]) |
|
201 |
self.assertEqual(builder.this.get_file("1").read(), "text4" ) |
|
202 |
self.assertEqual(builder.this.get_file("2").read(), "hello1" ) |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
203 |
builder.cleanup() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
204 |
|
205 |
def test_file_moves(self): |
|
206 |
"""Test moves""" |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
207 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
208 |
builder.add_dir("1", "TREE_ROOT", "dir1") |
209 |
builder.add_dir("2", "TREE_ROOT", "dir2") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
210 |
builder.add_file("3", "1", "file1", "hello1", True) |
211 |
builder.add_file("4", "1", "file2", "hello2", True) |
|
212 |
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 |
213 |
builder.change_parent("3", other="2") |
214 |
builder.change_parent("4", this="2") |
|
215 |
builder.change_parent("5", base="2") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
216 |
builder.merge() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
217 |
builder.cleanup() |
218 |
||
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
219 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
220 |
builder.add_dir("1", "TREE_ROOT", "dir1") |
221 |
builder.add_dir("2", "TREE_ROOT", "dir2") |
|
222 |
builder.add_dir("3", "TREE_ROOT", "dir3") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
223 |
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 |
224 |
builder.change_parent("4", other="2", this="3") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
225 |
conflicts = builder.merge() |
|
1534.7.176
by abentley
Fixed up tests for Windows |
226 |
path2 = pathjoin('dir2', 'file1') |
227 |
path3 = pathjoin('dir3', 'file1') |
|
|
1534.10.20
by Aaron Bentley
Got all tests passing |
228 |
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 |
229 |
builder.cleanup() |
230 |
||
231 |
def test_contents_merge(self): |
|
232 |
"""Test merge3 merging""" |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
233 |
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 |
234 |
|
235 |
def test_contents_merge2(self): |
|
236 |
"""Test diff3 merging""" |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
237 |
try: |
238 |
self.do_contents_test(Diff3Merger) |
|
239 |
except NoDiff3: |
|
240 |
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 |
241 |
|
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
242 |
def test_contents_merge3(self): |
243 |
"""Test diff3 merging""" |
|
244 |
self.do_contents_test(WeaveMerger) |
|
245 |
||
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
246 |
def test_reprocess_weave(self): |
247 |
# 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 |
248 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
249 |
builder.add_file('a', 'TREE_ROOT', 'blah', 'a', False) |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
250 |
builder.change_contents('a', this='b\nc\nd\ne\n', other='z\nc\nd\ny\n') |
251 |
builder.merge(WeaveMerger, reprocess=True) |
|
252 |
expected = """<<<<<<< TREE |
|
253 |
b
|
|
254 |
=======
|
|
255 |
z
|
|
256 |
>>>>>>> MERGE-SOURCE
|
|
257 |
c
|
|
258 |
d
|
|
259 |
<<<<<<< TREE
|
|
260 |
e
|
|
261 |
=======
|
|
262 |
y
|
|
263 |
>>>>>>> MERGE-SOURCE
|
|
264 |
"""
|
|
265 |
self.assertEqualDiff(builder.this.get_file("a").read(), expected) |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
266 |
builder.cleanup() |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
267 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
268 |
def do_contents_test(self, merge_factory): |
269 |
"""Test merging with specified ContentsChange factory""" |
|
270 |
builder = self.contents_test_success(merge_factory) |
|
271 |
builder.cleanup() |
|
272 |
self.contents_test_conflicts(merge_factory) |
|
273 |
||
274 |
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 |
275 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
276 |
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 |
277 |
builder.change_contents("1", other="text4") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
278 |
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 |
279 |
builder.change_contents("2", base="text5") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
280 |
builder.add_file("3", "TREE_ROOT", "name5", "text3", True) |
281 |
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 |
282 |
builder.remove_file("4", base=True) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
283 |
builder.add_file("5", "TREE_ROOT", "name7", "a\nb\nc\nd\ne\nf\n", True) |
|
1558.6.4
by Aaron Bentley
Fixed merge-type weave |
284 |
builder.change_contents("5", other="a\nz\nc\nd\ne\nf\n", |
285 |
this="a\nb\nc\nd\ne\nz\n") |
|
286 |
builder.merge(merge_factory) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
287 |
self.assertEqual(builder.this.get_file("1").read(), "text4" ) |
288 |
self.assertEqual(builder.this.get_file("2").read(), "text2" ) |
|
|
1558.6.4
by Aaron Bentley
Fixed merge-type weave |
289 |
self.assertEqual(builder.this.get_file("5").read(), |
290 |
"a\nz\nc\nd\ne\nz\n") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
291 |
self.assertIs(builder.this.is_executable("1"), True) |
292 |
self.assertIs(builder.this.is_executable("2"), False) |
|
293 |
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 |
294 |
return builder |
295 |
||
296 |
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 |
297 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
298 |
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 |
299 |
builder.change_contents("1", other="text4", this="text3") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
300 |
builder.add_file("2", "TREE_ROOT", "name2", "text1", True) |
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
301 |
builder.change_contents("2", other="\x00", this="text3") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
302 |
builder.add_file("3", "TREE_ROOT", "name3", "text5", False) |
|
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
303 |
builder.change_perms("3", this=True) |
304 |
builder.change_contents('3', this='moretext') |
|
305 |
builder.remove_file('3', other=True) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
306 |
conflicts = builder.merge(merge_factory) |
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
307 |
self.assertEqual(conflicts, [TextConflict('name1', file_id='1'), |
|
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
308 |
ContentsConflict('name2', file_id='2'), |
309 |
ContentsConflict('name3', file_id='3')]) |
|
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
310 |
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 |
311 |
builder.cleanup() |
312 |
||
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
313 |
def test_symlink_conflicts(self): |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
314 |
if sys.platform != "win32": |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
315 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
316 |
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 |
317 |
builder.change_target("2", other="target4", base="text3") |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
318 |
conflicts = builder.merge() |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
319 |
self.assertEqual(conflicts, [ContentsConflict('name2', |
320 |
file_id='2')]) |
|
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
321 |
builder.cleanup() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
322 |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
323 |
def test_symlink_merge(self): |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
324 |
if sys.platform != "win32": |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
325 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
326 |
builder.add_symlink("1", "TREE_ROOT", "name1", "target1") |
327 |
builder.add_symlink("2", "TREE_ROOT", "name2", "target1") |
|
328 |
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 |
329 |
builder.change_target("1", this="target2") |
330 |
builder.change_target("2", base="target2") |
|
331 |
builder.change_target("3", other="target2") |
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
332 |
builder.merge() |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
333 |
self.assertEqual(builder.this.get_symlink_target("1"), "target2") |
334 |
self.assertEqual(builder.this.get_symlink_target("2"), "target1") |
|
335 |
self.assertEqual(builder.this.get_symlink_target("3"), "target2") |
|
336 |
builder.cleanup() |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
337 |
|
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
338 |
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 |
339 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
340 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
341 |
builder.remove_file("1", this=True) |
342 |
builder.merge() |
|
|
1534.7.146
by Aaron Bentley
Fixed merge so tree root is auto-preserved, not by conflict resolution |
343 |
builder.cleanup() |
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
344 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
345 |
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 |
346 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
347 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
348 |
builder.change_perms("1", other=False) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
349 |
builder.add_file("2", "TREE_ROOT", "name2", "text2", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
350 |
builder.change_perms("2", base=False) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
351 |
builder.add_file("3", "TREE_ROOT", "name3", "text3", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
352 |
builder.change_perms("3", this=False) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
353 |
builder.add_file('4', 'TREE_ROOT', 'name4', 'text4', False) |
|
1534.7.142
by Aaron Bentley
Fixed executability conflicts |
354 |
builder.change_perms('4', this=True) |
355 |
builder.remove_file('4', base=True) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
356 |
builder.merge() |
357 |
self.assertIs(builder.this.is_executable("1"), False) |
|
358 |
self.assertIs(builder.this.is_executable("2"), True) |
|
359 |
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 |
360 |
builder.cleanup(); |
|
1092.1.25
by Robert Collins
prepare to write merge tests |
361 |
|
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
362 |
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 |
363 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
364 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
365 |
builder.change_contents("1", other="text3") |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
366 |
builder.add_file("2", "TREE_ROOT", "name1.new", "text2", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
367 |
builder.merge() |
368 |
os.lstat(builder.this.id2abspath("2")) |
|
369 |
builder.cleanup() |
|
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
370 |
|
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
371 |
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 |
372 |
builder = MergeBuilder(getcwd()) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
373 |
builder.add_file("1", "TREE_ROOT", "name1", "text1", False) |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
374 |
builder.remove_file("1", other=True) |
|
1907.1.1
by Aaron Bentley
Unshelved all changes except those related to removing RootEntry |
375 |
builder.add_file("2", "TREE_ROOT", "name1", "text1", False, this=False, |
376 |
base=False) |
|
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
377 |
conflicts = builder.merge() |
378 |
self.assertEqual(conflicts, []) |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
379 |
builder.cleanup() |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
380 |
|
|
1448
by Robert Collins
revert symlinks correctly |
381 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
382 |
class FunctionalMergeTest(TestCaseWithTransport): |
|
1092.1.25
by Robert Collins
prepare to write merge tests |
383 |
|
384 |
def test_trivial_star_merge(self): |
|
385 |
"""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 |
386 |
# John starts a branch
|
|
1092.1.26
by Robert Collins
start writing star-topology test, realise we need smart-add change |
387 |
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. |
388 |
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. |
389 |
branch = tree.branch |
|
1185.53.2
by Michael Ellerman
Add tests for bzr add --dry-run |
390 |
smart_add_tree(tree, ["original"]) |
|
1508.1.10
by Robert Collins
bzrlib.add.smart_add_branch is now smart_add_tree. (Robert Collins) |
391 |
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 |
392 |
# Mary branches it.
|
|
1092.1.34
by Robert Collins
unbreak cmd_branch now that something tests the core of it.. |
393 |
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. |
394 |
branch.bzrdir.clone("mary") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
395 |
# Now John commits a change
|
396 |
file = open("original/file1", "wt") |
|
397 |
file.write("John\n") |
|
398 |
file.close() |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
399 |
tree.commit("change file1") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
400 |
# Mary does too
|
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
401 |
mary_tree = WorkingTree.open('mary') |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
402 |
mary_branch = mary_tree.branch |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
403 |
file = open("mary/file2", "wt") |
404 |
file.write("Mary\n") |
|
405 |
file.close() |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
406 |
mary_tree.commit("change file2") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
407 |
# john should be able to merge with no conflicts.
|
|
1534.7.84
by Aaron Bentley
Added reprocess support, support for varying merge types |
408 |
merge_type = Merge3Merger |
|
1092.1.41
by Robert Collins
merge from abently, take his fixes for merge in preference |
409 |
base = [None, None] |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
410 |
other = ("mary", -1) |
|
1185.12.87
by Aaron Bentley
Updated NEWS, error out if --show-base supplied and unsupported |
411 |
self.assertRaises(BzrCommandError, merge, other, base, check_clean=True, |
|
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
412 |
merge_type=WeaveMerger, this_dir="original", |
|
1185.12.87
by Aaron Bentley
Updated NEWS, error out if --show-base supplied and unsupported |
413 |
show_base=True) |
414 |
merge(other, base, check_clean=True, merge_type=merge_type, |
|
415 |
this_dir="original") |
|
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
416 |
self.assertEqual("John\n", open("original/file1", "rt").read()) |
417 |
self.assertEqual("Mary\n", open("original/file2", "rt").read()) |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
418 |
|
419 |
def test_conflicts(self): |
|
420 |
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. |
421 |
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. |
422 |
a = wta.branch |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
423 |
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. |
424 |
wta.add('file') |
425 |
wta.commit('base revision', allow_pointless=False) |
|
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
426 |
d_b = a.bzrdir.clone('b') |
427 |
b = d_b.open_branch() |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
428 |
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. |
429 |
wta.commit('other revision', allow_pointless=False) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
430 |
file('b/file', 'wb').write('this contents contents\n') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
431 |
wtb = d_b.open_workingtree() |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
432 |
wtb.commit('this revision', allow_pointless=False) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
433 |
self.assertEqual(merge(['a', -1], [None, None], this_dir='b'), 1) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
434 |
self.assert_(os.path.lexists('b/file.THIS')) |
435 |
self.assert_(os.path.lexists('b/file.BASE')) |
|
436 |
self.assert_(os.path.lexists('b/file.OTHER')) |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
437 |
self.assertRaises(WorkingTreeNotRevision, merge, ['a', -1], |
438 |
[None, None], this_dir='b', check_clean=False, |
|
|
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
439 |
merge_type=WeaveMerger) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
440 |
wtb.revert([]) |
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
441 |
self.assertEqual(merge(['a', -1], [None, None], this_dir='b', |
|
1534.7.124
by Aaron Bentley
Fixed merge_core bug |
442 |
check_clean=False, merge_type=WeaveMerger), 1) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
443 |
self.assert_(os.path.lexists('b/file')) |
444 |
self.assert_(os.path.lexists('b/file.THIS')) |
|
445 |
self.assert_(not os.path.lexists('b/file.BASE')) |
|
446 |
self.assert_(os.path.lexists('b/file.OTHER')) |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
447 |
|
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
448 |
def test_merge_unrelated(self): |
449 |
"""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. |
450 |
wta = self.make_branch_and_tree('a') |
451 |
a = wta.branch |
|
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
452 |
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. |
453 |
wta.add('a_file') |
454 |
wta.commit('a_revision', allow_pointless=False) |
|
455 |
wtb = self.make_branch_and_tree('b') |
|
456 |
b = wtb.branch |
|
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
457 |
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. |
458 |
wtb.add('b_file') |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
459 |
b_rev = wtb.commit('b_revision', allow_pointless=False) |
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
460 |
merge(['b', -1], ['b', 0], this_dir='a') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
461 |
self.assert_(os.path.lexists('a/b_file')) |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
462 |
self.assertEqual([b_rev], wta.get_parent_ids()[1:]) |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
463 |
|
464 |
def test_merge_unrelated_conflicting(self): |
|
465 |
"""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. |
466 |
wta = self.make_branch_and_tree('a') |
467 |
a = wta.branch |
|
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
468 |
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. |
469 |
wta.add('file') |
470 |
wta.commit('a_revision', allow_pointless=False) |
|
471 |
wtb = self.make_branch_and_tree('b') |
|
472 |
b = wtb.branch |
|
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
473 |
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. |
474 |
wtb.add('file') |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
475 |
b_rev = wtb.commit('b_revision', allow_pointless=False) |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
476 |
merge(['b', -1], ['b', 0], this_dir='a') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
477 |
self.assert_(os.path.lexists('a/file')) |
478 |
self.assert_(os.path.lexists('a/file.moved')) |
|
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
479 |
self.assertEqual([b_rev], wta.get_parent_ids()[1:]) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
480 |
|
481 |
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. |
482 |
wta = self.make_branch_and_tree('a') |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
483 |
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. |
484 |
wta.add('file') |
485 |
wta.commit('a_revision', allow_pointless=False) |
|
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
486 |
self.run_bzr('branch', 'a', 'b') |
487 |
os.remove('a/file') |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
488 |
wta.commit('removed file', allow_pointless=False) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
489 |
file('b/file', 'wb').write('changed contents\n') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
490 |
wtb = WorkingTree.open('b') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
491 |
wtb.commit('changed file', allow_pointless=False) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
492 |
merge(['a', -1], ['a', 1], this_dir='b') |
493 |
self.failIf(os.path.lexists('b/file')) |
|
494 |
||
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
495 |
def test_merge_metadata_vs_deletion(self): |
496 |
"""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. |
497 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
498 |
file('a/file', 'wb').write('contents\n') |
|
1508.1.15
by Robert Collins
Merge from mpool. |
499 |
a_wt.add('file') |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
500 |
a_wt.commit('r0') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
501 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
502 |
b_wt = WorkingTree.open('b') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
503 |
os.chmod('b/file', 0755) |
504 |
os.remove('a/file') |
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
505 |
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. |
506 |
self.assertEqual(a_wt.branch.revno(), 2) |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
507 |
self.assertFalse(os.path.exists('a/file')) |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
508 |
b_wt.commit('exec a') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
509 |
merge(['b', -1], ['b', 0], this_dir='a') |
510 |
self.assert_(os.path.exists('a/file')) |
|
|
1185.31.14
by John Arbash Meinel
[merge] bzr.dev |
511 |
|
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
512 |
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. |
513 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
514 |
file('a/un','wb').write('UN') |
515 |
file('a/deux','wb').write('DEUX') |
|
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
516 |
a_wt.add('un', 'un') |
517 |
a_wt.add('deux', 'deux') |
|
518 |
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. |
519 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
520 |
b_wt = WorkingTree.open('b') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
521 |
b_wt.rename_one('un','tmp') |
522 |
b_wt.rename_one('deux','un') |
|
523 |
b_wt.rename_one('tmp','deux') |
|
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
524 |
b_wt.commit('r1', rev_id='r1') |
525 |
self.assertEqual(0, merge(['b', -1], ['b', 1], this_dir='a')) |
|
526 |
self.failUnlessExists('a/un') |
|
527 |
self.failUnless('a/deux') |
|
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
528 |
self.assertFalse(os.path.exists('a/tmp')) |
529 |
self.assertEqual(file('a/un').read(),'DEUX') |
|
530 |
self.assertEqual(file('a/deux').read(),'UN') |
|
531 |
||
532 |
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. |
533 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
534 |
file('a/file', 'wb').write('THIS') |
535 |
a_wt.add('file') |
|
536 |
a_wt.commit('r0') |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
537 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
538 |
b_wt = WorkingTree.open('b') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
539 |
os.remove('b/file') |
540 |
b_wt.commit('r1') |
|
541 |
file('b/file', 'wb').write('THAT') |
|
542 |
b_wt.add('file') |
|
543 |
b_wt.commit('r2') |
|
544 |
merge(['b', -1],['b', 1],this_dir='a') |
|
545 |
self.assert_(os.path.exists('a/file')) |
|
546 |
self.assertEqual(file('a/file').read(),'THAT') |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
547 |
|
548 |
def test_merge_rename_before_create(self): |
|
549 |
"""rename before create |
|
550 |
|
|
551 |
This case requires that you must not do creates
|
|
552 |
before move-into-place:
|
|
553 |
||
554 |
$ touch foo
|
|
555 |
$ bzr add foo
|
|
556 |
$ bzr commit
|
|
557 |
$ bzr mv foo bar
|
|
558 |
$ touch foo
|
|
559 |
$ bzr add foo
|
|
560 |
$ bzr commit
|
|
561 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
562 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
563 |
file('a/foo', 'wb').write('A/FOO') |
564 |
a_wt.add('foo') |
|
565 |
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. |
566 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
567 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
568 |
b_wt.rename_one('foo', 'bar') |
569 |
file('b/foo', 'wb').write('B/FOO') |
|
570 |
b_wt.add('foo') |
|
571 |
b_wt.commit('moved foo to bar, added new foo') |
|
572 |
merge(['b', -1],['b', 1],this_dir='a') |
|
573 |
||
574 |
def test_merge_create_before_rename(self): |
|
575 |
"""create before rename, target parents before children |
|
576 |
||
577 |
This case requires that you must not do move-into-place
|
|
578 |
before creates, and that you must not do children after
|
|
579 |
parents:
|
|
580 |
||
581 |
$ touch foo
|
|
582 |
$ bzr add foo
|
|
583 |
$ bzr commit
|
|
584 |
$ bzr mkdir bar
|
|
585 |
$ bzr add bar
|
|
586 |
$ bzr mv foo bar/foo
|
|
587 |
$ bzr commit
|
|
588 |
"""
|
|
589 |
os.mkdir('a') |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
590 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
591 |
file('a/foo', 'wb').write('A/FOO') |
592 |
a_wt.add('foo') |
|
593 |
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. |
594 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
595 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
596 |
os.mkdir('b/bar') |
597 |
b_wt.add('bar') |
|
598 |
b_wt.rename_one('foo', 'bar/foo') |
|
599 |
b_wt.commit('created bar dir, moved foo into bar') |
|
600 |
merge(['b', -1],['b', 1],this_dir='a') |
|
601 |
||
602 |
def test_merge_rename_to_temp_before_delete(self): |
|
603 |
"""rename to temp before delete, source children before parents |
|
604 |
||
605 |
This case requires that you must not do deletes before
|
|
606 |
move-out-of-the-way, and that you must not do children
|
|
607 |
after parents:
|
|
608 |
|
|
609 |
$ mkdir foo
|
|
610 |
$ touch foo/bar
|
|
611 |
$ bzr add foo/bar
|
|
612 |
$ bzr commit
|
|
613 |
$ bzr mv foo/bar bar
|
|
614 |
$ rmdir foo
|
|
615 |
$ bzr commit
|
|
616 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
617 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
618 |
os.mkdir('a/foo') |
619 |
file('a/foo/bar', 'wb').write('A/FOO/BAR') |
|
620 |
a_wt.add('foo') |
|
621 |
a_wt.add('foo/bar') |
|
622 |
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. |
623 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
624 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
625 |
b_wt.rename_one('foo/bar', 'bar') |
626 |
os.rmdir('b/foo') |
|
627 |
b_wt.remove('foo') |
|
628 |
b_wt.commit('moved foo/bar to bar, deleted foo') |
|
629 |
merge(['b', -1],['b', 1],this_dir='a') |
|
630 |
||
631 |
def test_merge_delete_before_rename_to_temp(self): |
|
632 |
"""delete before rename to temp |
|
633 |
||
634 |
This case requires that you must not do
|
|
635 |
move-out-of-the-way before deletes:
|
|
636 |
|
|
637 |
$ touch foo
|
|
638 |
$ touch bar
|
|
639 |
$ bzr add foo bar
|
|
640 |
$ bzr commit
|
|
641 |
$ rm foo
|
|
642 |
$ bzr rm foo
|
|
643 |
$ bzr mv bar foo
|
|
644 |
$ bzr commit
|
|
645 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
646 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
647 |
file('a/foo', 'wb').write('A/FOO') |
648 |
file('a/bar', 'wb').write('A/BAR') |
|
649 |
a_wt.add('foo') |
|
650 |
a_wt.add('bar') |
|
651 |
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. |
652 |
self.run_bzr('branch', 'a', 'b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
653 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
654 |
os.unlink('b/foo') |
655 |
b_wt.remove('foo') |
|
656 |
b_wt.rename_one('bar', 'foo') |
|
657 |
b_wt.commit('deleted foo, renamed bar to foo') |
|
658 |
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. |
659 |