336
336
yield (old_name, new_name)
339
def specified_file_ids(filenames, trees, require_versioned=True):
340
"""Find the ids corresponding to specified filenames.
339
def find_ids_across_trees(filenames, trees, require_versioned=True):
340
"""Find the ids corresponding to specified filenames.
342
All matches in all trees will be used, and all children of matched
343
directories will be used.
345
:param filenames: The filenames to find file_ids for
346
:param trees: The trees to find file_ids within
347
:param require_versioned: if true, all specified filenames must occur in
349
:return: a set of file ids for the specified filenames and their children.
353
specified_ids = _find_filename_ids_across_trees(filenames, trees,
355
return _find_children_across_trees(specified_ids, trees)
358
def _find_filename_ids_across_trees(filenames, trees, require_versioned):
359
"""Find the ids corresponding to specified filenames.
361
All matches in all trees will be used.
342
363
:param filenames: The filenames to find file_ids for
343
364
:param trees: The trees to find file_ids within
344
365
:param require_versioned: if true, all specified filenames must occur in
345
366
at least one tree.
346
367
:return: a set of file ids for the specified filenames
350
369
not_versioned = []
351
370
interesting_ids = set()
352
371
for tree_path in filenames:
358
377
not_found = False
360
379
not_versioned.append(tree_path)
380
if len(not_versioned) > 0 and require_versioned:
381
raise errors.PathsNotVersionedError(not_versioned)
382
return interesting_ids
385
def _find_children_across_trees(specified_ids, trees):
386
"""Return a set including specified ids and their children
388
All matches in all trees will be used.
390
:param trees: The trees to find file_ids within
391
:return: a set containing all specified ids and their children
393
interesting_ids = set(specified_ids)
362
394
pending = interesting_ids
363
395
# now handle children of interesting ids
364
396
# we loop so that we handle all children of each id in both trees