161
161
self.sources = MultipleRevisionSources(self.br1.repository,
162
162
self.br2.repository)
164
def intervene(self, ancestor, revision, revision_history=None):
165
from bzrlib.revision import get_intervening_revisions
166
return get_intervening_revisions(ancestor,revision, self.sources,
169
def test_intervene(self):
170
"""Find intermediate revisions, without requiring history"""
171
from bzrlib.errors import NotAncestor, NoSuchRevision
172
self.assertEquals(len(self.intervene('a@u-0-0', 'a@u-0-0')), 0)
173
self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-1'), ['a@u-0-1'])
174
self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-2'),
175
['a@u-0-1', 'a@u-0-2'])
176
self.assertEqual(self.intervene('a@u-0-0', 'b@u-0-3'),
177
['a@u-0-1', 'a@u-0-2', 'b@u-0-3'])
178
self.assertEqual(self.intervene('b@u-0-3', 'a@u-0-3'),
179
['b@u-0-4', 'a@u-0-3'])
180
self.assertEqual(self.intervene('a@u-0-2', 'a@u-0-3',
181
self.br1.revision_history()),
183
self.assertEqual(self.intervene('a@u-0-0', 'a@u-0-5',
184
self.br1.revision_history()),
185
['a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
187
self.assertEqual(self.intervene('a@u-0-0', 'b@u-0-6',
188
self.br1.revision_history()),
189
['a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
191
self.assertEqual(self.intervene('a@u-0-0', 'b@u-0-5'),
192
['a@u-0-1', 'a@u-0-2', 'b@u-0-3', 'b@u-0-4',
194
self.assertEqual(self.intervene('b@u-0-3', 'b@u-0-6',
195
self.br2.revision_history()),
196
['b@u-0-4', 'b@u-0-5', 'b@u-0-6'])
197
self.assertEqual(self.intervene('b@u-0-6', 'b@u-0-10'),
198
['b@u-0-7', 'b@u-0-8', 'b@u-0-9', 'b@u-0-10'])
199
self.assertEqual(self.intervene('b@u-0-6', 'b@u-0-10',
200
self.br2.revision_history()),
201
['b@u-0-7', 'b@u-0-8', 'b@u-0-9', 'b@u-0-10'])
202
self.assertRaises(NotAncestor, self.intervene, 'b@u-0-10', 'b@u-0-6',
203
self.br2.revision_history())
204
self.assertRaises(NoSuchRevision, self.intervene, 'c@u-0-10',
205
'b@u-0-6', self.br2.revision_history())
206
self.assertRaises(NoSuchRevision, self.intervene, 'b@u-0-10',
207
'c@u-0-6', self.br2.revision_history())
210
166
class MockRevisionSource(object):