/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.py

  • Committer: Martin
  • Date: 2010-05-16 12:21:31 UTC
  • mto: This revision was merged to the branch mainline in revision 5237.
  • Revision ID: gzlist@googlemail.com-20100516122131-6y6dh5grn27czjuh
Rename test method in bt.test__walkdirs_win32 that clashes with an attribute name

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
 
78
78
from bzrlib import symbol_versioning
79
79
from bzrlib.decorators import needs_read_lock, needs_write_lock
 
80
from bzrlib.lock import LogicalLockResult
80
81
from bzrlib.lockable_files import LockableFiles
81
82
from bzrlib.lockdir import LockDir
82
83
import bzrlib.mutabletree
1798
1799
            raise errors.ObjectNotLocked(self)
1799
1800
 
1800
1801
    def lock_read(self):
1801
 
        """See Branch.lock_read, and WorkingTree.unlock."""
 
1802
        """Lock the tree for reading.
 
1803
 
 
1804
        This also locks the branch, and can be unlocked via self.unlock().
 
1805
 
 
1806
        :return: A bzrlib.lock.LogicalLockResult.
 
1807
        """
1802
1808
        if not self.is_locked():
1803
1809
            self._reset_data()
1804
1810
        self.branch.lock_read()
1805
1811
        try:
1806
 
            return self._control_files.lock_read()
 
1812
            self._control_files.lock_read()
 
1813
            return LogicalLockResult(self.unlock)
1807
1814
        except:
1808
1815
            self.branch.unlock()
1809
1816
            raise
1810
1817
 
1811
1818
    def lock_tree_write(self):
1812
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
 
1819
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
 
1820
 
 
1821
        :return: A bzrlib.lock.LogicalLockResult.
 
1822
        """
1813
1823
        if not self.is_locked():
1814
1824
            self._reset_data()
1815
1825
        self.branch.lock_read()
1816
1826
        try:
1817
 
            return self._control_files.lock_write()
 
1827
            self._control_files.lock_write()
 
1828
            return LogicalLockResult(self.unlock)
1818
1829
        except:
1819
1830
            self.branch.unlock()
1820
1831
            raise
1821
1832
 
1822
1833
    def lock_write(self):
1823
 
        """See MutableTree.lock_write, and WorkingTree.unlock."""
 
1834
        """See MutableTree.lock_write, and WorkingTree.unlock.
 
1835
 
 
1836
        :return: A bzrlib.lock.LogicalLockResult.
 
1837
        """
1824
1838
        if not self.is_locked():
1825
1839
            self._reset_data()
1826
1840
        self.branch.lock_write()
1827
1841
        try:
1828
 
            return self._control_files.lock_write()
 
1842
            self._control_files.lock_write()
 
1843
            return LogicalLockResult(self.unlock)
1829
1844
        except:
1830
1845
            self.branch.unlock()
1831
1846
            raise
1956
1971
        def recurse_directory_to_add_files(directory):
1957
1972
            # Recurse directory and add all files
1958
1973
            # so we can check if they have changed.
1959
 
            for parent_info, file_infos in\
1960
 
                self.walkdirs(directory):
 
1974
            for parent_info, file_infos in self.walkdirs(directory):
1961
1975
                for relpath, basename, kind, lstat, fileid, kind in file_infos:
1962
1976
                    # Is it versioned or ignored?
1963
1977
                    if self.path2id(relpath) or self.is_ignored(relpath):
1998
2012
                            # ... but not ignored
1999
2013
                            has_changed_files = True
2000
2014
                            break
2001
 
                    elif content_change and (kind[1] is not None):
2002
 
                        # Versioned and changed, but not deleted
 
2015
                    elif (content_change and (kind[1] is not None) and
 
2016
                            osutils.is_inside_any(files, path[1])):
 
2017
                        # Versioned and changed, but not deleted, and still
 
2018
                        # in one of the dirs to be deleted.
2003
2019
                        has_changed_files = True
2004
2020
                        break
2005
2021
 
2636
2652
 
2637
2653
        In Format2 WorkingTrees we have a single lock for the branch and tree
2638
2654
        so lock_tree_write() degrades to lock_write().
 
2655
 
 
2656
        :return: An object with an unlock method which will release the lock
 
2657
            obtained.
2639
2658
        """
2640
2659
        self.branch.lock_write()
2641
2660
        try:
2642
 
            return self._control_files.lock_write()
 
2661
            self._control_files.lock_write()
 
2662
            return self
2643
2663
        except:
2644
2664
            self.branch.unlock()
2645
2665
            raise