/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_4.py

  • Committer: Parth Malwankar
  • Date: 2010-03-11 06:24:00 UTC
  • mto: (5094.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5107.
  • Revision ID: parth.malwankar@gmail.com-20100311062400-17bx45mt09fuhkri
closed Martins review comments.
from https://code.edge.launchpad.net/~parthm/bzr/376388-dot-bazaar-ownership/+merge/19691

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
from bzrlib.decorators import needs_read_lock, needs_write_lock
54
54
from bzrlib.filters import filtered_input_file, internal_size_sha_file_byname
55
55
from bzrlib.inventory import Inventory, ROOT_ID, entry_factory
56
 
from bzrlib.lock import LogicalLockResult
 
56
import bzrlib.mutabletree
57
57
from bzrlib.mutabletree import needs_tree_write_lock
58
58
from bzrlib.osutils import (
59
59
    file_kind,
568
568
            return _mod_revision.NULL_REVISION
569
569
 
570
570
    def lock_read(self):
571
 
        """See Branch.lock_read, and WorkingTree.unlock.
572
 
 
573
 
        :return: A bzrlib.lock.LogicalLockResult.
574
 
        """
 
571
        """See Branch.lock_read, and WorkingTree.unlock."""
575
572
        self.branch.lock_read()
576
573
        try:
577
574
            self._control_files.lock_read()
590
587
        except:
591
588
            self.branch.unlock()
592
589
            raise
593
 
        return LogicalLockResult(self.unlock)
594
590
 
595
591
    def _lock_self_write(self):
596
592
        """This should be called after the branch is locked."""
611
607
        except:
612
608
            self.branch.unlock()
613
609
            raise
614
 
        return LogicalLockResult(self.unlock)
615
610
 
616
611
    def lock_tree_write(self):
617
 
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
618
 
 
619
 
        :return: A bzrlib.lock.LogicalLockResult.
620
 
        """
 
612
        """See MutableTree.lock_tree_write, and WorkingTree.unlock."""
621
613
        self.branch.lock_read()
622
 
        return self._lock_self_write()
 
614
        self._lock_self_write()
623
615
 
624
616
    def lock_write(self):
625
 
        """See MutableTree.lock_write, and WorkingTree.unlock.
626
 
 
627
 
        :return: A bzrlib.lock.LogicalLockResult.
628
 
        """
 
617
        """See MutableTree.lock_write, and WorkingTree.unlock."""
629
618
        self.branch.lock_write()
630
 
        return self._lock_self_write()
 
619
        self._lock_self_write()
631
620
 
632
621
    @needs_tree_write_lock
633
622
    def move(self, from_paths, to_dir, after=False):
1383
1372
 
1384
1373
 
1385
1374
class DirStateWorkingTreeFormat(WorkingTreeFormat3):
1386
 
 
1387
1375
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1388
1376
                   accelerator_tree=None, hardlink=False):
1389
1377
        """See WorkingTreeFormat.initialize().
1844
1832
        entry = self._get_entry(file_id=file_id)[1]
1845
1833
        if entry is None:
1846
1834
            raise errors.NoSuchId(tree=self, file_id=file_id)
1847
 
        parent_index = self._get_parent_index()
1848
 
        return dirstate.DirState._minikind_to_kind[entry[parent_index][0]]
 
1835
        return dirstate.DirState._minikind_to_kind[entry[1][0]]
1849
1836
 
1850
1837
    def stored_kind(self, file_id):
1851
1838
        """See Tree.stored_kind"""
1871
1858
            return None
1872
1859
        return ie.executable
1873
1860
 
1874
 
    def is_locked(self):
1875
 
        return self._locked
1876
 
 
1877
1861
    def list_files(self, include_root=False, from_dir=None, recursive=True):
1878
1862
        # We use a standard implementation, because DirStateRevisionTree is
1879
1863
        # dealing with one of the parents of the current state
1892
1876
            yield path, 'V', entry.kind, entry.file_id, entry
1893
1877
 
1894
1878
    def lock_read(self):
1895
 
        """Lock the tree for a set of operations.
1896
 
 
1897
 
        :return: A bzrlib.lock.LogicalLockResult.
1898
 
        """
 
1879
        """Lock the tree for a set of operations."""
1899
1880
        if not self._locked:
1900
1881
            self._repository.lock_read()
1901
1882
            if self._dirstate._lock_token is None:
1902
1883
                self._dirstate.lock_read()
1903
1884
                self._dirstate_locked = True
1904
1885
        self._locked += 1
1905
 
        return LogicalLockResult(self.unlock)
1906
1886
 
1907
1887
    def _must_be_locked(self):
1908
1888
        if not self._locked: