~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.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:
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
81
80
from bzrlib.lockable_files import LockableFiles
82
81
from bzrlib.lockdir import LockDir
83
82
import bzrlib.mutabletree
1803
1802
 
1804
1803
        This also locks the branch, and can be unlocked via self.unlock().
1805
1804
 
1806
 
        :return: A bzrlib.lock.LogicalLockResult.
 
1805
        :return: An object with an unlock method which will release the lock
 
1806
            obtained.
1807
1807
        """
1808
1808
        if not self.is_locked():
1809
1809
            self._reset_data()
1810
1810
        self.branch.lock_read()
1811
1811
        try:
1812
1812
            self._control_files.lock_read()
1813
 
            return LogicalLockResult(self.unlock)
 
1813
            return self
1814
1814
        except:
1815
1815
            self.branch.unlock()
1816
1816
            raise
1818
1818
    def lock_tree_write(self):
1819
1819
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1820
1820
 
1821
 
        :return: A bzrlib.lock.LogicalLockResult.
 
1821
        :return: An object with an unlock method which will release the lock
 
1822
            obtained.
1822
1823
        """
1823
1824
        if not self.is_locked():
1824
1825
            self._reset_data()
1825
1826
        self.branch.lock_read()
1826
1827
        try:
1827
1828
            self._control_files.lock_write()
1828
 
            return LogicalLockResult(self.unlock)
 
1829
            return self
1829
1830
        except:
1830
1831
            self.branch.unlock()
1831
1832
            raise
1833
1834
    def lock_write(self):
1834
1835
        """See MutableTree.lock_write, and WorkingTree.unlock.
1835
1836
 
1836
 
        :return: A bzrlib.lock.LogicalLockResult.
 
1837
        :return: An object with an unlock method which will release the lock
 
1838
            obtained.
1837
1839
        """
1838
1840
        if not self.is_locked():
1839
1841
            self._reset_data()
1840
1842
        self.branch.lock_write()
1841
1843
        try:
1842
1844
            self._control_files.lock_write()
1843
 
            return LogicalLockResult(self.unlock)
 
1845
            return self
1844
1846
        except:
1845
1847
            self.branch.unlock()
1846
1848
            raise
1971
1973
        def recurse_directory_to_add_files(directory):
1972
1974
            # Recurse directory and add all files
1973
1975
            # so we can check if they have changed.
1974
 
            for parent_info, file_infos in self.walkdirs(directory):
 
1976
            for parent_info, file_infos in\
 
1977
                self.walkdirs(directory):
1975
1978
                for relpath, basename, kind, lstat, fileid, kind in file_infos:
1976
1979
                    # Is it versioned or ignored?
1977
1980
                    if self.path2id(relpath) or self.is_ignored(relpath):
2012
2015
                            # ... but not ignored
2013
2016
                            has_changed_files = True
2014
2017
                            break
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.
 
2018
                    elif content_change and (kind[1] is not None):
 
2019
                        # Versioned and changed, but not deleted
2019
2020
                        has_changed_files = True
2020
2021
                        break
2021
2022