345
345
at least one tree.
346
346
:return: a set of file ids for the specified filenames
348
350
not_versioned = []
350
interesting_ids = None
352
interesting_ids = set()
353
for tree_path in filenames:
351
interesting_ids = set()
352
for tree_path in filenames:
355
file_id = tree.inventory.path2id(tree_path)
356
if file_id is not None:
357
interesting_ids.add(file_id)
360
not_versioned.append(tree_path)
362
pending = interesting_ids
363
# now handle children of interesting ids
364
# we loop so that we handle all children of each id in both trees
365
while len(pending) > 0:
367
for file_id in pending:
355
368
for tree in trees:
356
file_id = tree.inventory.path2id(tree_path)
357
if file_id is not None:
358
interesting_ids.add(file_id)
361
not_versioned.append(tree_path)
363
pending = interesting_ids
364
# now handle children of interesting ids
365
# we loop so that we handle all children of each id in both trees
366
while len(pending) > 0:
368
for file_id in pending:
370
if file_id not in tree:
372
entry = tree.inventory[file_id]
373
for child in getattr(entry, 'children', {}).itervalues():
374
if child.file_id not in interesting_ids:
375
new_pending.add(child.file_id)
376
interesting_ids.update(new_pending)
377
pending = new_pending
378
if len(not_versioned) > 0 and require_versioned:
379
raise errors.PathsNotVersionedError(not_versioned)
369
if file_id not in tree:
371
entry = tree.inventory[file_id]
372
for child in getattr(entry, 'children', {}).itervalues():
373
if child.file_id not in interesting_ids:
374
new_pending.add(child.file_id)
375
interesting_ids.update(new_pending)
376
pending = new_pending
377
if len(not_versioned) > 0 and require_versioned:
378
raise errors.PathsNotVersionedError(not_versioned)
380
379
return interesting_ids