~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: John Arbash Meinel
  • Date: 2010-05-11 10:45:26 UTC
  • mto: This revision was merged to the branch mainline in revision 5225.
  • Revision ID: john@arbash-meinel.com-20100511104526-zxnstcxta22hzw2n
Implement a compiled extension for parsing the text key out of a CHKInventory value.

Related to bug #562666. This seems to shave 5-10% out of the time spent doing a complete
branch of bzr.dev/launchpad/etc.

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
1973
1956
        def recurse_directory_to_add_files(directory):
1974
1957
            # Recurse directory and add all files
1975
1958
            # so we can check if they have changed.
1976
 
            for parent_info, file_infos in\
1977
 
                self.walkdirs(directory):
 
1959
            for parent_info, file_infos in self.walkdirs(directory):
1978
1960
                for relpath, basename, kind, lstat, fileid, kind in file_infos:
1979
1961
                    # Is it versioned or ignored?
1980
1962
                    if self.path2id(relpath) or self.is_ignored(relpath):
2015
1997
                            # ... but not ignored
2016
1998
                            has_changed_files = True
2017
1999
                            break
2018
 
                    elif content_change and (kind[1] is not None):
2019
 
                        # Versioned and changed, but not deleted
 
2000
                    elif (content_change and (kind[1] is not None) and
 
2001
                            osutils.is_inside_any(files, path[1])):
 
2002
                        # Versioned and changed, but not deleted, and still
 
2003
                        # in one of the dirs to be deleted.
2020
2004
                        has_changed_files = True
2021
2005
                        break
2022
2006
 
2653
2637
 
2654
2638
        In Format2 WorkingTrees we have a single lock for the branch and tree
2655
2639
        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
2640
        """
2660
2641
        self.branch.lock_write()
2661
2642
        try:
2662
 
            self._control_files.lock_write()
2663
 
            return self
 
2643
            return self._control_files.lock_write()
2664
2644
        except:
2665
2645
            self.branch.unlock()
2666
2646
            raise