~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Martin Pool
  • Date: 2005-06-27 01:25:24 UTC
  • Revision ID: mbp@sourcefrog.net-20050627012523-50f6769ce9e125f9
- tweak rsync upload script

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
 
101
101
class RemoteBranch(Branch):
102
 
    def __init__(self, baseurl, find_root=True, lock_mode='r'):
 
102
    def __init__(self, baseurl, find_root=True):
103
103
        """Create new proxy for a remote branch."""
104
 
        if lock_mode not in ('', 'r'):
105
 
            raise BzrError('lock mode %r is not supported for remote branches'
106
 
                           % lock_mode)
107
 
 
108
104
        if find_root:
109
105
            self.baseurl = _find_remote_root(baseurl)
110
106
        else:
113
109
 
114
110
        self.inventory_store = RemoteStore(baseurl + '/.bzr/inventory-store/')
115
111
        self.text_store = RemoteStore(baseurl + '/.bzr/text-store/')
 
112
        self.revision_store = RemoteStore(baseurl + '/.bzr/revision-store/')
116
113
 
117
114
    def __str__(self):
118
 
        return '%s(%r)' % (self.__class__.__name__, self.baseurl)
 
115
        b = getattr(self, 'baseurl', 'undefined')
 
116
        return '%s(%r)' % (self.__class__.__name__, b)
119
117
 
120
118
    __repr__ = __str__
121
119
 
124
122
            raise BzrError("file mode %r not supported for remote branches" % mode)
125
123
        return get_url(self.baseurl + '/.bzr/' + filename, False)
126
124
 
127
 
    def _need_readlock(self):
128
 
        # remote branch always safe for read
129
 
        pass
130
 
 
131
 
    def _need_writelock(self):
132
 
        raise BzrError("cannot get write lock on HTTP remote branch")
 
125
 
 
126
    def lock_read(self):
 
127
        # no locking for remote branches yet
 
128
        pass
 
129
 
 
130
    def lock_write(self):
 
131
        from errors import LockError
 
132
        raise LockError("write lock not supported for remote branch %s"
 
133
                        % self.baseurl)
 
134
 
 
135
    def unlock(self):
 
136
        pass
 
137
    
133
138
 
134
139
    def relpath(self, path):
135
140
        if not path.startswith(self.baseurl):
140
145
 
141
146
    def get_revision(self, revision_id):
142
147
        from revision import Revision
143
 
        revf = get_url(self.baseurl + '/.bzr/revision-store/' + revision_id,
144
 
                       True)
 
148
        revf = self.revision_store[revision_id]
145
149
        r = Revision.read_xml(revf)
146
150
        if r.revision_id != revision_id:
147
151
            raise BzrCheckError('revision stored as {%s} actually contains {%s}'