~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

merge from mbp storage branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.tree import RevisionTree
27
27
from bzrlib.errors import InvalidRevisionId
28
28
from bzrlib.testament import Testament
29
 
 
30
 
 
31
 
def needs_read_lock(unbound):
32
 
    """Decorate unbound to take out and release a read lock."""
33
 
    def decorated(self, *args, **kwargs):
34
 
        self.control_files.lock_read()
35
 
        try:
36
 
            return unbound(self, *args, **kwargs)
37
 
        finally:
38
 
            self.control_files.unlock()
39
 
    return decorated
40
 
 
41
 
 
42
 
def needs_write_lock(unbound):
43
 
    """Decorate unbound to take out and release a write lock."""
44
 
    def decorated(self, *args, **kwargs):
45
 
        self.control_files.lock_write()
46
 
        try:
47
 
            return unbound(self, *args, **kwargs)
48
 
        finally:
49
 
            self.control_files.unlock()
50
 
    return decorated
 
29
from bzrlib.decorators import needs_read_lock, needs_write_lock
 
30
 
51
31
 
52
32
 
53
33
class Repository(object):
 
34
    """Repository holding history for one or more branches.
 
35
 
 
36
    The repository holds and retrieves historical information including
 
37
    revisions and file history.  It's normally accessed only by the Branch,
 
38
    which views a particular line of development through that history.
 
39
 
 
40
    The Repository builds on top of Stores and a Transport, which respectively 
 
41
    describe the disk data format and the way of accessing the (possibly 
 
42
    remote) disk.
 
43
    """
54
44
 
55
45
    def __init__(self, transport, branch_format):
56
46
        object.__init__(self)