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