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