Rev 3966: Clean up some code paths a bit. in lp:///~jameinel/bzr/win32-shelve
John Arbash Meinel
john at arbash-meinel.com
Mon Feb 9 21:04:37 GMT 2009
At lp:///~jameinel/bzr/win32-shelve
------------------------------------------------------------
revno: 3966
revision-id: john at arbash-meinel.com-20090209210426-kg0z6kuiw6fei2av
parent: john at arbash-meinel.com-20090205213313-9m29w3tprf4u6bli
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32-shelve
timestamp: Mon 2009-02-09 15:04:26 -0600
message:
Clean up some code paths a bit.
Change how _get_trees_to_diff works. Properly lock the 'new_working_tree',
and if both old and new are available, make sure they are in the extra trees.
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2009-01-26 21:37:40 +0000
+++ b/bzrlib/diff.py 2009-02-09 21:04:26 +0000
@@ -327,6 +327,7 @@
old_url = default_location
working_tree, branch, relpath = \
bzrdir.BzrDir.open_containing_tree_or_branch(old_url)
+ old_working_tree = working_tree
if working_tree is not None:
working_tree.lock_read()
if consider_relpath and relpath != '':
@@ -341,8 +342,11 @@
if new_url != old_url:
working_tree, branch, relpath = \
bzrdir.BzrDir.open_containing_tree_or_branch(new_url)
+ if working_tree is not None:
+ working_tree.lock_read()
if consider_relpath and relpath != '':
specific_files.append(relpath)
+ new_working_tree = working_tree
new_tree = _get_tree_to_diff(new_revision_spec, working_tree, branch,
basis_is_default=working_tree is None)
if new_tree is not working_tree:
@@ -356,9 +360,15 @@
specific_files = None
# Get extra trees that ought to be searched for file-ids
- extra_trees = None
- if working_tree is not None and working_tree not in (old_tree, new_tree):
- extra_trees = (working_tree,)
+ extra_trees = []
+ if (old_working_tree is not None
+ and old_working_tree not in (old_tree, new_tree)):
+ extra_trees.append(old_working_tree)
+ if (new_working_tree is not None
+ and new_working_tree not in (old_working_tree, old_tree, new_tree)):
+ extra_trees.append(new_working_tree)
+ if not extra_trees:
+ extra_trees = None
return old_tree, new_tree, specific_files, extra_trees
More information about the bazaar-commits
mailing list