bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2052.3.1
by John Arbash Meinel
Add tests to cleanup the copyright of all source files |
1 |
# Copyright (C) 2005, 2006 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
2052.3.1
by John Arbash Meinel
Add tests to cleanup the copyright of all source files |
16 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
17 |
import os |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
18 |
import sys |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
19 |
|
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
20 |
import bzrlib |
|
1996.3.18
by John Arbash Meinel
Now that mkdtemp and rmtree are lazy, they should not be directly improted. |
21 |
from bzrlib import ( |
|
4869.2.4
by Andrew Bennetts
Delete some unused imports in test_merge_core. |
22 |
errors, |
|
2116.4.1
by John Arbash Meinel
Update file and revision id generators. |
23 |
generate_ids, |
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
24 |
merge_directive, |
|
1996.3.18
by John Arbash Meinel
Now that mkdtemp and rmtree are lazy, they should not be directly improted. |
25 |
osutils, |
26 |
)
|
|
|
1534.10.20
by Aaron Bentley
Got all tests passing |
27 |
from bzrlib.conflicts import ContentsConflict, TextConflict, PathConflict |
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
28 |
from bzrlib.merge import ( |
29 |
Merge3Merger, |
|
30 |
Diff3Merger, |
|
31 |
WeaveMerger, |
|
32 |
Merger, |
|
33 |
)
|
|
|
4869.2.4
by Andrew Bennetts
Delete some unused imports in test_merge_core. |
34 |
from bzrlib.osutils import getcwd, pathjoin |
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
35 |
from bzrlib import progress |
|
1534.7.140
by Aaron Bentley
Moved the merge stuff into merge.py |
36 |
from bzrlib.transform import TreeTransform |
|
4869.2.4
by Andrew Bennetts
Delete some unused imports in test_merge_core. |
37 |
from bzrlib.tests import TestCaseWithTransport, TestSkipped |
|
2116.4.1
by John Arbash Meinel
Update file and revision id generators. |
38 |
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 |
39 |
|
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
40 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
41 |
class MergeBuilder(object): |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
42 |
def __init__(self, dir=None): |
|
1996.3.18
by John Arbash Meinel
Now that mkdtemp and rmtree are lazy, they should not be directly improted. |
43 |
self.dir = osutils.mkdtemp(prefix="merge-test", dir=dir) |
|
2116.4.1
by John Arbash Meinel
Update file and revision id generators. |
44 |
self.tree_root = generate_ids.gen_root_id() |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
45 |
def wt(name): |
46 |
path = pathjoin(self.dir, name) |
|
47 |
os.mkdir(path) |
|
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
48 |
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 |
49 |
# the tests perform pulls, so need a branch that is writeable.
|
50 |
wt.lock_write() |
|
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
51 |
wt.set_root_id(self.tree_root) |
|
2255.7.14
by John Arbash Meinel
Make set_root_id() a no-op if the id doesn't change, |
52 |
wt.flush() |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
53 |
tt = TreeTransform(wt) |
54 |
return wt, tt |
|
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
55 |
self.base, self.base_tt = wt('base') |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
56 |
self.this, self.this_tt = wt('this') |
57 |
self.other, self.other_tt = wt('other') |
|
|
1185.50.33
by John Arbash Meinel
Whitespace cleanups. |
58 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
59 |
def get_cset_path(self, parent, name): |
60 |
if name is None: |
|
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
61 |
if parent is not None: |
62 |
raise AssertionError() |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
63 |
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 \ |
64 |
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 |
65 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
66 |
def add_file(self, id, parent, name, contents, executable, this=True, |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
67 |
base=True, other=True): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
68 |
def new_file(tt): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
69 |
parent_id = tt.trans_id_file_id(parent) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
70 |
tt.new_file(name, parent_id, contents, id, executable) |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
71 |
for option, tt in self.selected_transforms(this, base, other): |
72 |
if option is True: |
|
73 |
new_file(tt) |
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
74 |
|
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
75 |
def merge(self, merge_type=Merge3Merger, interesting_ids=None, **kwargs): |
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
76 |
self.base_tt.apply() |
77 |
self.base.commit('base commit') |
|
78 |
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. |
79 |
# why does this not do wt.pull() ?
|
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
80 |
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. |
81 |
wt.set_parent_ids([wt.branch.last_revision()]) |
|
2255.7.14
by John Arbash Meinel
Make set_root_id() a no-op if the id doesn't change, |
82 |
wt.flush() |
83 |
# We maintain a write lock, so make sure changes are flushed to
|
|
84 |
# disk first
|
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
85 |
tt.apply() |
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
86 |
wt.commit('branch commit') |
|
2255.7.14
by John Arbash Meinel
Make set_root_id() a no-op if the id doesn't change, |
87 |
wt.flush() |
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
88 |
if len(wt.branch.revision_history()) != 2: |
89 |
raise AssertionError() |
|
|
1559.1.1
by Robert Collins
Merge in InterRepository API support. |
90 |
self.this.branch.fetch(self.other.branch) |
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
91 |
other_basis = self.other.branch.basis_tree() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
92 |
merger = merge_type(self.this, self.this, self.base, other_basis, |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
93 |
interesting_ids=interesting_ids, **kwargs) |
|
1534.7.131
by Aaron Bentley
Work on cooked conflicts |
94 |
return merger.cooked_conflicts |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
95 |
|
96 |
def list_transforms(self): |
|
97 |
return [self.this_tt, self.base_tt, self.other_tt] |
|
98 |
||
99 |
def selected_transforms(self, this, base, other): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
100 |
pairs = [(this, self.this_tt), (base, self.base_tt), |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
101 |
(other, self.other_tt)] |
102 |
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 |
103 |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
104 |
def add_symlink(self, id, parent, name, contents): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
105 |
for tt in self.list_transforms(): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
106 |
parent_id = tt.trans_id_file_id(parent) |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
107 |
tt.new_symlink(name, parent_id, contents, id) |
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
108 |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
109 |
def remove_file(self, file_id, base=False, this=False, other=False): |
110 |
for option, tt in self.selected_transforms(this, base, other): |
|
111 |
if option is True: |
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
112 |
trans_id = tt.trans_id_file_id(file_id) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
113 |
tt.cancel_creation(trans_id) |
114 |
tt.cancel_versioning(trans_id) |
|
115 |
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 |
116 |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
117 |
def add_dir(self, file_id, parent, name): |
118 |
for tt in self.list_transforms(): |
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
119 |
parent_id = tt.trans_id_file_id(parent) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
120 |
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 |
121 |
|
122 |
def change_name(self, id, base=None, this=None, other=None): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
123 |
for val, tt in ((base, self.base_tt), (this, self.this_tt), |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
124 |
(other, self.other_tt)): |
125 |
if val is None: |
|
126 |
continue
|
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
127 |
trans_id = tt.trans_id_file_id(id) |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
128 |
parent_id = tt.final_parent(trans_id) |
129 |
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 |
130 |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
131 |
def change_parent(self, file_id, base=None, this=None, other=None): |
132 |
for parent, tt in self.selected_transforms(this, base, other): |
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
133 |
trans_id = tt.trans_id_file_id(file_id) |
134 |
parent_id = tt.trans_id_file_id(parent) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
135 |
tt.adjust_path(tt.final_name(trans_id), parent_id, trans_id) |
136 |
||
137 |
def change_contents(self, file_id, base=None, this=None, other=None): |
|
138 |
for contents, tt in self.selected_transforms(this, base, other): |
|
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
139 |
trans_id = tt.trans_id_file_id(file_id) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
140 |
tt.cancel_creation(trans_id) |
141 |
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 |
142 |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
143 |
def change_target(self, id, base=None, this=None, other=None): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
144 |
for target, tt in self.selected_transforms(this, base, other): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
145 |
trans_id = tt.trans_id_file_id(id) |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
146 |
tt.cancel_creation(trans_id) |
147 |
tt.create_symlink(target, trans_id) |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
148 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
149 |
def change_perms(self, id, base=None, this=None, other=None): |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
150 |
for executability, tt in self.selected_transforms(this, base, other): |
|
1534.7.181
by Aaron Bentley
Renamed a bunch of functions |
151 |
trans_id = tt.trans_id_file_id(id) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
152 |
tt.set_executability(None, trans_id) |
153 |
tt.set_executability(executability, trans_id) |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
154 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
155 |
def change_perms_tree(self, id, tree, mode): |
156 |
os.chmod(tree.full_path(id), mode) |
|
157 |
||
158 |
def apply_inv_change(self, inventory_change, orig_inventory): |
|
159 |
orig_inventory_by_path = {} |
|
160 |
for file_id, path in orig_inventory.iteritems(): |
|
161 |
orig_inventory_by_path[path] = file_id |
|
162 |
||
163 |
def parent_id(file_id): |
|
164 |
try: |
|
165 |
parent_dir = os.path.dirname(orig_inventory[file_id]) |
|
166 |
except: |
|
167 |
print file_id |
|
168 |
raise
|
|
169 |
if parent_dir == "": |
|
170 |
return None |
|
171 |
return orig_inventory_by_path[parent_dir] |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
172 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
173 |
def new_path(file_id): |
|
1963.2.1
by Robey Pointer
remove usage of has_key() |
174 |
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 |
175 |
return inventory_change[file_id] |
176 |
else: |
|
177 |
parent = parent_id(file_id) |
|
178 |
if parent is None: |
|
179 |
return orig_inventory[file_id] |
|
180 |
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. |
181 |
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 |
182 |
|
183 |
new_inventory = {} |
|
184 |
for file_id in orig_inventory.iterkeys(): |
|
185 |
path = new_path(file_id) |
|
186 |
if path is None: |
|
187 |
continue
|
|
188 |
new_inventory[file_id] = path |
|
189 |
||
190 |
for file_id, path in inventory_change.iteritems(): |
|
|
1963.2.1
by Robey Pointer
remove usage of has_key() |
191 |
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 |
192 |
continue
|
193 |
new_inventory[file_id] = path |
|
194 |
return new_inventory |
|
195 |
||
|
1551.8.39
by Aaron Bentley
Fix diff3 conflict-reporting bug |
196 |
def unlock(self): |
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
197 |
self.base.unlock() |
198 |
self.this.unlock() |
|
199 |
self.other.unlock() |
|
|
1551.8.39
by Aaron Bentley
Fix diff3 conflict-reporting bug |
200 |
|
201 |
def cleanup(self): |
|
202 |
self.unlock() |
|
|
1996.3.18
by John Arbash Meinel
Now that mkdtemp and rmtree are lazy, they should not be directly improted. |
203 |
osutils.rmtree(self.dir) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
204 |
|
|
1448
by Robert Collins
revert symlinks correctly |
205 |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
206 |
class MergeTest(TestCaseWithTransport): |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
207 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
208 |
def test_change_name(self): |
209 |
"""Test renames""" |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
210 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
211 |
builder.add_file("1", builder.tree_root, "name1", "hello1", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
212 |
builder.change_name("1", other="name2") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
213 |
builder.add_file("2", builder.tree_root, "name3", "hello2", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
214 |
builder.change_name("2", base="name4") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
215 |
builder.add_file("3", builder.tree_root, "name5", "hello3", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
216 |
builder.change_name("3", this="name6") |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
217 |
builder.merge() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
218 |
builder.cleanup() |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
219 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
220 |
builder.add_file("1", builder.tree_root, "name1", "hello1", False) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
221 |
builder.change_name("1", other="name2", this="name3") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
222 |
conflicts = builder.merge() |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
223 |
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 |
224 |
builder.cleanup() |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
225 |
|
226 |
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 |
227 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
228 |
builder.add_file("1", builder.tree_root, "name1", "hello1", True) |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
229 |
builder.change_contents("1", other="text4") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
230 |
builder.add_file("2", builder.tree_root, "name2", "hello1", True) |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
231 |
builder.change_contents("2", other="text4") |
232 |
builder.merge(interesting_ids=["1"]) |
|
233 |
self.assertEqual(builder.this.get_file("1").read(), "text4" ) |
|
234 |
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 |
235 |
builder.cleanup() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
236 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
237 |
def test_file_moves(self): |
238 |
"""Test moves""" |
|
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
239 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
240 |
builder.add_dir("1", builder.tree_root, "dir1") |
241 |
builder.add_dir("2", builder.tree_root, "dir2") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
242 |
builder.add_file("3", "1", "file1", "hello1", True) |
243 |
builder.add_file("4", "1", "file2", "hello2", True) |
|
244 |
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 |
245 |
builder.change_parent("3", other="2") |
246 |
builder.change_parent("4", this="2") |
|
247 |
builder.change_parent("5", base="2") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
248 |
builder.merge() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
249 |
builder.cleanup() |
250 |
||
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
251 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
252 |
builder.add_dir("1", builder.tree_root, "dir1") |
253 |
builder.add_dir("2", builder.tree_root, "dir2") |
|
254 |
builder.add_dir("3", builder.tree_root, "dir3") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
255 |
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 |
256 |
builder.change_parent("4", other="2", this="3") |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
257 |
conflicts = builder.merge() |
|
1534.7.176
by abentley
Fixed up tests for Windows |
258 |
path2 = pathjoin('dir2', 'file1') |
259 |
path3 = pathjoin('dir3', 'file1') |
|
|
1534.10.20
by Aaron Bentley
Got all tests passing |
260 |
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 |
261 |
builder.cleanup() |
262 |
||
263 |
def test_contents_merge(self): |
|
264 |
"""Test merge3 merging""" |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
265 |
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 |
266 |
|
267 |
def test_contents_merge2(self): |
|
268 |
"""Test diff3 merging""" |
|
|
2240.1.2
by Alexander Belchenko
test_contents_merge2: skip this test on win32 |
269 |
if sys.platform == 'win32': |
270 |
raise TestSkipped("diff3 does not have --binary flag" |
|
271 |
" and therefore always fails on win32") |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
272 |
try: |
273 |
self.do_contents_test(Diff3Merger) |
|
|
4869.2.4
by Andrew Bennetts
Delete some unused imports in test_merge_core. |
274 |
except errors.NoDiff3: |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
275 |
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 |
276 |
|
|
1534.7.136
by Aaron Bentley
Got WeaveMerger under test |
277 |
def test_contents_merge3(self): |
278 |
"""Test diff3 merging""" |
|
279 |
self.do_contents_test(WeaveMerger) |
|
280 |
||
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
281 |
def test_reprocess_weave(self): |
282 |
# 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 |
283 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
284 |
builder.add_file('a', builder.tree_root, 'blah', 'a', False) |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
285 |
builder.change_contents('a', this='b\nc\nd\ne\n', other='z\nc\nd\ny\n') |
286 |
builder.merge(WeaveMerger, reprocess=True) |
|
287 |
expected = """<<<<<<< TREE |
|
288 |
b
|
|
289 |
=======
|
|
290 |
z
|
|
291 |
>>>>>>> MERGE-SOURCE
|
|
292 |
c
|
|
293 |
d
|
|
294 |
<<<<<<< TREE
|
|
295 |
e
|
|
296 |
=======
|
|
297 |
y
|
|
298 |
>>>>>>> MERGE-SOURCE
|
|
299 |
"""
|
|
300 |
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 |
301 |
builder.cleanup() |
|
1551.6.8
by Aaron Bentley
Implemented reprocess for weave |
302 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
303 |
def do_contents_test(self, merge_factory): |
304 |
"""Test merging with specified ContentsChange factory""" |
|
305 |
builder = self.contents_test_success(merge_factory) |
|
306 |
builder.cleanup() |
|
307 |
self.contents_test_conflicts(merge_factory) |
|
308 |
||
309 |
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 |
310 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
311 |
builder.add_file("1", builder.tree_root, "name1", "text1", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
312 |
builder.change_contents("1", other="text4") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
313 |
builder.add_file("2", builder.tree_root, "name3", "text2", False) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
314 |
builder.change_contents("2", base="text5") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
315 |
builder.add_file("3", builder.tree_root, "name5", "text3", True) |
316 |
builder.add_file("4", builder.tree_root, "name6", "text4", True) |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
317 |
builder.remove_file("4", base=True) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
318 |
builder.add_file("5", builder.tree_root, "name7", "a\nb\nc\nd\ne\nf\n", |
319 |
True) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
320 |
builder.change_contents("5", other="a\nz\nc\nd\ne\nf\n", |
|
1558.6.4
by Aaron Bentley
Fixed merge-type weave |
321 |
this="a\nb\nc\nd\ne\nz\n") |
|
1551.8.39
by Aaron Bentley
Fix diff3 conflict-reporting bug |
322 |
conflicts = builder.merge(merge_factory) |
323 |
try: |
|
324 |
self.assertEqual([], conflicts) |
|
|
1551.8.40
by Aaron Bentley
Update test case style |
325 |
self.assertEqual("text4", builder.this.get_file("1").read()) |
326 |
self.assertEqual("text2", builder.this.get_file("2").read()) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
327 |
self.assertEqual("a\nz\nc\nd\ne\nz\n", |
|
1551.8.40
by Aaron Bentley
Update test case style |
328 |
builder.this.get_file("5").read()) |
329 |
self.assertTrue(builder.this.is_executable("1")) |
|
330 |
self.assertFalse(builder.this.is_executable("2")) |
|
331 |
self.assertTrue(builder.this.is_executable("3")) |
|
|
1551.8.39
by Aaron Bentley
Fix diff3 conflict-reporting bug |
332 |
except: |
333 |
builder.unlock() |
|
334 |
raise
|
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
335 |
return builder |
336 |
||
337 |
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 |
338 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
339 |
builder.add_file("1", builder.tree_root, "name1", "text1", True) |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
340 |
builder.change_contents("1", other="text4", this="text3") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
341 |
builder.add_file("2", builder.tree_root, "name2", "text1", True) |
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
342 |
builder.change_contents("2", other="\x00", this="text3") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
343 |
builder.add_file("3", builder.tree_root, "name3", "text5", False) |
|
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
344 |
builder.change_perms("3", this=True) |
345 |
builder.change_contents('3', this='moretext') |
|
346 |
builder.remove_file('3', other=True) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
347 |
conflicts = builder.merge(merge_factory) |
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
348 |
self.assertEqual(conflicts, [TextConflict('name1', file_id='1'), |
|
1534.10.35
by Aaron Bentley
Merge handles contents + executable + deletion conflict |
349 |
ContentsConflict('name2', file_id='2'), |
350 |
ContentsConflict('name3', file_id='3')]) |
|
|
1558.15.3
by Aaron Bentley
Handle binary files for diff3 merges |
351 |
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 |
352 |
builder.cleanup() |
353 |
||
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
354 |
def test_symlink_conflicts(self): |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
355 |
if sys.platform != "win32": |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
356 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
357 |
builder.add_symlink("2", builder.tree_root, "name2", "target1") |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
358 |
builder.change_target("2", other="target4", base="text3") |
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
359 |
conflicts = builder.merge() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
360 |
self.assertEqual(conflicts, [ContentsConflict('name2', |
|
1534.10.20
by Aaron Bentley
Got all tests passing |
361 |
file_id='2')]) |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
362 |
builder.cleanup() |
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
363 |
|
|
1185.12.34
by Aaron Bentley
Added symlink three-way tests |
364 |
def test_symlink_merge(self): |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
365 |
if sys.platform != "win32": |
|
1711.7.21
by John Arbash Meinel
Run the merge_core tests underneath the current test directory, rather than TEMP |
366 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
367 |
builder.add_symlink("1", builder.tree_root, "name1", "target1") |
368 |
builder.add_symlink("2", builder.tree_root, "name2", "target1") |
|
369 |
builder.add_symlink("3", builder.tree_root, "name3", "target1") |
|
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
370 |
builder.change_target("1", this="target2") |
371 |
builder.change_target("2", base="target2") |
|
372 |
builder.change_target("3", other="target2") |
|
|
1534.7.129
by Aaron Bentley
Converted test cases to Tree Transform |
373 |
builder.merge() |
|
1185.38.9
by John Arbash Meinel
[patch] Alexander Belchenko patch #9, skip stat tests for win32 |
374 |
self.assertEqual(builder.this.get_symlink_target("1"), "target2") |
375 |
self.assertEqual(builder.this.get_symlink_target("2"), "target1") |
|
376 |
self.assertEqual(builder.this.get_symlink_target("3"), "target2") |
|
377 |
builder.cleanup() |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
378 |
|
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
379 |
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 |
380 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
381 |
builder.add_file("1", builder.tree_root, "name1", "text1", True) |
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
382 |
builder.remove_file("1", this=True) |
383 |
builder.merge() |
|
|
1534.7.146
by Aaron Bentley
Fixed merge so tree root is auto-preserved, not by conflict resolution |
384 |
builder.cleanup() |
|
1534.7.143
by Aaron Bentley
Prevented get_trans_id from automatically versioning file ids |
385 |
|
|
1092.1.24
by Robert Collins
move merge_core tests into the selftest package. Also reduce double-run of those tests |
386 |
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 |
387 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
388 |
builder.add_file("1", builder.tree_root, "name1", "text1", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
389 |
builder.change_perms("1", other=False) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
390 |
builder.add_file("2", builder.tree_root, "name2", "text2", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
391 |
builder.change_perms("2", base=False) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
392 |
builder.add_file("3", builder.tree_root, "name3", "text3", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
393 |
builder.change_perms("3", this=False) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
394 |
builder.add_file('4', builder.tree_root, 'name4', 'text4', False) |
|
1534.7.142
by Aaron Bentley
Fixed executability conflicts |
395 |
builder.change_perms('4', this=True) |
396 |
builder.remove_file('4', base=True) |
|
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
397 |
builder.merge() |
398 |
self.assertIs(builder.this.is_executable("1"), False) |
|
399 |
self.assertIs(builder.this.is_executable("2"), True) |
|
400 |
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 |
401 |
builder.cleanup(); |
|
1092.1.25
by Robert Collins
prepare to write merge tests |
402 |
|
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
403 |
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 |
404 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
405 |
builder.add_file("1", builder.tree_root, "name1", "text1", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
406 |
builder.change_contents("1", other="text3") |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
407 |
builder.add_file("2", builder.tree_root, "name1.new", "text2", True) |
|
1534.7.130
by Aaron Bentley
More conflict handling, test porting |
408 |
builder.merge() |
409 |
os.lstat(builder.this.id2abspath("2")) |
|
410 |
builder.cleanup() |
|
|
1185.50.50
by John Arbash Meinel
[patch] Aaron Bentley: Merge deletes foo.new |
411 |
|
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
412 |
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 |
413 |
builder = MergeBuilder(getcwd()) |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
414 |
builder.add_file("1", builder.tree_root, "name1", "text1", False) |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
415 |
builder.remove_file("1", other=True) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
416 |
builder.add_file("2", builder.tree_root, "name1", "text1", False, |
|
1731.1.33
by Aaron Bentley
Revert no-special-root changes |
417 |
this=False, base=False) |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
418 |
conflicts = builder.merge() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
419 |
self.assertEqual(conflicts, []) |
|
1997.1.3
by Robert Collins
All WorkingTree methods which write to the tree, but not to the branch |
420 |
builder.cleanup() |
|
1558.7.12
by Aaron Bentley
Additional spurious conflict test |
421 |
|
|
2590.2.5
by Aaron Bentley
Allow selected files to be specified instead of selected ids |
422 |
def test_merge_one_renamed(self): |
423 |
builder = MergeBuilder(getcwd()) |
|
424 |
builder.add_file('1', builder.tree_root, 'name1', 'text1a', False) |
|
425 |
builder.change_name('1', this='name2') |
|
426 |
builder.change_contents('1', other='text2') |
|
427 |
builder.merge(interesting_files=['name2']) |
|
428 |
self.assertEqual('text2', builder.this.get_file('1').read()) |
|
429 |
builder.cleanup() |
|
|
1448
by Robert Collins
revert symlinks correctly |
430 |
|
|
4869.3.1
by Andrew Bennetts
Basic per-file merge hook. |
431 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
432 |
class FunctionalMergeTest(TestCaseWithTransport): |
|
1092.1.25
by Robert Collins
prepare to write merge tests |
433 |
|
434 |
def test_trivial_star_merge(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
435 |
"""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 |
436 |
# John starts a branch
|
|
1092.1.26
by Robert Collins
start writing star-topology test, realise we need smart-add change |
437 |
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. |
438 |
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. |
439 |
branch = tree.branch |
|
2568.2.7
by Robert Collins
Fix missed tests. |
440 |
tree.smart_add(["original"]) |
|
1508.1.10
by Robert Collins
bzrlib.add.smart_add_branch is now smart_add_tree. (Robert Collins) |
441 |
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 |
442 |
# Mary branches it.
|
|
1092.1.34
by Robert Collins
unbreak cmd_branch now that something tests the core of it.. |
443 |
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. |
444 |
branch.bzrdir.clone("mary") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
445 |
# Now John commits a change
|
446 |
file = open("original/file1", "wt") |
|
447 |
file.write("John\n") |
|
448 |
file.close() |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
449 |
tree.commit("change file1") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
450 |
# Mary does too
|
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
451 |
mary_tree = WorkingTree.open('mary') |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
452 |
mary_branch = mary_tree.branch |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
453 |
file = open("mary/file2", "wt") |
454 |
file.write("Mary\n") |
|
455 |
file.close() |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
456 |
mary_tree.commit("change file2") |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
457 |
# john should be able to merge with no conflicts.
|
|
1092.1.41
by Robert Collins
merge from abently, take his fixes for merge in preference |
458 |
base = [None, None] |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
459 |
other = ("mary", -1) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
460 |
tree.merge_from_branch(mary_tree.branch) |
|
1092.1.38
by Robert Collins
make a default merge choose a sane base with branch.common_ancestor |
461 |
self.assertEqual("John\n", open("original/file1", "rt").read()) |
462 |
self.assertEqual("Mary\n", open("original/file2", "rt").read()) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
463 |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
464 |
def test_conflicts(self): |
|
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. |
465 |
wta = self.make_branch_and_tree('a') |
|
4634.101.12
by John Arbash Meinel
Clean up the test_conflicts file for newer apis. |
466 |
self.build_tree_contents([('a/file', 'contents\n')]) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
467 |
wta.add('file') |
468 |
wta.commit('base revision', allow_pointless=False) |
|
|
4634.101.12
by John Arbash Meinel
Clean up the test_conflicts file for newer apis. |
469 |
d_b = wta.branch.bzrdir.clone('b') |
470 |
self.build_tree_contents([('a/file', 'other contents\n')]) |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
471 |
wta.commit('other revision', allow_pointless=False) |
|
4634.101.12
by John Arbash Meinel
Clean up the test_conflicts file for newer apis. |
472 |
self.build_tree_contents([('b/file', 'this contents contents\n')]) |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
473 |
wtb = d_b.open_workingtree() |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
474 |
wtb.commit('this revision', allow_pointless=False) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
475 |
self.assertEqual(1, wtb.merge_from_branch(wta.branch)) |
|
4634.101.11
by John Arbash Meinel
Actually there was a semi-whitebox test, now updated. |
476 |
self.failUnlessExists('b/file.THIS') |
477 |
self.failUnlessExists('b/file.BASE') |
|
478 |
self.failUnlessExists('b/file.OTHER') |
|
|
2748.3.2
by Aaron Bentley
Fix revert, remove-tree, and various tests to use None for 'no files specified' |
479 |
wtb.revert() |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
480 |
self.assertEqual(1, wtb.merge_from_branch(wta.branch, |
481 |
merge_type=WeaveMerger)) |
|
|
4634.101.11
by John Arbash Meinel
Actually there was a semi-whitebox test, now updated. |
482 |
self.failUnlessExists('b/file') |
483 |
self.failUnlessExists('b/file.THIS') |
|
484 |
self.failUnlessExists('b/file.BASE') |
|
485 |
self.failUnlessExists('b/file.OTHER') |
|
|
1185.12.85
by Aaron Bentley
Added conflict handling for weave merges |
486 |
|
|
4634.101.14
by John Arbash Meinel
Add a knownFailure case where we could drop a .BASE but fail to. |
487 |
def test_weave_conflicts_not_in_base(self): |
488 |
builder = self.make_branch_builder('source') |
|
489 |
builder.start_series() |
|
|
4634.101.15
by John Arbash Meinel
Add bug #494197 as the source of the KnownFailure test. |
490 |
# See bug #494197
|
|
4634.101.14
by John Arbash Meinel
Add a knownFailure case where we could drop a .BASE but fail to. |
491 |
# A base revision (before criss-cross)
|
492 |
# |\
|
|
493 |
# B C B does nothing, C adds 'foo'
|
|
494 |
# |X|
|
|
495 |
# D E D and E modify foo in incompatible ways
|
|
496 |
#
|
|
497 |
# Merging will conflict, with C as a clean base text. However, the
|
|
498 |
# current code uses A as the global base and 'foo' doesn't exist there.
|
|
499 |
# It isn't trivial to create foo.BASE because it tries to look up
|
|
500 |
# attributes like 'executable' in A.
|
|
501 |
builder.build_snapshot('A-id', None, [ |
|
502 |
('add', ('', 'TREE_ROOT', 'directory', None))]) |
|
503 |
builder.build_snapshot('B-id', ['A-id'], []) |
|
504 |
builder.build_snapshot('C-id', ['A-id'], [ |
|
505 |
('add', ('foo', 'foo-id', 'file', 'orig\ncontents\n'))]) |
|
506 |
builder.build_snapshot('D-id', ['B-id', 'C-id'], [ |
|
507 |
('add', ('foo', 'foo-id', 'file', 'orig\ncontents\nand D\n'))]) |
|
508 |
builder.build_snapshot('E-id', ['C-id', 'B-id'], [ |
|
509 |
('modify', ('foo-id', 'orig\ncontents\nand E\n'))]) |
|
510 |
builder.finish_series() |
|
511 |
tree = builder.get_branch().create_checkout('tree', lightweight=True) |
|
512 |
self.assertEqual(1, tree.merge_from_branch(tree.branch, |
|
513 |
to_revision='D-id', |
|
514 |
merge_type=WeaveMerger)) |
|
515 |
self.failUnlessExists('tree/foo.THIS') |
|
516 |
self.failUnlessExists('tree/foo.OTHER') |
|
517 |
self.expectFailure('fail to create .BASE in some criss-cross merges', |
|
518 |
self.failUnlessExists, 'tree/foo.BASE') |
|
519 |
self.failUnlessExists('tree/foo.BASE') |
|
520 |
||
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
521 |
def test_merge_unrelated(self): |
522 |
"""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. |
523 |
wta = self.make_branch_and_tree('a') |
524 |
a = wta.branch |
|
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
525 |
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. |
526 |
wta.add('a_file') |
527 |
wta.commit('a_revision', allow_pointless=False) |
|
528 |
wtb = self.make_branch_and_tree('b') |
|
529 |
b = wtb.branch |
|
|
1185.12.98
by Aaron Bentley
Support for forcing merges of unrelated trees |
530 |
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. |
531 |
wtb.add('b_file') |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
532 |
b_rev = wtb.commit('b_revision', allow_pointless=False) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
533 |
wta.merge_from_branch(wtb.branch, b_rev, 'null:') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
534 |
self.assert_(os.path.lexists('a/b_file')) |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
535 |
self.assertEqual([b_rev], wta.get_parent_ids()[1:]) |
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
536 |
|
537 |
def test_merge_unrelated_conflicting(self): |
|
538 |
"""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. |
539 |
wta = self.make_branch_and_tree('a') |
540 |
a = wta.branch |
|
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
541 |
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. |
542 |
wta.add('file') |
543 |
wta.commit('a_revision', allow_pointless=False) |
|
544 |
wtb = self.make_branch_and_tree('b') |
|
545 |
b = wtb.branch |
|
|
1185.12.99
by Aaron Bentley
Handled conflicts with versioned files better |
546 |
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. |
547 |
wtb.add('file') |
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
548 |
b_rev = wtb.commit('b_revision', allow_pointless=False) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
549 |
wta.merge_from_branch(wtb.branch, b_rev, 'null:') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
550 |
self.assert_(os.path.lexists('a/file')) |
551 |
self.assert_(os.path.lexists('a/file.moved')) |
|
|
1908.6.11
by Robert Collins
Remove usage of tree.pending_merges(). |
552 |
self.assertEqual([b_rev], wta.get_parent_ids()[1:]) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
553 |
|
554 |
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. |
555 |
wta = self.make_branch_and_tree('a') |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
556 |
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. |
557 |
wta.add('file') |
558 |
wta.commit('a_revision', allow_pointless=False) |
|
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
559 |
self.run_bzr('branch a b') |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
560 |
os.remove('a/file') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
561 |
wta.commit('removed file', allow_pointless=False) |
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
562 |
file('b/file', 'wb').write('changed contents\n') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
563 |
wtb = WorkingTree.open('b') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
564 |
wtb.commit('changed file', allow_pointless=False) |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
565 |
wtb.merge_from_branch(wta.branch, wta.branch.last_revision(), |
566 |
wta.branch.get_rev_id(1)) |
|
|
1185.31.10
by John Arbash Meinel
Adding merge-delete-conflicts test case. |
567 |
self.failIf(os.path.lexists('b/file')) |
568 |
||
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
569 |
def test_merge_metadata_vs_deletion(self): |
570 |
"""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. |
571 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
572 |
file('a/file', 'wb').write('contents\n') |
|
1508.1.15
by Robert Collins
Merge from mpool. |
573 |
a_wt.add('file') |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
574 |
a_wt.commit('r0') |
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
575 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
576 |
b_wt = WorkingTree.open('b') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
577 |
os.chmod('b/file', 0755) |
578 |
os.remove('a/file') |
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
579 |
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. |
580 |
self.assertEqual(a_wt.branch.revno(), 2) |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
581 |
self.assertFalse(os.path.exists('a/file')) |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
582 |
b_wt.commit('exec a') |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
583 |
a_wt.merge_from_branch(b_wt.branch, b_wt.last_revision(), 'null:') |
|
1185.33.23
by Martin Pool
Add test for merging metadata change vs file deletion |
584 |
self.assert_(os.path.exists('a/file')) |
|
1185.31.14
by John Arbash Meinel
[merge] bzr.dev |
585 |
|
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
586 |
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. |
587 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
588 |
file('a/un','wb').write('UN') |
589 |
file('a/deux','wb').write('DEUX') |
|
|
2323.6.14
by Martin Pool
clearer test data for test merge_swapping_rename |
590 |
a_wt.add('un', 'un-id') |
591 |
a_wt.add('deux', 'deux-id') |
|
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
592 |
a_wt.commit('r0', rev_id='r0') |
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
593 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
594 |
b_wt = WorkingTree.open('b') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
595 |
b_wt.rename_one('un','tmp') |
596 |
b_wt.rename_one('deux','un') |
|
597 |
b_wt.rename_one('tmp','deux') |
|
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
598 |
b_wt.commit('r1', rev_id='r1') |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
599 |
self.assertEqual(0, a_wt.merge_from_branch(b_wt.branch, |
600 |
b_wt.branch.last_revision(), b_wt.branch.get_rev_id(1))) |
|
|
1508.1.24
by Robert Collins
Add update command for use with checkouts. |
601 |
self.failUnlessExists('a/un') |
602 |
self.failUnless('a/deux') |
|
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
603 |
self.assertFalse(os.path.exists('a/tmp')) |
604 |
self.assertEqual(file('a/un').read(),'DEUX') |
|
605 |
self.assertEqual(file('a/deux').read(),'UN') |
|
606 |
||
607 |
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. |
608 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
609 |
file('a/file', 'wb').write('THIS') |
610 |
a_wt.add('file') |
|
611 |
a_wt.commit('r0') |
|
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
612 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
613 |
b_wt = WorkingTree.open('b') |
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
614 |
os.remove('b/file') |
615 |
b_wt.commit('r1') |
|
616 |
file('b/file', 'wb').write('THAT') |
|
617 |
b_wt.add('file') |
|
618 |
b_wt.commit('r2') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
619 |
a_wt.merge_from_branch(b_wt.branch, b_wt.branch.last_revision(), |
620 |
b_wt.branch.get_rev_id(1)) |
|
|
1185.33.102
by Denys Duchier
two new tests suggested by abentley |
621 |
self.assert_(os.path.exists('a/file')) |
622 |
self.assertEqual(file('a/file').read(),'THAT') |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
623 |
|
624 |
def test_merge_rename_before_create(self): |
|
625 |
"""rename before create |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
626 |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
627 |
This case requires that you must not do creates
|
628 |
before move-into-place:
|
|
629 |
||
630 |
$ touch foo
|
|
631 |
$ bzr add foo
|
|
632 |
$ bzr commit
|
|
633 |
$ bzr mv foo bar
|
|
634 |
$ touch foo
|
|
635 |
$ bzr add foo
|
|
636 |
$ bzr commit
|
|
637 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
638 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
639 |
file('a/foo', 'wb').write('A/FOO') |
640 |
a_wt.add('foo') |
|
641 |
a_wt.commit('added foo') |
|
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
642 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
643 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
644 |
b_wt.rename_one('foo', 'bar') |
645 |
file('b/foo', 'wb').write('B/FOO') |
|
646 |
b_wt.add('foo') |
|
647 |
b_wt.commit('moved foo to bar, added new foo') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
648 |
a_wt.merge_from_branch(b_wt.branch, b_wt.branch.last_revision(), |
649 |
b_wt.branch.get_rev_id(1)) |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
650 |
|
651 |
def test_merge_create_before_rename(self): |
|
652 |
"""create before rename, target parents before children |
|
653 |
||
654 |
This case requires that you must not do move-into-place
|
|
655 |
before creates, and that you must not do children after
|
|
656 |
parents:
|
|
657 |
||
658 |
$ touch foo
|
|
659 |
$ bzr add foo
|
|
660 |
$ bzr commit
|
|
661 |
$ bzr mkdir bar
|
|
662 |
$ bzr add bar
|
|
663 |
$ bzr mv foo bar/foo
|
|
664 |
$ bzr commit
|
|
665 |
"""
|
|
666 |
os.mkdir('a') |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
667 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
668 |
file('a/foo', 'wb').write('A/FOO') |
669 |
a_wt.add('foo') |
|
670 |
a_wt.commit('added foo') |
|
|
2530.3.2
by Martin Pool
Refactoring run_bzr code into more of a common base. |
671 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
672 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
673 |
os.mkdir('b/bar') |
674 |
b_wt.add('bar') |
|
675 |
b_wt.rename_one('foo', 'bar/foo') |
|
676 |
b_wt.commit('created bar dir, moved foo into bar') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
677 |
a_wt.merge_from_branch(b_wt.branch, b_wt.branch.last_revision(), |
678 |
b_wt.branch.get_rev_id(1)) |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
679 |
|
680 |
def test_merge_rename_to_temp_before_delete(self): |
|
681 |
"""rename to temp before delete, source children before parents |
|
682 |
||
683 |
This case requires that you must not do deletes before
|
|
684 |
move-out-of-the-way, and that you must not do children
|
|
685 |
after parents:
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
686 |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
687 |
$ mkdir foo
|
688 |
$ touch foo/bar
|
|
689 |
$ bzr add foo/bar
|
|
690 |
$ bzr commit
|
|
691 |
$ bzr mv foo/bar bar
|
|
692 |
$ rmdir foo
|
|
693 |
$ bzr commit
|
|
694 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
695 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
696 |
os.mkdir('a/foo') |
697 |
file('a/foo/bar', 'wb').write('A/FOO/BAR') |
|
698 |
a_wt.add('foo') |
|
699 |
a_wt.add('foo/bar') |
|
700 |
a_wt.commit('added foo/bar') |
|
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
701 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
702 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
703 |
b_wt.rename_one('foo/bar', 'bar') |
704 |
os.rmdir('b/foo') |
|
705 |
b_wt.remove('foo') |
|
706 |
b_wt.commit('moved foo/bar to bar, deleted foo') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
707 |
a_wt.merge_from_branch(b_wt.branch, b_wt.branch.last_revision(), |
708 |
b_wt.branch.get_rev_id(1)) |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
709 |
|
710 |
def test_merge_delete_before_rename_to_temp(self): |
|
711 |
"""delete before rename to temp |
|
712 |
||
713 |
This case requires that you must not do
|
|
714 |
move-out-of-the-way before deletes:
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
715 |
|
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
716 |
$ touch foo
|
717 |
$ touch bar
|
|
718 |
$ bzr add foo bar
|
|
719 |
$ bzr commit
|
|
720 |
$ rm foo
|
|
721 |
$ bzr rm foo
|
|
722 |
$ bzr mv bar foo
|
|
723 |
$ bzr commit
|
|
724 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
725 |
a_wt = self.make_branch_and_tree('a') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
726 |
file('a/foo', 'wb').write('A/FOO') |
727 |
file('a/bar', 'wb').write('A/BAR') |
|
728 |
a_wt.add('foo') |
|
729 |
a_wt.add('bar') |
|
730 |
a_wt.commit('added foo and bar') |
|
|
2552.2.2
by Vincent Ladeuil
Enforce run_bzr(string) where possible. |
731 |
self.run_bzr('branch a b') |
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
732 |
b_wt = WorkingTree.open('b') |
|
1185.33.103
by Denys Duchier
4 new merge tests suggested by abentley |
733 |
os.unlink('b/foo') |
734 |
b_wt.remove('foo') |
|
735 |
b_wt.rename_one('bar', 'foo') |
|
736 |
b_wt.commit('deleted foo, renamed bar to foo') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
737 |
a_wt.merge_from_branch(b_wt.branch, b_wt.branch.last_revision(), |
738 |
b_wt.branch.get_rev_id(1)) |
|
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
739 |
|
740 |
||
741 |
class TestMerger(TestCaseWithTransport): |
|
742 |
||
743 |
def set_up_trees(self): |
|
744 |
this = self.make_branch_and_tree('this') |
|
745 |
this.commit('rev1', rev_id='rev1') |
|
746 |
other = this.bzrdir.sprout('other').open_workingtree() |
|
747 |
this.commit('rev2a', rev_id='rev2a') |
|
748 |
other.commit('rev2b', rev_id='rev2b') |
|
749 |
return this, other |
|
750 |
||
751 |
def test_from_revision_ids(self): |
|
752 |
this, other = self.set_up_trees() |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
753 |
self.assertRaises(errors.NoSuchRevision, Merger.from_revision_ids, |
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
754 |
progress.DummyProgress(), this, 'rev2b') |
|
3010.1.8
by Robert Collins
test_merge_core locking correctness. |
755 |
this.lock_write() |
756 |
self.addCleanup(this.unlock) |
|
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
757 |
merger = Merger.from_revision_ids(progress.DummyProgress(), this, |
758 |
'rev2b', other_branch=other.branch) |
|
759 |
self.assertEqual('rev2b', merger.other_rev_id) |
|
760 |
self.assertEqual('rev1', merger.base_rev_id) |
|
761 |
merger = Merger.from_revision_ids(progress.DummyProgress(), this, |
|
762 |
'rev2b', 'rev2a', other_branch=other.branch) |
|
763 |
self.assertEqual('rev2a', merger.base_rev_id) |
|
764 |
||
765 |
def test_from_uncommitted(self): |
|
766 |
this, other = self.set_up_trees() |
|
767 |
merger = Merger.from_uncommitted(this, other, progress.DummyProgress()) |
|
768 |
self.assertIs(other, merger.other_tree) |
|
769 |
self.assertIs(None, merger.other_rev_id) |
|
770 |
self.assertEqual('rev2b', merger.base_rev_id) |
|
771 |
||
|
1551.19.44
by Aaron Bentley
Fix handling of old merge directives with stricter get_parent_map |
772 |
def prepare_for_merging(self): |
773 |
this, other = self.set_up_trees() |
|
774 |
other.commit('rev3', rev_id='rev3') |
|
775 |
this.lock_write() |
|
776 |
self.addCleanup(this.unlock) |
|
777 |
return this, other |
|
778 |
||
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
779 |
def test_from_mergeable(self): |
|
1551.19.44
by Aaron Bentley
Fix handling of old merge directives with stricter get_parent_map |
780 |
this, other = self.prepare_for_merging() |
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
781 |
md = merge_directive.MergeDirective2.from_objects( |
782 |
other.branch.repository, 'rev3', 0, 0, 'this') |
|
|
3010.1.8
by Robert Collins
test_merge_core locking correctness. |
783 |
other.lock_read() |
784 |
self.addCleanup(other.unlock) |
|
|
1551.15.76
by Aaron Bentley
Add unit tests from Merger.from_* |
785 |
merger, verified = Merger.from_mergeable(this, md, |
786 |
progress.DummyProgress()) |
|
787 |
md.patch = None |
|
788 |
merger, verified = Merger.from_mergeable(this, md, |
|
789 |
progress.DummyProgress()) |
|
790 |
self.assertEqual('inapplicable', verified) |
|
791 |
self.assertEqual('rev3', merger.other_rev_id) |
|
792 |
self.assertEqual('rev1', merger.base_rev_id) |
|
793 |
md.base_revision_id = 'rev2b' |
|
794 |
merger, verified = Merger.from_mergeable(this, md, |
|
795 |
progress.DummyProgress()) |
|
796 |
self.assertEqual('rev2b', merger.base_rev_id) |
|
|
1551.19.44
by Aaron Bentley
Fix handling of old merge directives with stricter get_parent_map |
797 |
|
798 |
def test_from_mergeable_old_merge_directive(self): |
|
799 |
this, other = self.prepare_for_merging() |
|
800 |
other.lock_write() |
|
801 |
self.addCleanup(other.unlock) |
|
802 |
md = merge_directive.MergeDirective.from_objects( |
|
803 |
other.branch.repository, 'rev3', 0, 0, 'this') |
|
804 |
merger, verified = Merger.from_mergeable(this, md, |
|
805 |
progress.DummyProgress()) |
|
806 |
self.assertEqual('rev3', merger.other_rev_id) |
|
807 |
self.assertEqual('rev1', merger.base_rev_id) |