/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-21 11:27:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421112704-zijso22b6pdevrxy
Simplify various code to use user_url

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
WorkingTree.open(dir).
30
30
"""
31
31
 
 
32
# TODO: Give the workingtree sole responsibility for the working inventory;
 
33
# remove the variable and references to it from the branch.  This may require
 
34
# updating the commit code so as to update the inventory within the working
 
35
# copy, and making sure there's only one WorkingTree for any directory on disk.
 
36
# At the moment they may alias the inventory and have old copies of it in
 
37
# memory.  (Now done? -- mbp 20060309)
32
38
 
33
39
from cStringIO import StringIO
34
40
import os
77
83
 
78
84
from bzrlib import symbol_versioning
79
85
from bzrlib.decorators import needs_read_lock, needs_write_lock
80
 
from bzrlib.lock import LogicalLockResult
81
86
from bzrlib.lockable_files import LockableFiles
82
87
from bzrlib.lockdir import LockDir
83
88
import bzrlib.mutabletree
96
101
from bzrlib.filters import filtered_input_file
97
102
from bzrlib.trace import mutter, note
98
103
from bzrlib.transport.local import LocalTransport
 
104
from bzrlib.progress import ProgressPhase
99
105
from bzrlib.revision import CURRENT_REVISION
100
106
from bzrlib.rio import RioReader, rio_file, Stanza
101
107
from bzrlib.symbol_versioning import (
1799
1805
            raise errors.ObjectNotLocked(self)
1800
1806
 
1801
1807
    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
 
        """
 
1808
        """See Branch.lock_read, and WorkingTree.unlock."""
1808
1809
        if not self.is_locked():
1809
1810
            self._reset_data()
1810
1811
        self.branch.lock_read()
1811
1812
        try:
1812
 
            self._control_files.lock_read()
1813
 
            return LogicalLockResult(self.unlock)
 
1813
            return self._control_files.lock_read()
1814
1814
        except:
1815
1815
            self.branch.unlock()
1816
1816
            raise
1817
1817
 
1818
1818
    def lock_tree_write(self):
1819
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1820
 
 
1821
 
        :return: A bzrlib.lock.LogicalLockResult.
1822
 
        """
 
1819
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
1823
1820
        if not self.is_locked():
1824
1821
            self._reset_data()
1825
1822
        self.branch.lock_read()
1826
1823
        try:
1827
 
            self._control_files.lock_write()
1828
 
            return LogicalLockResult(self.unlock)
 
1824
            return self._control_files.lock_write()
1829
1825
        except:
1830
1826
            self.branch.unlock()
1831
1827
            raise
1832
1828
 
1833
1829
    def lock_write(self):
1834
 
        """See MutableTree.lock_write, and WorkingTree.unlock.
1835
 
 
1836
 
        :return: A bzrlib.lock.LogicalLockResult.
1837
 
        """
 
1830
        """See MutableTree.lock_write, and WorkingTree.unlock."""
1838
1831
        if not self.is_locked():
1839
1832
            self._reset_data()
1840
1833
        self.branch.lock_write()
1841
1834
        try:
1842
 
            self._control_files.lock_write()
1843
 
            return LogicalLockResult(self.unlock)
 
1835
            return self._control_files.lock_write()
1844
1836
        except:
1845
1837
            self.branch.unlock()
1846
1838
            raise
2651
2643
 
2652
2644
        In Format2 WorkingTrees we have a single lock for the branch and tree
2653
2645
        so lock_tree_write() degrades to lock_write().
2654
 
 
2655
 
        :return: An object with an unlock method which will release the lock
2656
 
            obtained.
2657
2646
        """
2658
2647
        self.branch.lock_write()
2659
2648
        try:
2660
 
            self._control_files.lock_write()
2661
 
            return self
 
2649
            return self._control_files.lock_write()
2662
2650
        except:
2663
2651
            self.branch.unlock()
2664
2652
            raise