~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-14 11:05:32 UTC
  • mfrom: (5227.1.4 hpss-set-option-430382)
  • Revision ID: pqm@pqm.ubuntu.com-20100514110532-qngntbe48hh01wkj
(andrew) Fix RemoteBranchConfig.set_user_option when passed a dict
        value. (#430382)

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