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