~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_get_revision_id_to_revno_map.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for Branch.get_revision_id_to_revno_map()"""
18
18
 
19
 
from bzrlib.symbol_versioning import deprecated_in
 
19
from bzrlib import (
 
20
    errors,
 
21
    revision,
 
22
    )
 
23
 
20
24
from bzrlib.tests.per_branch import TestCaseWithBranch
21
25
 
22
26
 
81
85
        finally:
82
86
            branch.unlock()
83
87
 
 
88
    def test_set_revision_history_when_locked(self):
 
89
        """Calling set_revision_history should reset the cache."""
 
90
        branch, calls = self.get_instrumented_branch()
 
91
        branch.lock_write()
 
92
        try:
 
93
            self.assertEqual({'rev-1':(1,), 'rev-2':(2,), 'rev-3':(3,),
 
94
                              'rev-1.1.1':(1,1,1)
 
95
                             }, branch.get_revision_id_to_revno_map())
 
96
            branch.set_revision_history(['rev-1', 'rev-2'])
 
97
            self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},
 
98
                             branch.get_revision_id_to_revno_map())
 
99
            self.assertEqual({'rev-1':(1,), 'rev-2':(2,)},
 
100
                             branch.get_revision_id_to_revno_map())
 
101
            self.assertEqual(['_gen_revno_map']*2, calls)
 
102
        finally:
 
103
            branch.unlock()
 
104
 
84
105
    def test_set_last_revision_info_when_locked(self):
85
106
        """Calling set_last_revision_info should reset the cache."""
86
107
        branch, calls = self.get_instrumented_branch()