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