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