Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: lib/src/source_registry.dart

Issue 1534093002: Improve the detection lockfile freshness. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/source_registry.dart
diff --git a/lib/src/source_registry.dart b/lib/src/source_registry.dart
index d46ae93ae77299674c4b8004105cf8bf41bb7bf5..9df3e1a9135215347e9180182230c32c57ec5db0 100644
--- a/lib/src/source_registry.dart
+++ b/lib/src/source_registry.dart
@@ -65,6 +65,17 @@ class SourceRegistry extends IterableBase<Source> {
_sources[source.name] = source;
}
+ /// Loads the package identified by [id].
+ ///
+ /// Throws an [ArgumentError] if [id] has an invalid source.
+ Package load(PackageId id) {
+ var source = this[id.source];
+ if (source == null) throw new ArgumentError("Unknown source ${id.source}.");
+
+ var dir = source.getDirectory(id);
+ return new Package.load(id.name, dir, this);
+ }
+
/// Returns the source named [name].
///
/// Returns an [UnknownSource] if no source with that name has been

Powered by Google App Engine
This is Rietveld 408576698