/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-07-04 06:22:11 UTC
  • mto: This revision was merged to the branch mainline in revision 5332.
  • Revision ID: robertc@robertcollins.net-20100704062211-tk9hw6bnsn5x47fm
``bzrlib.lsprof.profile`` will no longer silently generate bad threaded
profiles when concurrent profile requests are made. Instead the profile
requests will be serialised. Reentrant requests will now deadlock.
(Robert Collins)

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