~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inter.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil, Patch Queue Manager, Jelmer Vernooij
  • Date: 2017-01-17 16:20:41 UTC
  • mfrom: (6619.1.2 trunk)
  • Revision ID: tarmac-20170117162041-oo62uk1qsmgc9j31
Merge 2.7 into trunk including fixes for bugs #1622039, #1644003, #1579093 and #1645017. [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
 
18
17
"""Inter-object utility class."""
19
18
 
 
19
from __future__ import absolute_import
 
20
 
 
21
from bzrlib.errors import NoCompatibleInter
 
22
 
20
23
 
21
24
class InterObject(object):
22
25
    """This class represents operations taking place between two objects.
75
78
                       the InterObject instance.
76
79
        :param target: the object to be the 'target' member of
77
80
                       the InterObject instance.
 
81
 
78
82
        If an optimised worker exists it will be used otherwise
79
83
        a default Inter worker instance will be created.
80
84
        """
81
85
        for provider in reversed(klass._optimisers):
82
86
            if provider.is_compatible(source, target):
83
87
                return provider(source, target)
84
 
        return klass(source, target)
 
88
        raise NoCompatibleInter(source, target)
85
89
 
86
90
    def lock_read(self):
87
91
        """Take out a logical read lock.