readBundle method

  1. @override
Future<TomBundleMedium> readBundle(
  1. String locator
)
override

The directory-shaped bundle at locator, as a detached medium.

Implementation

@override
Future<TomBundleMedium> readBundle(String locator) async {
  final loc = TomGitLocator.parse(locator);
  final t = await _tip(locator, loc);
  final tip = t.tip;
  if (tip == null) throw TomContainerNotFoundException(locator);
  final repo = t.endpoint.repo;
  final entry = await repo.entryAt(
    (await repo.readCommit(tip)).tree,
    t.loc.path,
  );
  if (entry == null || !entry.isTree) {
    throw TomContainerNotFoundException(locator);
  }
  return TomReadOnlyBundleMedium(_TreeMedium(repo, entry.id, locator));
}