/brz/remove-bazaar

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