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

Unified Diff: sdk/lib/_internal/pub/lib/src/lock_file.dart

Issue 331593012: Add a "global activate" command to pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 6 months 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: sdk/lib/_internal/pub/lib/src/lock_file.dart
diff --git a/sdk/lib/_internal/pub/lib/src/lock_file.dart b/sdk/lib/_internal/pub/lib/src/lock_file.dart
index a4cba8f776f7e254a34741bb398ec02ad0219893..95421a604fc372af3f170a0fc6c2f9142b51db7f 100644
--- a/sdk/lib/_internal/pub/lib/src/lock_file.dart
+++ b/sdk/lib/_internal/pub/lib/src/lock_file.dart
@@ -17,6 +17,16 @@ class LockFile {
/// The packages this lockfile pins.
Map<String, PackageId> packages;
+ /// Creates a new lockfile containing [ids].
+ factory LockFile(List<PackageId> ids) {
+ var lockFile = new LockFile.empty();
+ for (var id in ids) {
+ if (!id.isRoot) lockFile.packages[id.name] = id;
+ }
+
+ return lockFile;
+ }
+
LockFile._(this.packages);
LockFile.empty()

Powered by Google App Engine
This is Rietveld 408576698