/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/repofmt/pack_repo.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    GraphIndex,
65
65
    InMemoryGraphIndex,
66
66
    )
67
 
from bzrlib.lock import LogicalLockResult
68
67
from bzrlib.repofmt.knitrepo import KnitRepository
69
68
from bzrlib.repository import (
70
69
    CommitBuilder,
71
70
    MetaDirRepositoryFormat,
72
71
    RepositoryFormat,
73
 
    RepositoryWriteLockResult,
74
72
    RootCommitBuilder,
75
73
    StreamSource,
76
74
    )
2342
2340
        return self._write_lock_count
2343
2341
 
2344
2342
    def lock_write(self, token=None):
2345
 
        """Lock the repository for writes.
2346
 
 
2347
 
        :return: A bzrlib.repository.RepositoryWriteLockResult.
2348
 
        """
2349
2343
        locked = self.is_locked()
2350
2344
        if not self._write_lock_count and locked:
2351
2345
            raise errors.ReadOnlyError(self)
2360
2354
                # Writes don't affect fallback repos
2361
2355
                repo.lock_read()
2362
2356
            self._refresh_data()
2363
 
        return RepositoryWriteLockResult(self.unlock, None)
2364
2357
 
2365
2358
    def lock_read(self):
2366
 
        """Lock the repository for reads.
2367
 
 
2368
 
        :return: A bzrlib.lock.LogicalLockResult.
2369
 
        """
2370
2359
        locked = self.is_locked()
2371
2360
        if self._write_lock_count:
2372
2361
            self._write_lock_count += 1
2379
2368
            for repo in self._fallback_repositories:
2380
2369
                repo.lock_read()
2381
2370
            self._refresh_data()
2382
 
        return LogicalLockResult(self.unlock)
2383
2371
 
2384
2372
    def leave_lock_in_place(self):
2385
2373
        # not supported - raise an error