/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 bzrlib/branch.py

  • Committer: Andrew Bennetts
  • Date: 2007-04-11 13:35:32 UTC
  • mto: (2018.5.146 hpss)
  • mto: This revision was merged to the branch mainline in revision 2414.
  • Revision ID: andrew.bennetts@canonical.com-20070411133532-u6x6edf3dmzamnaq
LockDir, Repository and Branch lock token changes from the hpss branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
    def get_physical_lock_status(self):
196
196
        raise NotImplementedError(self.get_physical_lock_status)
197
197
 
 
198
    def leave_lock_in_place(self):
 
199
        """Tell this branch object not to release the physical lock when this
 
200
        object is unlocked.
 
201
        
 
202
        If lock_write doesn't return a token, then this method is not supported.
 
203
        """
 
204
        self.control_files.leave_in_place()
 
205
 
 
206
    def dont_leave_lock_in_place(self):
 
207
        """Tell this branch object to release the physical lock when this
 
208
        object is unlocked, even if it didn't originally acquire it.
 
209
 
 
210
        If lock_write doesn't return a token, then this method is not supported.
 
211
        """
 
212
        self.control_files.dont_leave_in_place()
 
213
 
198
214
    def abspath(self, name):
199
215
        """Return absolute filename for something in the branch
200
216
        
1223
1239
    def is_locked(self):
1224
1240
        return self.control_files.is_locked()
1225
1241
 
1226
 
    def lock_write(self):
1227
 
        self.repository.lock_write()
 
1242
    def lock_write(self, tokens=None):
 
1243
        if tokens is not None:
 
1244
            branch_token, repo_token = tokens
 
1245
        else:
 
1246
            branch_token = repo_token = None
 
1247
        repo_token = self.repository.lock_write(token=repo_token)
1228
1248
        try:
1229
 
            self.control_files.lock_write()
 
1249
            branch_token = self.control_files.lock_write(token=branch_token)
1230
1250
        except:
1231
1251
            self.repository.unlock()
1232
1252
            raise
 
1253
        else:
 
1254
            tokens = (branch_token, repo_token)
 
1255
            assert tokens == (None, None) or None not in tokens, (
 
1256
                'Both branch and repository locks must return tokens, or else '
 
1257
                'neither must return tokens.  Got %r.' % (tokens,))
 
1258
            if tokens == (None, None):
 
1259
                return None
 
1260
            else:
 
1261
                return tokens
1233
1262
 
1234
1263
    def lock_read(self):
1235
1264
        self.repository.lock_read()