18
18
"""Direct tests of the loggerhead/history.py module"""
20
from bzrlib.foreign import (
20
26
from datetime import datetime
21
27
from bzrlib import tag, tests
294
300
self.assertEqual('Z', start_revid)
295
301
self.assertEqual(set([history._rev_indices[x] for x in 'ZYXWVU']),
305
class TestHistoryGetChangedUncached(TestCaseWithExamples):
307
def test_native(self):
308
history = self.make_linear_ancestry()
309
changes = history.get_changes_uncached(['rev-1', 'rev-2'])
310
self.assertEquals(2, len(changes))
311
self.assertEquals('rev-1', changes[0].revid)
312
self.assertEquals('rev-2', changes[1].revid)
313
self.assertIs(None, getattr(changes[0], 'foreign_vcs', None))
314
self.assertIs(None, getattr(changes[0], 'foreign_revid', None))
316
def test_foreign(self):
317
# Test with a mocked foreign revision, as it's not possible
318
# to rely on any foreign plugins being installed.
319
history = self.make_linear_ancestry()
320
foreign_vcs = ForeignVcs(None, "vcs")
321
foreign_vcs.show_foreign_revid = repr
322
foreign_rev = ForeignRevision(("uuid", 1234), VcsMapping(foreign_vcs),
323
"revid-in-bzr", message="message",
324
timestamp=234423423.3)
325
change = history._change_from_revision(foreign_rev)
326
self.assertEquals('revid-in-bzr', change.revid)
327
self.assertEquals("('uuid', 1234)", change.foreign_revid)
328
self.assertEquals("vcs", change.foreign_vcs)