/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-12 01:35:48 UTC
  • mto: (6885.7.1 fix-commit-builder)
  • mto: This revision was merged to the branch mainline in revision 6891.
  • Revision ID: jelmer@jelmer.uk-20180312013548-icadkv5qqncni8ph
Add find_previous_paths call.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1428
1428
                    other_values.append(self._lookup_by_file_id(
1429
1429
                                            alt_extra, alt_tree, file_id))
1430
1430
                yield other_path, file_id, None, other_values
 
1431
 
 
1432
 
 
1433
def find_previous_paths(from_tree, to_tree, paths):
 
1434
    """Find previous tree paths.
 
1435
 
 
1436
    :param from_tree: From tree
 
1437
    :param to_tree: To tree
 
1438
    :param paths: Iterable over paths to search for
 
1439
    :return: Dictionary mapping from from_tree paths to paths in to_tree, or
 
1440
        None if there is no equivalent path.
 
1441
    """
 
1442
    ret = {}
 
1443
    for path in paths:
 
1444
        file_id = from_tree.path2id(path)
 
1445
        if file_id is None:
 
1446
            raise errors.NoSuchFile(path)
 
1447
        try:
 
1448
            ret[path] = to_tree.id2path(file_id)
 
1449
        except errors.NoSuchId:
 
1450
            ret[path] = None
 
1451
    return ret