~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/tests/test_history.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-25 13:09:10 UTC
  • mfrom: (442.2.1 trunk)
  • Revision ID: jelmer@samba.org-20110325130910-awpn311q8f6yxvf4
Merge fix for foreign revision info displaying.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Direct tests of the loggerhead/history.py module"""
19
19
 
 
20
from bzrlib.foreign import (
 
21
    ForeignRevision,
 
22
    ForeignVcs,
 
23
    VcsMapping,
 
24
    )
 
25
 
20
26
from datetime import datetime
21
27
from bzrlib import tag, tests
22
28
 
294
300
        self.assertEqual('Z', start_revid)
295
301
        self.assertEqual(set([history._rev_indices[x] for x in 'ZYXWVU']),
296
302
                         accessed)
 
303
 
 
304
 
 
305
class TestHistoryGetChangedUncached(TestCaseWithExamples):
 
306
 
 
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))
 
315
 
 
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)