~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inter.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    the needs_read_lock and needs_write_lock decorators.)
37
37
    """
38
38
 
39
 
    # _optimisers = set()
40
 
    # Each concrete InterObject type should have its own optimisers set.
 
39
    # _optimisers = list()
 
40
    # Each concrete InterObject type should have its own optimisers list.
41
41
 
42
42
    def __init__(self, source, target):
43
43
        """Construct a default InterObject instance. Please use 'get'.
74
74
        If an optimised worker exists it will be used otherwise
75
75
        a default Inter worker instance will be created.
76
76
        """
77
 
        for provider in klass._optimisers:
 
77
        for provider in reversed(klass._optimisers):
78
78
            if provider.is_compatible(source, target):
79
79
                return provider(source, target)
80
80
        return klass(source, target)
98
98
    @classmethod
99
99
    def register_optimiser(klass, optimiser):
100
100
        """Register an InterObject optimiser."""
101
 
        klass._optimisers.add(optimiser)
 
101
        klass._optimisers.append(optimiser)
102
102
 
103
103
    def unlock(self):
104
104
        """Release the locks on source and target."""