~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2010-05-05 02:35:02 UTC
  • mto: This revision was merged to the branch mainline in revision 5206.
  • Revision ID: robertc@robertcollins.net-20100505023502-fzybvhmxe9sv3b3g
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1798
1798
            raise errors.ObjectNotLocked(self)
1799
1799
 
1800
1800
    def lock_read(self):
1801
 
        """Lock the tree for reading.
1802
 
 
1803
 
        This also locks the branch, and can be unlocked via self.unlock().
1804
 
 
1805
 
        :return: An object with an unlock method which will release the lock
1806
 
            obtained.
1807
 
        """
 
1801
        """See Branch.lock_read, and WorkingTree.unlock."""
1808
1802
        if not self.is_locked():
1809
1803
            self._reset_data()
1810
1804
        self.branch.lock_read()
1811
1805
        try:
1812
 
            self._control_files.lock_read()
1813
 
            return self
 
1806
            return self._control_files.lock_read()
1814
1807
        except:
1815
1808
            self.branch.unlock()
1816
1809
            raise
1817
1810
 
1818
1811
    def lock_tree_write(self):
1819
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1820
 
 
1821
 
        :return: An object with an unlock method which will release the lock
1822
 
            obtained.
1823
 
        """
 
1812
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
1824
1813
        if not self.is_locked():
1825
1814
            self._reset_data()
1826
1815
        self.branch.lock_read()
1827
1816
        try:
1828
 
            self._control_files.lock_write()
1829
 
            return self
 
1817
            return self._control_files.lock_write()
1830
1818
        except:
1831
1819
            self.branch.unlock()
1832
1820
            raise
1833
1821
 
1834
1822
    def lock_write(self):
1835
 
        """See MutableTree.lock_write, and WorkingTree.unlock.
1836
 
 
1837
 
        :return: An object with an unlock method which will release the lock
1838
 
            obtained.
1839
 
        """
 
1823
        """See MutableTree.lock_write, and WorkingTree.unlock."""
1840
1824
        if not self.is_locked():
1841
1825
            self._reset_data()
1842
1826
        self.branch.lock_write()
1843
1827
        try:
1844
 
            self._control_files.lock_write()
1845
 
            return self
 
1828
            return self._control_files.lock_write()
1846
1829
        except:
1847
1830
            self.branch.unlock()
1848
1831
            raise
2653
2636
 
2654
2637
        In Format2 WorkingTrees we have a single lock for the branch and tree
2655
2638
        so lock_tree_write() degrades to lock_write().
2656
 
 
2657
 
        :return: An object with an unlock method which will release the lock
2658
 
            obtained.
2659
2639
        """
2660
2640
        self.branch.lock_write()
2661
2641
        try:
2662
 
            self._control_files.lock_write()
2663
 
            return self
 
2642
            return self._control_files.lock_write()
2664
2643
        except:
2665
2644
            self.branch.unlock()
2666
2645
            raise