/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: John Arbash Meinel
  • Date: 2010-08-10 20:03:44 UTC
  • mto: This revision was merged to the branch mainline in revision 5376.
  • Revision ID: john@arbash-meinel.com-20100810200344-6muerwvkafqu7w47
Rework things a bit so the logic can be shared.

It turns out that some of the peak memory is actually during the inventory
to string to bundle translations. So re-use the refcount logic there.
This actually does show a decrease in peak memory.
Specifically 'cd bzr.dev; bzr send ../2.2' drops from 221MB peak to 156MB.

We don't speed anything up (16.5s both ways), but peak memory is quite
a bit better.

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,
2341
2342
        return self._write_lock_count
2342
2343
 
2343
2344
    def lock_write(self, token=None):
 
2345
        """Lock the repository for writes.
 
2346
 
 
2347
        :return: A bzrlib.repository.RepositoryWriteLockResult.
 
2348
        """
2344
2349
        locked = self.is_locked()
2345
2350
        if not self._write_lock_count and locked:
2346
2351
            raise errors.ReadOnlyError(self)
2358
2363
        return RepositoryWriteLockResult(self.unlock, None)
2359
2364
 
2360
2365
    def lock_read(self):
 
2366
        """Lock the repository for reads.
 
2367
 
 
2368
        :return: A bzrlib.lock.LogicalLockResult.
 
2369
        """
2361
2370
        locked = self.is_locked()
2362
2371
        if self._write_lock_count:
2363
2372
            self._write_lock_count += 1
2370
2379
            for repo in self._fallback_repositories:
2371
2380
                repo.lock_read()
2372
2381
            self._refresh_data()
2373
 
        return self
 
2382
        return LogicalLockResult(self.unlock)
2374
2383
 
2375
2384
    def leave_lock_in_place(self):
2376
2385
        # not supported - raise an error