/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/workingtree_4.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:
53
53
from bzrlib.decorators import needs_read_lock, needs_write_lock
54
54
from bzrlib.filters import filtered_input_file, internal_size_sha_file_byname
55
55
from bzrlib.inventory import Inventory, ROOT_ID, entry_factory
56
 
from bzrlib.lock import LogicalLockResult
57
56
from bzrlib.mutabletree import needs_tree_write_lock
58
57
from bzrlib.osutils import (
59
58
    file_kind,
568
567
            return _mod_revision.NULL_REVISION
569
568
 
570
569
    def lock_read(self):
571
 
        """See Branch.lock_read, and WorkingTree.unlock.
572
 
 
573
 
        :return: A bzrlib.lock.LogicalLockResult.
574
 
        """
 
570
        """See Branch.lock_read, and WorkingTree.unlock."""
575
571
        self.branch.lock_read()
576
572
        try:
577
573
            self._control_files.lock_read()
590
586
        except:
591
587
            self.branch.unlock()
592
588
            raise
593
 
        return LogicalLockResult(self.unlock)
594
589
 
595
590
    def _lock_self_write(self):
596
591
        """This should be called after the branch is locked."""
611
606
        except:
612
607
            self.branch.unlock()
613
608
            raise
614
 
        return LogicalLockResult(self.unlock)
615
609
 
616
610
    def lock_tree_write(self):
617
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
618
 
 
619
 
        :return: A bzrlib.lock.LogicalLockResult.
620
 
        """
 
611
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
621
612
        self.branch.lock_read()
622
 
        return self._lock_self_write()
 
613
        self._lock_self_write()
623
614
 
624
615
    def lock_write(self):
625
 
        """See MutableTree.lock_write, and WorkingTree.unlock.
626
 
 
627
 
        :return: A bzrlib.lock.LogicalLockResult.
628
 
        """
 
616
        """See MutableTree.lock_write, and WorkingTree.unlock."""
629
617
        self.branch.lock_write()
630
 
        return self._lock_self_write()
 
618
        self._lock_self_write()
631
619
 
632
620
    @needs_tree_write_lock
633
621
    def move(self, from_paths, to_dir, after=False):
1871
1859
            return None
1872
1860
        return ie.executable
1873
1861
 
1874
 
    def is_locked(self):
1875
 
        return self._locked
1876
 
 
1877
1862
    def list_files(self, include_root=False, from_dir=None, recursive=True):
1878
1863
        # We use a standard implementation, because DirStateRevisionTree is
1879
1864
        # dealing with one of the parents of the current state
1892
1877
            yield path, 'V', entry.kind, entry.file_id, entry
1893
1878
 
1894
1879
    def lock_read(self):
1895
 
        """Lock the tree for a set of operations.
1896
 
 
1897
 
        :return: A bzrlib.lock.LogicalLockResult.
1898
 
        """
 
1880
        """Lock the tree for a set of operations."""
1899
1881
        if not self._locked:
1900
1882
            self._repository.lock_read()
1901
1883
            if self._dirstate._lock_token is None:
1902
1884
                self._dirstate.lock_read()
1903
1885
                self._dirstate_locked = True
1904
1886
        self._locked += 1
1905
 
        return LogicalLockResult(self.unlock)
1906
1887
 
1907
1888
    def _must_be_locked(self):
1908
1889
        if not self._locked: