bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.436.2
by Jelmer Vernooij
Add stubs for testsuite, rebase-continue and rebase-abort commands. |
1 |
# Copyright (C) 2006-2007 by Jelmer Vernooij
|
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
|
|
|
0.436.131
by Jelmer Vernooij
Change license back to GPLv2+ |
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
0.436.2
by Jelmer Vernooij
Add stubs for testsuite, rebase-continue and rebase-abort commands. |
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
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
0.436.16
by Jelmer Vernooij
Some more work on maptree. |
16 |
"""Tests for the rebase code."""
|
|
0.436.2
by Jelmer Vernooij
Add stubs for testsuite, rebase-continue and rebase-abort commands. |
17 |
|
|
0.436.56
by Jelmer Vernooij
Fix test. |
18 |
from bzrlib.conflicts import ConflictList |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
19 |
from bzrlib.errors import UnknownFormatError, NoSuchFile, ConflictsInTree |
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
20 |
from bzrlib.graph import Graph, DictParentsProvider |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
21 |
from bzrlib.revision import NULL_REVISION |
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
22 |
from bzrlib.tests import TestCase, TestCaseWithTransport |
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
23 |
from bzrlib.trace import mutter |
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
24 |
|
25 |
from rebase import (marshall_rebase_plan, unmarshall_rebase_plan, |
|
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
26 |
replay_snapshot, generate_simple_plan, |
27 |
generate_transpose_plan, rebase_plan_exists, |
|
|
0.436.18
by Jelmer Vernooij
More tests, extend MapTree a bit. |
28 |
rebase_todo, REBASE_PLAN_FILENAME, |
29 |
REBASE_CURRENT_REVID_FILENAME, read_rebase_plan, |
|
30 |
remove_rebase_plan, read_active_rebase_revid, |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
31 |
write_active_rebase_revid, write_rebase_plan, MapTree, |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
32 |
ReplaySnapshotError, ReplayParentsInconsistent, |
|
0.436.56
by Jelmer Vernooij
Fix test. |
33 |
replay_delta_workingtree, replay_determine_base, |
34 |
commit_rebase) |
|
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
35 |
|
|
0.436.4
by Jelmer Vernooij
Add some tests. |
36 |
|
|
0.436.3
by Jelmer Vernooij
Fill in commands. |
37 |
class RebasePlanReadWriterTests(TestCase): |
|
0.436.145
by Jelmer Vernooij
Fix test. |
38 |
|
|
0.436.4
by Jelmer Vernooij
Add some tests. |
39 |
def test_simple_marshall_rebase_plan(self): |
40 |
self.assertEqualDiff( |
|
41 |
"""# Bazaar rebase plan 1
|
|
42 |
1 bla
|
|
43 |
oldrev newrev newparent1 newparent2
|
|
44 |
""", marshall_rebase_plan((1, "bla"), |
|
|
0.436.95
by Jelmer Vernooij
Use tuples more consistently. |
45 |
{"oldrev": ("newrev", ("newparent1", "newparent2"))})) |
|
0.436.4
by Jelmer Vernooij
Add some tests. |
46 |
|
47 |
def test_simple_unmarshall_rebase_plan(self): |
|
48 |
self.assertEquals(((1, "bla"), |
|
|
0.436.95
by Jelmer Vernooij
Use tuples more consistently. |
49 |
{"oldrev": ("newrev", ("newparent1", "newparent2"))}), |
|
0.436.4
by Jelmer Vernooij
Add some tests. |
50 |
unmarshall_rebase_plan("""# Bazaar rebase plan 1 |
51 |
1 bla
|
|
52 |
oldrev newrev newparent1 newparent2
|
|
53 |
""")) |
|
54 |
||
55 |
def test_unmarshall_rebase_plan_formatunknown(self): |
|
56 |
self.assertRaises(UnknownFormatError, |
|
57 |
unmarshall_rebase_plan, """# Bazaar rebase plan x |
|
58 |
1 bla
|
|
59 |
oldrev newrev newparent1 newparent2
|
|
60 |
""") |
|
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
61 |
|
62 |
||
63 |
class ConversionTests(TestCaseWithTransport): |
|
|
0.436.145
by Jelmer Vernooij
Fix test. |
64 |
|
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
65 |
def test_simple(self): |
66 |
wt = self.make_branch_and_tree('.') |
|
67 |
b = wt.branch |
|
68 |
file('hello', 'w').write('hello world') |
|
69 |
wt.add('hello') |
|
70 |
wt.commit(message='add hello', rev_id="bla") |
|
71 |
file('hello', 'w').write('world') |
|
72 |
wt.commit(message='change hello', rev_id="bloe") |
|
73 |
wt.set_last_revision("bla") |
|
74 |
b.set_revision_history(["bla"]) |
|
75 |
file('hello', 'w').write('world') |
|
76 |
wt.commit(message='change hello', rev_id="bla2") |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
77 |
|
78 |
wt.branch.repository.lock_write() |
|
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
79 |
newrev = replay_snapshot(wt.branch.repository, "bla2", "bla4", |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
80 |
("bloe",)) |
|
0.436.5
by Jelmer Vernooij
Import change_revision_parent from bzr-svn. |
81 |
self.assertEqual("bla4", newrev) |
82 |
self.assertTrue(wt.branch.repository.has_revision(newrev)) |
|
|
0.436.80
by Jelmer Vernooij
Avoid using deprecated revision_parents() function. |
83 |
self.assertEqual(("bloe",), |
84 |
wt.branch.repository.get_parent_map([newrev])[newrev]) |
|
|
0.436.20
by Jelmer Vernooij
Some more blackbox tests. |
85 |
self.assertEqual("bla2", |
86 |
wt.branch.repository.get_revision(newrev).properties["rebase-of"]) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
87 |
wt.branch.repository.unlock() |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
88 |
|
89 |
||
90 |
class PlanCreatorTests(TestCaseWithTransport): |
|
|
0.441.4
by Robert Collins
* Fixed O(history) access during plan creation (Robert Collins, lp:#249823). |
91 |
|
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
92 |
def test_simple_plan_creator(self): |
93 |
wt = self.make_branch_and_tree('.') |
|
94 |
b = wt.branch |
|
95 |
file('hello', 'w').write('hello world') |
|
96 |
wt.add('hello') |
|
97 |
wt.commit(message='add hello', rev_id="bla") |
|
98 |
file('hello', 'w').write('world') |
|
99 |
wt.commit(message='change hello', rev_id="bloe") |
|
100 |
wt.set_last_revision("bla") |
|
101 |
b.set_revision_history(["bla"]) |
|
102 |
file('hello', 'w').write('world') |
|
103 |
wt.commit(message='change hello', rev_id="bla2") |
|
104 |
||
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
105 |
b.repository.lock_read() |
|
0.441.4
by Robert Collins
* Fixed O(history) access during plan creation (Robert Collins, lp:#249823). |
106 |
graph = b.repository.get_graph() |
107 |
self.assertEquals({'bla2': ('newbla2', ("bloe",))}, |
|
108 |
generate_simple_plan( |
|
109 |
graph.find_difference(b.last_revision(),"bla")[0], |
|
110 |
"bla2", None, "bloe", graph, lambda y: "new"+y)) |
|
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
111 |
b.repository.unlock() |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
112 |
|
113 |
def test_simple_plan_creator_extra_history(self): |
|
114 |
wt = self.make_branch_and_tree('.') |
|
115 |
b = wt.branch |
|
116 |
file('hello', 'w').write('hello world') |
|
117 |
wt.add('hello') |
|
118 |
wt.commit(message='add hello', rev_id="bla") |
|
119 |
file('hello', 'w').write('world') |
|
120 |
wt.commit(message='change hello', rev_id="bloe") |
|
121 |
wt.set_last_revision("bla") |
|
122 |
b.set_revision_history(["bla"]) |
|
123 |
file('hello', 'w').write('world') |
|
124 |
wt.commit(message='change hello', rev_id="bla2") |
|
125 |
file('hello', 'w').write('universe') |
|
126 |
wt.commit(message='change hello again', rev_id="bla3") |
|
127 |
||
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
128 |
b.repository.lock_read() |
|
0.441.4
by Robert Collins
* Fixed O(history) access during plan creation (Robert Collins, lp:#249823). |
129 |
graph = b.repository.get_graph() |
130 |
self.assertEquals( |
|
131 |
{'bla2': ('newbla2', ("bloe",)), 'bla3': ('newbla3', ('newbla2',))}, |
|
132 |
generate_simple_plan( |
|
133 |
graph.find_difference(b.last_revision(),"bloe")[0], |
|
134 |
"bla2", None, "bloe", |
|
135 |
graph, lambda y: "new"+y)) |
|
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
136 |
b.repository.unlock() |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
137 |
|
138 |
def test_generate_transpose_plan(self): |
|
139 |
wt = self.make_branch_and_tree('.') |
|
140 |
b = wt.branch |
|
141 |
file('hello', 'w').write('hello world') |
|
142 |
wt.add('hello') |
|
143 |
wt.commit(message='add hello', rev_id="bla") |
|
144 |
file('hello', 'w').write('world') |
|
145 |
wt.commit(message='change hello', rev_id="bloe") |
|
146 |
wt.set_last_revision("bla") |
|
147 |
b.set_revision_history(["bla"]) |
|
148 |
file('hello', 'w').write('world') |
|
149 |
wt.commit(message='change hello', rev_id="bla2") |
|
150 |
file('hello', 'w').write('universe') |
|
151 |
wt.commit(message='change hello again', rev_id="bla3") |
|
152 |
wt.set_last_revision("bla") |
|
153 |
b.set_revision_history(["bla"]) |
|
154 |
file('hello', 'w').write('somebar') |
|
155 |
wt.commit(message='change hello yet again', rev_id="blie") |
|
156 |
wt.set_last_revision(NULL_REVISION) |
|
157 |
b.set_revision_history([]) |
|
158 |
wt.add('hello') |
|
159 |
wt.commit(message='add hello', rev_id="lala") |
|
160 |
||
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
161 |
b.repository.lock_read() |
|
0.436.88
by Jelmer Vernooij
Avoid use of get_revision_graph() calls. |
162 |
graph = b.repository.get_graph() |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
163 |
self.assertEquals({ |
|
0.436.90
by Jelmer Vernooij
Deal with parents being a tuple. |
164 |
'blie': ('newblie', ('lala',))}, |
|
0.436.88
by Jelmer Vernooij
Avoid use of get_revision_graph() calls. |
165 |
generate_transpose_plan(graph.iter_ancestry(["blie"]), |
166 |
{"bla": "lala"}, graph, lambda y: "new"+y)) |
|
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
167 |
self.assertEquals({ |
|
0.436.90
by Jelmer Vernooij
Deal with parents being a tuple. |
168 |
'bla2': ('newbla2', ('lala',)), |
169 |
'bla3': ('newbla3', ('newbla2',)), |
|
170 |
'blie': ('newblie', ('lala',)), |
|
171 |
'bloe': ('newbloe', ('lala',))}, |
|
|
0.436.88
by Jelmer Vernooij
Avoid use of get_revision_graph() calls. |
172 |
generate_transpose_plan(graph.iter_ancestry(b.repository._all_revision_ids()), |
|
0.436.36
by Jelmer Vernooij
Fix compatibility with bzr 0.19. |
173 |
{"bla": "lala"}, |
|
0.436.88
by Jelmer Vernooij
Avoid use of get_revision_graph() calls. |
174 |
graph, lambda y: "new"+y)) |
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
175 |
b.repository.unlock() |
|
0.436.6
by Jelmer Vernooij
Add somewhat more complex plan generation function, rebase implementation. |
176 |
|
|
0.436.31
by Jelmer Vernooij
Refactor generate_transpose_plan() to not take a repository object but |
177 |
def test_generate_transpose_plan_one(self): |
|
0.436.89
by Jelmer Vernooij
Use tuples for parents. |
178 |
graph = Graph(DictParentsProvider({"bla": ("bloe",), "bloe": (), "lala": ()})) |
|
0.436.90
by Jelmer Vernooij
Deal with parents being a tuple. |
179 |
self.assertEquals({"bla": ("newbla", ("lala",))}, |
|
0.436.88
by Jelmer Vernooij
Avoid use of get_revision_graph() calls. |
180 |
generate_transpose_plan(graph.iter_ancestry(["bla", "bloe"]), |
181 |
{"bloe": "lala"}, graph, lambda y: "new"+y)) |
|
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
182 |
|
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
183 |
def test_plan_with_already_merged(self): |
184 |
"""We need to use a merge base that makes sense. |
|
185 |
|
|
186 |
A
|
|
187 |
| \
|
|
188 |
B D
|
|
189 |
| \|
|
|
190 |
C E
|
|
191 |
||
192 |
Rebasing E on C should result in:
|
|
193 |
||
194 |
A -> B -> C -> D -> E
|
|
195 |
||
196 |
with a plan of:
|
|
197 |
||
198 |
D -> (D', [C])
|
|
|
0.436.40
by Jelmer Vernooij
Adjust expectations. |
199 |
E -> (E', [D', C])
|
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
200 |
"""
|
201 |
parents_map = { |
|
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
202 |
"A": (), |
203 |
"B": ("A",), |
|
204 |
"C": ("B",), |
|
205 |
"D": ("A",), |
|
206 |
"E": ("D", "B") |
|
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
207 |
}
|
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
208 |
graph = Graph(DictParentsProvider(parents_map)) |
|
0.441.4
by Robert Collins
* Fixed O(history) access during plan creation (Robert Collins, lp:#249823). |
209 |
self.assertEquals({"D": ("D'", ("C",)), "E": ("E'", ("D'",))}, |
210 |
generate_simple_plan(["D", "E"], "D", None, "C", |
|
211 |
graph, lambda y: y+"'")) |
|
|
0.436.55
by Jelmer Vernooij
Add functinality for skipping duplicate merges. |
212 |
|
213 |
def test_plan_with_already_merged_skip_merges(self): |
|
214 |
"""We need to use a merge base that makes sense. |
|
215 |
|
|
216 |
A
|
|
217 |
| \
|
|
218 |
B D
|
|
219 |
| \|
|
|
220 |
C E
|
|
221 |
||
222 |
Rebasing E on C should result in:
|
|
223 |
||
224 |
A -> B -> C -> D'
|
|
225 |
||
226 |
with a plan of:
|
|
227 |
||
228 |
D -> (D', [C])
|
|
229 |
"""
|
|
230 |
parents_map = { |
|
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
231 |
"A": (), |
232 |
"B": ("A",), |
|
233 |
"C": ("B",), |
|
234 |
"D": ("A",), |
|
235 |
"E": ("D", "B") |
|
|
0.436.55
by Jelmer Vernooij
Add functinality for skipping duplicate merges. |
236 |
}
|
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
237 |
graph = Graph(DictParentsProvider(parents_map)) |
|
0.441.4
by Robert Collins
* Fixed O(history) access during plan creation (Robert Collins, lp:#249823). |
238 |
self.assertEquals({"D": ("D'", ("C",))}, |
239 |
generate_simple_plan(["D", "E"], "D", None, "C", |
|
|
0.436.86
by Jelmer Vernooij
Fix some uses of get_revision_graph(). |
240 |
graph, lambda y: y+"'", True)) |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
241 |
|
242 |
||
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
243 |
class PlanFileTests(TestCaseWithTransport): |
|
0.436.145
by Jelmer Vernooij
Fix test. |
244 |
|
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
245 |
def test_rebase_plan_exists_false(self): |
246 |
wt = self.make_branch_and_tree('.') |
|
247 |
self.assertFalse(rebase_plan_exists(wt)) |
|
248 |
||
249 |
def test_rebase_plan_exists_empty(self): |
|
250 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
251 |
wt._transport.put_bytes(REBASE_PLAN_FILENAME, "") |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
252 |
self.assertFalse(rebase_plan_exists(wt)) |
253 |
||
254 |
def test_rebase_plan_exists(self): |
|
255 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
256 |
wt._transport.put_bytes(REBASE_PLAN_FILENAME, "foo") |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
257 |
self.assertTrue(rebase_plan_exists(wt)) |
258 |
||
259 |
def test_remove_rebase_plan(self): |
|
260 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
261 |
wt._transport.put_bytes(REBASE_PLAN_FILENAME, "foo") |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
262 |
remove_rebase_plan(wt) |
263 |
self.assertFalse(rebase_plan_exists(wt)) |
|
264 |
||
265 |
def test_remove_rebase_plan_twice(self): |
|
266 |
wt = self.make_branch_and_tree('.') |
|
267 |
remove_rebase_plan(wt) |
|
268 |
self.assertFalse(rebase_plan_exists(wt)) |
|
269 |
||
270 |
def test_write_rebase_plan(self): |
|
271 |
wt = self.make_branch_and_tree('.') |
|
272 |
file('hello', 'w').write('hello world') |
|
273 |
wt.add('hello') |
|
274 |
wt.commit(message='add hello', rev_id="bla") |
|
275 |
write_rebase_plan(wt, |
|
276 |
{"oldrev": ("newrev", ["newparent1", "newparent2"])}) |
|
277 |
self.assertEqualDiff("""# Bazaar rebase plan 1 |
|
278 |
1 bla
|
|
279 |
oldrev newrev newparent1 newparent2
|
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
280 |
""", wt._transport.get_bytes(REBASE_PLAN_FILENAME)) |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
281 |
|
282 |
def test_read_rebase_plan_nonexistant(self): |
|
283 |
wt = self.make_branch_and_tree('.') |
|
284 |
self.assertRaises(NoSuchFile, read_rebase_plan, wt) |
|
285 |
||
286 |
def test_read_rebase_plan_empty(self): |
|
287 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
288 |
wt._transport.put_bytes(REBASE_PLAN_FILENAME, "") |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
289 |
self.assertRaises(NoSuchFile, read_rebase_plan, wt) |
290 |
||
291 |
def test_read_rebase_plan(self): |
|
292 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
293 |
wt._transport.put_bytes(REBASE_PLAN_FILENAME, """# Bazaar rebase plan 1 |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
294 |
1 bla
|
295 |
oldrev newrev newparent1 newparent2
|
|
296 |
""") |
|
|
0.436.36
by Jelmer Vernooij
Fix compatibility with bzr 0.19. |
297 |
self.assertEquals(((1, "bla"), |
|
0.436.95
by Jelmer Vernooij
Use tuples more consistently. |
298 |
{"oldrev": ("newrev", ("newparent1", "newparent2"))}), |
|
0.436.36
by Jelmer Vernooij
Fix compatibility with bzr 0.19. |
299 |
read_rebase_plan(wt)) |
|
0.436.7
by Jelmer Vernooij
Add more test, make basic rebase work. |
300 |
|
|
0.436.20
by Jelmer Vernooij
Some more blackbox tests. |
301 |
|
|
0.436.9
by Jelmer Vernooij
Add rebase-todo command, fix rebase-continue. |
302 |
class CurrentRevidFileTests(TestCaseWithTransport): |
|
0.436.145
by Jelmer Vernooij
Fix test. |
303 |
|
|
0.436.9
by Jelmer Vernooij
Add rebase-todo command, fix rebase-continue. |
304 |
def test_read_nonexistant(self): |
305 |
wt = self.make_branch_and_tree('.') |
|
306 |
self.assertIs(None, read_active_rebase_revid(wt)) |
|
307 |
||
308 |
def test_read_null(self): |
|
309 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
310 |
wt._transport.put_bytes(REBASE_CURRENT_REVID_FILENAME, NULL_REVISION) |
|
0.436.9
by Jelmer Vernooij
Add rebase-todo command, fix rebase-continue. |
311 |
self.assertIs(None, read_active_rebase_revid(wt)) |
312 |
||
313 |
def test_read(self): |
|
314 |
wt = self.make_branch_and_tree('.') |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
315 |
wt._transport.put_bytes(REBASE_CURRENT_REVID_FILENAME, "bla") |
|
0.436.9
by Jelmer Vernooij
Add rebase-todo command, fix rebase-continue. |
316 |
self.assertEquals("bla", read_active_rebase_revid(wt)) |
317 |
||
318 |
def test_write(self): |
|
319 |
wt = self.make_branch_and_tree('.') |
|
320 |
write_active_rebase_revid(wt, "bloe") |
|
321 |
self.assertEquals("bloe", read_active_rebase_revid(wt)) |
|
322 |
||
323 |
def test_write_null(self): |
|
324 |
wt = self.make_branch_and_tree('.') |
|
325 |
write_active_rebase_revid(wt, None) |
|
326 |
self.assertIs(None, read_active_rebase_revid(wt)) |
|
|
0.436.18
by Jelmer Vernooij
More tests, extend MapTree a bit. |
327 |
|
|
0.436.20
by Jelmer Vernooij
Some more blackbox tests. |
328 |
|
|
0.436.18
by Jelmer Vernooij
More tests, extend MapTree a bit. |
329 |
class RebaseTodoTests(TestCase): |
|
0.436.145
by Jelmer Vernooij
Fix test. |
330 |
|
|
0.436.18
by Jelmer Vernooij
More tests, extend MapTree a bit. |
331 |
def test_done(self): |
332 |
class Repository: |
|
333 |
def has_revision(self, revid): |
|
334 |
return revid == "bloe" |
|
335 |
self.assertEquals([], |
|
336 |
list(rebase_todo(Repository(), { "bla": ("bloe", [])}))) |
|
337 |
||
338 |
def test_notstarted(self): |
|
339 |
class Repository: |
|
340 |
def has_revision(self, revid): |
|
341 |
return False |
|
342 |
self.assertEquals(["bla"], |
|
343 |
list(rebase_todo(Repository(), { "bla": ("bloe", [])}))) |
|
344 |
||
345 |
def test_halfway(self): |
|
346 |
class Repository: |
|
347 |
def has_revision(self, revid): |
|
348 |
return revid == "bloe" |
|
349 |
self.assertEquals(["ha"], |
|
350 |
list(rebase_todo(Repository(), { "bla": ("bloe", []), |
|
351 |
"ha": ("hee", [])}))) |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
352 |
|
353 |
class ReplaySnapshotTests(TestCaseWithTransport): |
|
354 |
def test_single_revision(self): |
|
355 |
wt = self.make_branch_and_tree(".") |
|
356 |
self.build_tree(['afile']) |
|
357 |
wt.add(["afile"]) |
|
358 |
wt.commit("bla", rev_id="oldcommit") |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
359 |
wt.branch.repository.lock_write() |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
360 |
replay_snapshot(wt.branch.repository, "oldcommit", "newcommit", ()) |
|
0.436.49
by Jelmer Vernooij
Fix locking. |
361 |
wt.branch.repository.unlock() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
362 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
363 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
364 |
self.assertEquals([], newrev.parent_ids) |
|
365 |
self.assertEquals("newcommit", newrev.revision_id) |
|
366 |
self.assertEquals(oldrev.committer, newrev.committer) |
|
367 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
368 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
369 |
inv = wt.branch.repository.get_inventory("newcommit") |
|
370 |
self.assertEquals("newcommit", inv[inv.path2id("afile")].revision) |
|
371 |
||
372 |
def test_parents_different(self): |
|
373 |
"""replay_snapshot() relies on the fact that the contents of |
|
374 |
the old and new parents is equal (at least concerning tree shape). If
|
|
375 |
it turns out it isn't, an exception should be raised."""
|
|
376 |
wt = self.make_branch_and_tree(".") |
|
377 |
wt.commit("bloe", rev_id="base") |
|
378 |
self.build_tree(['afile', 'notherfile']) |
|
379 |
wt.add(["afile"]) |
|
380 |
wt.commit("bla", rev_id="oldparent") |
|
381 |
wt.add(["notherfile"]) |
|
382 |
wt.commit("bla", rev_id="oldcommit") |
|
|
0.436.34
by Jelmer Vernooij
Some more tests. |
383 |
# this should raise an exception since oldcommit is being rewritten
|
384 |
# but 'afile' is present in the old parents but not in the new ones.
|
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
385 |
wt.branch.repository.lock_write() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
386 |
self.assertRaises( |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
387 |
ReplayParentsInconsistent, replay_snapshot, |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
388 |
wt.branch.repository, "oldcommit", "newcommit", ("base",)) |
|
0.436.49
by Jelmer Vernooij
Fix locking. |
389 |
wt.branch.repository.unlock() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
390 |
|
|
0.436.34
by Jelmer Vernooij
Some more tests. |
391 |
def test_two_revisions(self): |
392 |
wt = self.make_branch_and_tree("old") |
|
|
0.436.103
by Jelmer Vernooij
Loosen requirements about text parents a bit - check text sha1s instead. |
393 |
self.build_tree_contents([('old/afile', 'afilecontents'), ('old/notherfile', 'notherfilecontents')]) |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
394 |
wt.add(["afile"], ["somefileid"]) |
395 |
wt.commit("bla", rev_id="oldparent") |
|
396 |
wt.add(["notherfile"]) |
|
397 |
wt.commit("bla", rev_id="oldcommit") |
|
398 |
oldrepos = wt.branch.repository |
|
399 |
wt = self.make_branch_and_tree("new") |
|
|
0.436.103
by Jelmer Vernooij
Loosen requirements about text parents a bit - check text sha1s instead. |
400 |
self.build_tree_contents([('new/afile', 'afilecontents'), ('new/notherfile', 'notherfilecontents')]) |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
401 |
wt.add(["afile"], ["afileid"]) |
402 |
wt.commit("bla", rev_id="newparent") |
|
403 |
wt.branch.repository.fetch(oldrepos) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
404 |
wt.branch.repository.lock_write() |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
405 |
replay_snapshot(wt.branch.repository, "oldcommit", "newcommit", |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
406 |
("newparent",)) |
|
0.436.49
by Jelmer Vernooij
Fix locking. |
407 |
wt.branch.repository.unlock() |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
408 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
409 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
410 |
self.assertEquals(["newparent"], newrev.parent_ids) |
|
411 |
self.assertEquals("newcommit", newrev.revision_id) |
|
412 |
self.assertEquals(oldrev.committer, newrev.committer) |
|
413 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
414 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
415 |
inv = wt.branch.repository.get_inventory("newcommit") |
|
416 |
self.assertEquals("afileid", inv.path2id("afile")) |
|
417 |
self.assertEquals("newcommit", inv[inv.path2id("notherfile")].revision) |
|
418 |
||
419 |
def test_two_revisions_no_renames(self): |
|
420 |
wt = self.make_branch_and_tree("old") |
|
421 |
self.build_tree(['old/afile', 'old/notherfile']) |
|
422 |
wt.add(["afile"], ["somefileid"]) |
|
423 |
wt.commit("bla", rev_id="oldparent") |
|
424 |
wt.add(["notherfile"]) |
|
425 |
wt.commit("bla", rev_id="oldcommit") |
|
426 |
oldrepos = wt.branch.repository |
|
427 |
wt = self.make_branch_and_tree("new") |
|
428 |
self.build_tree(['new/afile', 'new/notherfile']) |
|
429 |
wt.add(["afile"], ["afileid"]) |
|
430 |
wt.commit("bla", rev_id="newparent") |
|
431 |
wt.branch.repository.fetch(oldrepos) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
432 |
wt.branch.repository.lock_write() |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
433 |
replay_snapshot(wt.branch.repository, "oldcommit", "newcommit", |
434 |
("newparent",)) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
435 |
wt.branch.repository.unlock() |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
436 |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
437 |
def test_multi_revisions(self): |
438 |
wt = self.make_branch_and_tree("old") |
|
|
0.436.103
by Jelmer Vernooij
Loosen requirements about text parents a bit - check text sha1s instead. |
439 |
self.build_tree_contents([('old/afile', 'afilecontent'), |
440 |
('old/sfile', 'sfilecontent'), |
|
441 |
('old/notherfile', 'notherfilecontent')]) |
|
|
0.436.35
by Jelmer Vernooij
Make revid_renames argument mandatory. |
442 |
wt.add(['sfile']) |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
443 |
wt.add(["afile"], ["somefileid"]) |
444 |
wt.commit("bla", rev_id="oldgrandparent") |
|
445 |
open("old/afile", "w").write("data") |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
446 |
wt.commit("bla", rev_id="oldparent") |
447 |
wt.add(["notherfile"]) |
|
448 |
wt.commit("bla", rev_id="oldcommit") |
|
449 |
oldrepos = wt.branch.repository |
|
450 |
wt = self.make_branch_and_tree("new") |
|
|
0.436.103
by Jelmer Vernooij
Loosen requirements about text parents a bit - check text sha1s instead. |
451 |
self.build_tree_contents([('new/afile', 'afilecontent'), |
452 |
('new/sfile', 'sfilecontent'), |
|
453 |
('new/notherfile', 'notherfilecontent')]) |
|
|
0.436.35
by Jelmer Vernooij
Make revid_renames argument mandatory. |
454 |
wt.add(['sfile']) |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
455 |
wt.add(["afile"], ["afileid"]) |
456 |
wt.commit("bla", rev_id="newgrandparent") |
|
457 |
open("new/afile", "w").write("data") |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
458 |
wt.commit("bla", rev_id="newparent") |
459 |
wt.branch.repository.fetch(oldrepos) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
460 |
wt.branch.repository.lock_write() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
461 |
replay_snapshot(wt.branch.repository, "oldcommit", "newcommit", |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
462 |
("newparent",)) |
|
0.436.49
by Jelmer Vernooij
Fix locking. |
463 |
wt.branch.repository.unlock() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
464 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
465 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
|
0.436.34
by Jelmer Vernooij
Some more tests. |
466 |
self.assertEquals(["newparent"], newrev.parent_ids) |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
467 |
self.assertEquals("newcommit", newrev.revision_id) |
468 |
self.assertEquals(oldrev.committer, newrev.committer) |
|
469 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
470 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
471 |
inv = wt.branch.repository.get_inventory("newcommit") |
|
|
0.436.34
by Jelmer Vernooij
Some more tests. |
472 |
self.assertEquals("afileid", inv.path2id("afile")) |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
473 |
self.assertEquals("newcommit", inv[inv.path2id("notherfile")].revision) |
|
0.436.35
by Jelmer Vernooij
Make revid_renames argument mandatory. |
474 |
self.assertEquals("newgrandparent", inv[inv.path2id("sfile")].revision) |
|
0.436.34
by Jelmer Vernooij
Some more tests. |
475 |
|
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
476 |
def test_maps_ids(self): |
477 |
wt = self.make_branch_and_tree("old") |
|
478 |
wt.commit("base", rev_id="base") |
|
479 |
self.build_tree(['old/afile']) |
|
480 |
wt.add(["afile"], ids=["originalid"]) |
|
481 |
wt.commit("bla", rev_id="oldparent") |
|
482 |
file("old/afile", "w").write("bloe") |
|
483 |
wt.commit("bla", rev_id="oldcommit") |
|
484 |
oldrepos = wt.branch.repository |
|
485 |
wt = self.make_branch_and_tree("new") |
|
486 |
self.build_tree(['new/afile']) |
|
487 |
wt.add(["afile"], ids=["newid"]) |
|
488 |
wt.commit("bla", rev_id="newparent") |
|
489 |
wt.branch.repository.fetch(oldrepos) |
|
|
0.436.49
by Jelmer Vernooij
Fix locking. |
490 |
wt.branch.repository.lock_write() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
491 |
replay_snapshot(wt.branch.repository, "oldcommit", "newcommit", |
|
0.436.121
by Jelmer Vernooij
Simplify replay snapshot functions. |
492 |
("newparent",)) |
|
0.436.49
by Jelmer Vernooij
Fix locking. |
493 |
wt.branch.repository.unlock() |
|
0.436.32
by Jelmer Vernooij
Properly detect invalid snapshot replays. |
494 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
495 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
496 |
self.assertEquals(["newparent"], newrev.parent_ids) |
|
497 |
self.assertEquals("newcommit", newrev.revision_id) |
|
498 |
self.assertEquals(oldrev.committer, newrev.committer) |
|
499 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
500 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
501 |
inv = wt.branch.repository.get_inventory("newcommit") |
|
502 |
self.assertEquals("newid", inv.path2id("afile")) |
|
503 |
self.assertEquals("newcommit", inv[inv.path2id("afile")].revision) |
|
504 |
||
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
505 |
|
506 |
class TestReplayWorkingtree(TestCaseWithTransport): |
|
507 |
def test_conflicts(self): |
|
508 |
wt = self.make_branch_and_tree("old") |
|
509 |
wt.commit("base", rev_id="base") |
|
510 |
self.build_tree(['old/afile']) |
|
511 |
wt.add(["afile"], ids=["originalid"]) |
|
512 |
wt.commit("bla", rev_id="oldparent") |
|
513 |
file("old/afile", "w").write("bloe") |
|
514 |
wt.commit("bla", rev_id="oldcommit") |
|
515 |
oldrepos = wt.branch.repository |
|
516 |
wt = self.make_branch_and_tree("new") |
|
517 |
self.build_tree(['new/afile']) |
|
518 |
wt.add(["afile"], ids=["newid"]) |
|
519 |
wt.commit("bla", rev_id="newparent") |
|
520 |
wt.branch.repository.fetch(oldrepos) |
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
521 |
wt.lock_write() |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
522 |
self.assertRaises(ConflictsInTree, |
523 |
replay_delta_workingtree, wt, "oldcommit", "newcommit", |
|
524 |
["newparent"]) |
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
525 |
wt.unlock() |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
526 |
|
527 |
def test_simple(self): |
|
528 |
wt = self.make_branch_and_tree("old") |
|
529 |
wt.commit("base", rev_id="base") |
|
530 |
self.build_tree(['old/afile']) |
|
531 |
wt.add(["afile"], ids=["originalid"]) |
|
532 |
wt.commit("bla", rev_id="oldparent") |
|
533 |
file("old/afile", "w").write("bloe") |
|
|
0.436.79
by Jelmer Vernooij
Fix tests when using the latest version of bzr. |
534 |
wt.commit("bla", rev_id="oldcommit") |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
535 |
wt = wt.bzrdir.sprout("new").open_workingtree() |
536 |
self.build_tree(['new/bfile']) |
|
537 |
wt.add(["bfile"], ids=["newid"]) |
|
538 |
wt.commit("bla", rev_id="newparent") |
|
539 |
replay_delta_workingtree(wt, "oldcommit", "newcommit", |
|
540 |
["newparent"]) |
|
541 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
|
542 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
543 |
self.assertEquals(["newparent"], newrev.parent_ids) |
|
544 |
self.assertEquals("newcommit", newrev.revision_id) |
|
545 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
546 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
547 |
||
548 |
def test_multiple(self): |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
549 |
# rebase from
|
550 |
# base: []
|
|
551 |
# oldparent: [base]
|
|
552 |
# newparent: [base]
|
|
553 |
# oldcommit: [oldparent, ghost]
|
|
554 |
# create newcommit by rebasing oldcommit from oldparent to newparent,
|
|
555 |
# keeping the merge of ghost.
|
|
556 |
# Common base:
|
|
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
557 |
wt = self.make_branch_and_tree("old") |
558 |
wt.commit("base", rev_id="base") |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
559 |
# oldparent:
|
560 |
self.build_tree_contents([('old/afile', 'base content')]) |
|
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
561 |
wt.add(["afile"], ids=["originalid"]) |
562 |
wt.commit("bla", rev_id="oldparent") |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
563 |
# oldcommit (the delta getting rebased)
|
564 |
# - change the content of afile to be 'bloe'
|
|
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
565 |
file("old/afile", "w").write("bloe") |
566 |
wt.add_pending_merge("ghost") |
|
567 |
wt.commit("bla", rev_id="oldcommit") |
|
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
568 |
# newparent (the new base for the rebased commit)
|
569 |
new_tree = wt.bzrdir.sprout("new", |
|
570 |
revision_id='base').open_workingtree() |
|
571 |
new_tree.branch.repository.fetch(wt.branch.repository) |
|
572 |
wt = new_tree |
|
573 |
self.build_tree_contents([('new/afile', 'base content')]) |
|
574 |
wt.add(["afile"], ids=["originalid"]) |
|
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
575 |
wt.commit("bla", rev_id="newparent") |
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
576 |
# And do it!
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
577 |
wt.lock_write() |
|
0.441.3
by Robert Collins
Update rebase to 1.6b3 API changes. |
578 |
replay_delta_workingtree(wt, "oldcommit", "newcommit", |
|
0.436.93
by Jelmer Vernooij
Clarify test. |
579 |
("newparent", "ghost")) |
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
580 |
wt.unlock() |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
581 |
oldrev = wt.branch.repository.get_revision("oldcommit") |
582 |
newrev = wt.branch.repository.get_revision("newcommit") |
|
|
0.436.93
by Jelmer Vernooij
Clarify test. |
583 |
self.assertEquals(["oldparent", "ghost"], oldrev.parent_ids) |
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
584 |
self.assertEquals(["newparent", "ghost"], newrev.parent_ids) |
585 |
self.assertEquals("newcommit", newrev.revision_id) |
|
586 |
self.assertEquals(oldrev.timestamp, newrev.timestamp) |
|
587 |
self.assertEquals(oldrev.timezone, newrev.timezone) |
|
588 |
||
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
589 |
def test_already_merged(self): |
590 |
"""We need to use a merge base that makes sense. |
|
591 |
|
|
592 |
A
|
|
593 |
| \
|
|
594 |
B D
|
|
595 |
| \|
|
|
596 |
C E
|
|
597 |
||
598 |
Rebasing E on C should result in:
|
|
599 |
||
|
0.438.1
by Jelmer Vernooij
Split out function for determining rebase base. |
600 |
A -> B -> C -> D' -> E'
|
601 |
||
602 |
Ancestry:
|
|
603 |
A:
|
|
604 |
B: A
|
|
605 |
C: A, B
|
|
606 |
D: A
|
|
607 |
E: A, B, D
|
|
608 |
D': A, B, C
|
|
609 |
E': A, B, C, D'
|
|
610 |
||
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
611 |
"""
|
612 |
oldwt = self.make_branch_and_tree("old") |
|
613 |
self.build_tree(['old/afile']) |
|
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
614 |
file("old/afile", "w").write("A\n" * 10) |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
615 |
oldwt.add(["afile"]) |
616 |
oldwt.commit("base", rev_id="A") |
|
617 |
newwt = oldwt.bzrdir.sprout("new").open_workingtree() |
|
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
618 |
file("old/afile", "w").write("A\n"*10 + "B\n") |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
619 |
oldwt.commit("bla", rev_id="B") |
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
620 |
file("old/afile", "w").write("A\n" * 10 + "C\n") |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
621 |
oldwt.commit("bla", rev_id="C") |
622 |
self.build_tree(['new/bfile']) |
|
623 |
newwt.add(["bfile"]) |
|
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
624 |
file("new/bfile", "w").write("D\n") |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
625 |
newwt.commit("bla", rev_id="D") |
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
626 |
file("new/afile", "w").write("E\n" + "A\n"*10 + "B\n") |
627 |
file("new/bfile", "w").write("D\nE\n") |
|
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
628 |
newwt.add_pending_merge("B") |
629 |
newwt.commit("bla", rev_id="E") |
|
630 |
newwt.branch.repository.fetch(oldwt.branch.repository) |
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
631 |
newwt.lock_write() |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
632 |
replay_delta_workingtree(newwt, "D", "D'", ["C"]) |
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
633 |
newwt.unlock() |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
634 |
oldrev = newwt.branch.repository.get_revision("D") |
635 |
newrev = newwt.branch.repository.get_revision("D'") |
|
636 |
self.assertEquals(["C"], newrev.parent_ids) |
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
637 |
newwt.lock_write() |
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
638 |
self.assertRaises(ConflictsInTree, |
639 |
lambda: replay_delta_workingtree(newwt, "E", "E'", ["D'"])) |
|
|
0.436.62
by Jelmer Vernooij
Fix compatibility with packs. |
640 |
newwt.unlock() |
|
0.438.2
by Jelmer Vernooij
More work using proper merge bases. |
641 |
self.assertEquals("E\n" + "A\n" * 10 + "C\n", |
642 |
open("new/afile", 'r').read()) |
|
|
0.436.56
by Jelmer Vernooij
Fix test. |
643 |
newwt.set_conflicts(ConflictList()) |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
644 |
oldrev = newwt.branch.repository.get_revision("E") |
|
0.436.56
by Jelmer Vernooij
Fix test. |
645 |
commit_rebase(newwt, oldrev, "E'") |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
646 |
newrev = newwt.branch.repository.get_revision("E'") |
|
0.438.1
by Jelmer Vernooij
Split out function for determining rebase base. |
647 |
self.assertEquals(["D'"], newrev.parent_ids) |
|
0.436.39
by Jelmer Vernooij
Some more refactoring, add test that demonstrates #126743. |
648 |
self.assertEquals(["A", "B", "C", "D'", "E'"], |
649 |
newwt.branch.revision_history()) |
|
650 |
||
|
0.436.37
by Jelmer Vernooij
Store parents correctly. |
651 |
|
|
0.436.34
by Jelmer Vernooij
Some more tests. |
652 |
class TestReplaySnapshotError(TestCase): |
653 |
def test_create(self): |
|
654 |
ReplaySnapshotError("message") |
|
655 |
||
656 |
||
657 |
class TestReplayParentsInconsistent(TestCase): |
|
658 |
def test_create(self): |
|
659 |
ReplayParentsInconsistent("afileid", "arevid") |
|
|
0.438.1
by Jelmer Vernooij
Split out function for determining rebase base. |
660 |
|
|
0.436.54
by Jelmer Vernooij
Move determination of merge base to separate function. |
661 |
|
662 |
class ReplayDetermineBaseTests(TestCase): |
|
|
0.436.145
by Jelmer Vernooij
Fix test. |
663 |
|
|
0.436.54
by Jelmer Vernooij
Move determination of merge base to separate function. |
664 |
def setUp(self): |
|
0.436.145
by Jelmer Vernooij
Fix test. |
665 |
TestCase.setUp(self) |
|
0.436.54
by Jelmer Vernooij
Move determination of merge base to separate function. |
666 |
self.graph = Graph(self) |
667 |
||
|
0.436.73
by Jelmer Vernooij
Fix tests. |
668 |
def get_parent_map(self, keys): |
669 |
return dict((revid, self._parent_dict[revid]) for k in self._parent_dict if k in keys) |
|
670 |
||
|
0.436.54
by Jelmer Vernooij
Move determination of merge base to separate function. |
671 |
def get_parents(self, revid): |
672 |
return self._parent_dict[revid] |
|
673 |
||
674 |
def test_null(self): |
|
675 |
self._parent_dict = {"myrev": []} |
|
676 |
self.assertEquals(NULL_REVISION, |
|
677 |
replay_determine_base(self.graph, "myrev", [], "mynewrev", ["bar"])) |
|
678 |
||
679 |
def test_simple(self): |
|
680 |
self._parent_dict = {"myinitrev": [], "myrev": ["myinitrev"]} |
|
681 |
self.assertEquals("myinitrev", |
|
682 |
replay_determine_base(self.graph, "myrev", ["myinitrev"], |
|
683 |
"mynewrev", ["mynewparents"])) |
|
684 |