/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 Pool
  • Date: 2010-04-28 07:03:38 UTC
  • mfrom: (5188 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@sourcefrog.net-20100428070338-2af8y3takgfkrkyp
merge news

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
96
95
from bzrlib.filters import filtered_input_file
97
96
from bzrlib.trace import mutter, note
98
97
from bzrlib.transport.local import LocalTransport
 
98
from bzrlib.progress import ProgressPhase
99
99
from bzrlib.revision import CURRENT_REVISION
100
100
from bzrlib.rio import RioReader, rio_file, Stanza
101
101
from bzrlib.symbol_versioning import (
1799
1799
            raise errors.ObjectNotLocked(self)
1800
1800
 
1801
1801
    def lock_read(self):
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
        """See Branch.lock_read, and WorkingTree.unlock."""
1808
1803
        if not self.is_locked():
1809
1804
            self._reset_data()
1810
1805
        self.branch.lock_read()
1811
1806
        try:
1812
 
            self._control_files.lock_read()
1813
 
            return LogicalLockResult(self.unlock)
 
1807
            return self._control_files.lock_read()
1814
1808
        except:
1815
1809
            self.branch.unlock()
1816
1810
            raise
1817
1811
 
1818
1812
    def lock_tree_write(self):
1819
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1820
 
 
1821
 
        :return: A bzrlib.lock.LogicalLockResult.
1822
 
        """
 
1813
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
1823
1814
        if not self.is_locked():
1824
1815
            self._reset_data()
1825
1816
        self.branch.lock_read()
1826
1817
        try:
1827
 
            self._control_files.lock_write()
1828
 
            return LogicalLockResult(self.unlock)
 
1818
            return self._control_files.lock_write()
1829
1819
        except:
1830
1820
            self.branch.unlock()
1831
1821
            raise
1832
1822
 
1833
1823
    def lock_write(self):
1834
 
        """See MutableTree.lock_write, and WorkingTree.unlock.
1835
 
 
1836
 
        :return: A bzrlib.lock.LogicalLockResult.
1837
 
        """
 
1824
        """See MutableTree.lock_write, and WorkingTree.unlock."""
1838
1825
        if not self.is_locked():
1839
1826
            self._reset_data()
1840
1827
        self.branch.lock_write()
1841
1828
        try:
1842
 
            self._control_files.lock_write()
1843
 
            return LogicalLockResult(self.unlock)
 
1829
            return self._control_files.lock_write()
1844
1830
        except:
1845
1831
            self.branch.unlock()
1846
1832
            raise
1971
1957
        def recurse_directory_to_add_files(directory):
1972
1958
            # Recurse directory and add all files
1973
1959
            # so we can check if they have changed.
1974
 
            for parent_info, file_infos in self.walkdirs(directory):
 
1960
            for parent_info, file_infos in\
 
1961
                self.walkdirs(directory):
1975
1962
                for relpath, basename, kind, lstat, fileid, kind in file_infos:
1976
1963
                    # Is it versioned or ignored?
1977
1964
                    if self.path2id(relpath) or self.is_ignored(relpath):
2012
1999
                            # ... but not ignored
2013
2000
                            has_changed_files = True
2014
2001
                            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.
 
2002
                    elif content_change and (kind[1] is not None):
 
2003
                        # Versioned and changed, but not deleted
2019
2004
                        has_changed_files = True
2020
2005
                        break
2021
2006
 
2652
2637
 
2653
2638
        In Format2 WorkingTrees we have a single lock for the branch and tree
2654
2639
        so lock_tree_write() degrades to lock_write().
2655
 
 
2656
 
        :return: An object with an unlock method which will release the lock
2657
 
            obtained.
2658
2640
        """
2659
2641
        self.branch.lock_write()
2660
2642
        try:
2661
 
            self._control_files.lock_write()
2662
 
            return self
 
2643
            return self._control_files.lock_write()
2663
2644
        except:
2664
2645
            self.branch.unlock()
2665
2646
            raise