~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/matchers.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 17:14:34 UTC
  • mfrom: (6378.1.5 config-si-unit)
  • Revision ID: pqm@pqm.ubuntu.com-20111219171434-i0b4ir0invs9il2v
(vila) Migrate add.maximum_file_size configuration option. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    'MatchesAncestry',
32
32
    'ContainsNoVfsCalls',
33
33
    'ReturnsUnlockable',
34
 
    'RevisionHistoryMatches',
35
34
    ]
36
35
 
37
36
from bzrlib import (
185
184
        return Equals(entries).match(actual)
186
185
 
187
186
 
188
 
class RevisionHistoryMatches(Matcher):
189
 
    """A matcher that checks if a branch has a specific revision history.
190
 
 
191
 
    :ivar history: Revision history, as list of revisions. Oldest first.
192
 
    """
193
 
 
194
 
    def __init__(self, history):
195
 
        Matcher.__init__(self)
196
 
        self.expected = history
197
 
 
198
 
    def __str__(self):
199
 
        return 'RevisionHistoryMatches(%r)' % self.expected
200
 
 
201
 
    def match(self, branch):
202
 
        branch.lock_read()
203
 
        try:
204
 
            graph = branch.repository.get_graph()
205
 
            history = list(graph.iter_lefthand_ancestry(
206
 
                branch.last_revision(), [_mod_revision.NULL_REVISION]))
207
 
            history.reverse()
208
 
        finally:
209
 
            branch.unlock()
210
 
        return Equals(self.expected).match(history)
211
 
 
212
 
 
213
187
class _NoVfsCallsMismatch(Mismatch):
214
188
    """Mismatch describing a list of HPSS calls which includes VFS requests."""
215
189