/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: Robert Collins
  • Date: 2010-05-06 23:54:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506235405-wii4elupfhzl3jvy
Add __str__ to the new helper classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
50
50
from bzrlib.hooks import HookPoint, Hooks
51
51
from bzrlib.inter import InterObject
52
 
from bzrlib.lock import _RelockDebugMixin, LogicalLockResult
 
52
from bzrlib.lock import _RelockDebugMixin
53
53
from bzrlib import registry
54
54
from bzrlib.symbol_versioning import (
55
55
    deprecated_in,
295
295
    def lock_read(self):
296
296
        """Lock the branch for read operations.
297
297
 
298
 
        :return: A bzrlib.lock.LogicalLockResult.
 
298
        :return: An object with an unlock method which will release the lock
 
299
            obtained.
299
300
        """
300
301
        raise NotImplementedError(self.lock_read)
301
302
 
2275
2276
    _legacy_formats[0].network_name(), _legacy_formats[0].__class__)
2276
2277
 
2277
2278
 
2278
 
class BranchWriteLockResult(LogicalLockResult):
 
2279
class BranchWriteLockResult(object):
2279
2280
    """The result of write locking a branch.
2280
2281
 
2281
2282
    :ivar branch_token: The token obtained from the underlying branch lock, or
2284
2285
    """
2285
2286
 
2286
2287
    def __init__(self, unlock, branch_token):
2287
 
        LogicalLockResult.__init__(self, unlock)
2288
2288
        self.branch_token = branch_token
 
2289
        self.unlock = unlock
2289
2290
 
2290
 
    def __repr__(self):
 
2291
    def __str__(self):
2291
2292
        return "BranchWriteLockResult(%s, %s)" % (self.branch_token,
2292
2293
            self.unlock)
2293
2294
 
2378
2379
    def lock_read(self):
2379
2380
        """Lock the branch for read operations.
2380
2381
 
2381
 
        :return: A bzrlib.lock.LogicalLockResult.
 
2382
        :return: An object with an unlock method which will release the lock
 
2383
            obtained.
2382
2384
        """
2383
2385
        if not self.is_locked():
2384
2386
            self._note_lock('r')
2392
2394
            took_lock = False
2393
2395
        try:
2394
2396
            self.control_files.lock_read()
2395
 
            return LogicalLockResult(self.unlock)
 
2397
            return self
2396
2398
        except:
2397
2399
            if took_lock:
2398
2400
                self.repository.unlock()