Rev 3965: Change the code so that DirStateRevisionTree is always a no-op. in lp:///~jameinel/bzr/win32-shelve
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 5 21:33:20 GMT 2009
At lp:///~jameinel/bzr/win32-shelve
------------------------------------------------------------
revno: 3965
revision-id: john at arbash-meinel.com-20090205213313-9m29w3tprf4u6bli
parent: john at arbash-meinel.com-20090205210649-krqkwm2un4ey5upc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32-shelve
timestamp: Thu 2009-02-05 15:33:13 -0600
message:
Change the code so that DirStateRevisionTree is always a no-op.
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2009-01-26 20:46:20 +0000
+++ b/bzrlib/workingtree_4.py 2009-02-05 21:33:13 +0000
@@ -1502,12 +1502,10 @@
def __init__(self, wt, revision_id, repository):
self._wt = wt
- self._dirstate_at_creation = weakref.ref(wt._current_dirstate())
self._revision_id = revision_id
self._repository = repository
self._inventory = None
self._locked = 0
- self._dirstate_locked = False
self._repo_supports_tree_reference = getattr(
repository._format, "supports_tree_reference",
False)
@@ -1567,7 +1565,8 @@
def _get_parent_index(self):
"""Return the index in the dirstate referenced by this tree."""
- return self._wt._current_dirstate().get_parent_ids().index(self._revision_id) + 1
+ state = self._wt._current_dirstate()
+ return state.get_parent_ids().index(self._revision_id) + 1
def _get_entry(self, file_id=None, path=None):
"""Get the dirstate row for file_id or path.
@@ -1585,7 +1584,8 @@
if path is not None:
path = path.encode('utf8')
parent_index = self._get_parent_index()
- return self._wt._current_dirstate()._get_entry(parent_index, fileid_utf8=file_id, path_utf8=path)
+ state = self._wt._current_dirstate()
+ return state._get_entry(parent_index, fileid_utf8=file_id, path_utf8=path)
def _generate_inventory(self):
"""Create and set self.inventory from the dirstate object.
@@ -1792,28 +1792,6 @@
"""Lock the tree for a set of operations."""
if not self._locked:
self._repository.lock_read()
- # Shouldn't this lock self._wt as well?
- state = self._wt._current_dirstate()
- if state._lock_token is None:
- # XXX: This also catches bugs in design, places where we create
- # a basis_tree and then lock it, without having the containing
- # WT locked
- # self._wt._must_be_locked()
- state.lock_read()
- # TODO: this code path should probably be deprecated, but most
- # likely it is caught by the next path
- self._dirstate_locked = True
- state_at_creation = self._dirstate_at_creation()
- if state_at_creation is None or state is not state_at_creation:
- # Skip the DeprecationWarning because too many places need
- # fixing
- pass
- # symbol_versioning.warn('Caller failed to maintain lock'
- # ' on working tree for the lifetime of the'
- # ' DirStateRevisionTree returned by'
- # ' wt.basis_tree() or wt.revision_tree()'
- # ' This should always be done since bzr 1.12',
- # DeprecationWarning, stacklevel=2)
self._locked += 1
def _must_be_locked(self):
@@ -1836,10 +1814,6 @@
if not self._locked:
self._inventory = None
self._locked = 0
- if self._dirstate_locked:
- state = self._wt._current_dirstate()
- state.unlock()
- self._dirstate_locked = False
self._repository.unlock()
@needs_read_lock
More information about the bazaar-commits
mailing list