430
430
raise errors.BzrCommandError('invalid kind specified')
432
432
work_tree, file_list = tree_files(file_list)
434
if revision is not None:
435
if len(revision) > 1:
436
raise errors.BzrCommandError('bzr inventory --revision takes'
437
' exactly one revision identifier')
438
revision_id = revision[0].in_history(work_tree.branch).rev_id
439
tree = work_tree.branch.repository.revision_tree(revision_id)
441
# We include work_tree as well as 'tree' here
442
# So that doing '-r 10 path/foo' will lookup whatever file
443
# exists now at 'path/foo' even if it has been renamed, as
444
# well as whatever files existed in revision 10 at path/foo
445
trees = [tree, work_tree]
450
if file_list is not None:
451
file_ids = _mod_tree.find_ids_across_trees(file_list, trees,
452
require_versioned=True)
453
# find_ids_across_trees may include some paths that don't
455
entries = sorted((tree.id2path(file_id), tree.inventory[file_id])
456
for file_id in file_ids if file_id in tree)
458
entries = tree.inventory.entries()
433
work_tree.lock_read()
435
if revision is not None:
436
if len(revision) > 1:
437
raise errors.BzrCommandError(
438
'bzr inventory --revision takes exactly one revision'
440
revision_id = revision[0].in_history(work_tree.branch).rev_id
441
tree = work_tree.branch.repository.revision_tree(revision_id)
443
extra_trees = [work_tree]
449
if file_list is not None:
450
file_ids = tree.paths2ids(file_list, trees=extra_trees,
451
require_versioned=True)
452
# find_ids_across_trees may include some paths that don't
454
entries = sorted((tree.id2path(file_id), tree.inventory[file_id])
455
for file_id in file_ids if file_id in tree)
457
entries = tree.inventory.entries()
460
if tree is not work_tree:
460
463
for path, entry in entries:
461
464
if kind and kind != entry.kind: