294
@deprecated_function(deprecated_in((2, 2, 0)))
292
295
def get_trees_and_branches_to_diff(path_list, revision_specs, old_url, new_url,
293
296
apply_view=True):
294
297
"""Get the trees and specific files to diff given a list of paths.
314
317
a tuple of (old_tree, new_tree, old_branch, new_branch,
315
318
specific_files, extra_trees) where extra_trees is a sequence of
316
additional trees to search in for file-ids.
319
additional trees to search in for file-ids. The trees and branches
322
op = cleanup.OperationWithCleanups(get_trees_and_branches_to_diff_locked)
323
return op.run_simple(path_list, revision_specs, old_url, new_url,
324
op.add_cleanup, apply_view=apply_view)
327
def get_trees_and_branches_to_diff_locked(
328
path_list, revision_specs, old_url, new_url, add_cleanup, apply_view=True):
329
"""Get the trees and specific files to diff given a list of paths.
331
This method works out the trees to be diff'ed and the files of
332
interest within those trees.
335
the list of arguments passed to the diff command
336
:param revision_specs:
337
Zero, one or two RevisionSpecs from the diff command line,
338
saying what revisions to compare.
340
The url of the old branch or tree. If None, the tree to use is
341
taken from the first path, if any, or the current working tree.
343
The url of the new branch or tree. If None, the tree to use is
344
taken from the first path, if any, or the current working tree.
346
a callable like Command.add_cleanup. get_trees_and_branches_to_diff
347
will register cleanups that must be run to unlock the trees, etc.
349
if True and a view is set, apply the view or check that the paths
352
a tuple of (old_tree, new_tree, old_branch, new_branch,
353
specific_files, extra_trees) where extra_trees is a sequence of
354
additional trees to search in for file-ids. The trees and branches
355
will be read-locked until the cleanups registered via the add_cleanup
318
358
# Get the old and new revision specs
319
359
old_revision_spec = None
342
382
default_location = path_list[0]
343
383
other_paths = path_list[1:]
385
def lock_tree_or_branch(wt, br):
388
add_cleanup(wt.unlock)
391
add_cleanup(br.unlock)
345
393
# Get the old location
346
394
specific_files = []
347
395
if old_url is None:
348
396
old_url = default_location
349
397
working_tree, branch, relpath = \
350
398
bzrdir.BzrDir.open_containing_tree_or_branch(old_url)
399
lock_tree_or_branch(working_tree, branch)
351
400
if consider_relpath and relpath != '':
352
401
if working_tree is not None and apply_view:
353
402
views.check_path_in_view(working_tree, relpath)
361
410
if new_url != old_url:
362
411
working_tree, branch, relpath = \
363
412
bzrdir.BzrDir.open_containing_tree_or_branch(new_url)
413
lock_tree_or_branch(working_tree, branch)
364
414
if consider_relpath and relpath != '':
365
415
if working_tree is not None and apply_view:
366
416
views.check_path_in_view(working_tree, relpath)