/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/matchers.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    'HasLayout',
31
31
    'HasPathRelations',
32
32
    'MatchesAncestry',
33
 
    'ContainsNoVfsCalls',
34
33
    'ReturnsUnlockable',
35
34
    'RevisionHistoryMatches',
36
35
    ]
39
38
    osutils,
40
39
    revision as _mod_revision,
41
40
    )
42
 
from .. import lazy_import
43
 
lazy_import.lazy_import(globals(),
44
 
                        """
45
 
from breezy.bzr.smart.request import request_handlers as smart_request_handlers
46
 
from breezy.bzr.smart import vfs
47
 
""")
48
 
from ..tree import (
49
 
    find_previous_path,
50
 
    InterTree,
51
 
    )
 
41
 
 
42
from ..tree import InterTree
52
43
 
53
44
from testtools.matchers import Equals, Mismatch, Matcher
54
45
 
278
269
                branch.last_revision(), [_mod_revision.NULL_REVISION]))
279
270
            history.reverse()
280
271
        return Equals(self.expected).match(history)
281
 
 
282
 
 
283
 
class _NoVfsCallsMismatch(Mismatch):
284
 
    """Mismatch describing a list of HPSS calls which includes VFS requests."""
285
 
 
286
 
    def __init__(self, vfs_calls):
287
 
        self.vfs_calls = vfs_calls
288
 
 
289
 
    def describe(self):
290
 
        return "no VFS calls expected, got: %s" % ",".join([
291
 
            "%s(%s)" % (c.method,
292
 
                        ", ".join([repr(a) for a in c.args])) for c in self.vfs_calls])
293
 
 
294
 
 
295
 
class ContainsNoVfsCalls(Matcher):
296
 
    """Ensure that none of the specified calls are HPSS calls."""
297
 
 
298
 
    def __str__(self):
299
 
        return 'ContainsNoVfsCalls()'
300
 
 
301
 
    @classmethod
302
 
    def match(cls, hpss_calls):
303
 
        vfs_calls = []
304
 
        for call in hpss_calls:
305
 
            try:
306
 
                request_method = smart_request_handlers.get(call.call.method)
307
 
            except KeyError:
308
 
                # A method we don't know about doesn't count as a VFS method.
309
 
                continue
310
 
            if issubclass(request_method, vfs.VfsRequest):
311
 
                vfs_calls.append(call.call)
312
 
        if len(vfs_calls) == 0:
313
 
            return None
314
 
        return _NoVfsCallsMismatch(vfs_calls)