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

Side by Side Diff: test/version_solver_test.dart

Issue 1281043004: Make LockFile immutable. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « test/test_pub.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub_upgrade_test; 5 library pub_upgrade_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:pub/src/lock_file.dart'; 9 import 'package:pub/src/lock_file.dart';
10 import 'package:pub/src/log.dart' as log; 10 import 'package:pub/src/log.dart' as log;
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 if (result != null) { 1159 if (result != null) {
1160 var newResult = {}; 1160 var newResult = {};
1161 result.forEach((description, version) { 1161 result.forEach((description, version) {
1162 var id = parseSpec(description, version); 1162 var id = parseSpec(description, version);
1163 newResult[id.name] = id; 1163 newResult[id.name] = id;
1164 }); 1164 });
1165 result = newResult; 1165 result = newResult;
1166 } 1166 }
1167 1167
1168 // Parse the lockfile. 1168 // Parse the lockfile.
1169 var realLockFile = new LockFile.empty(); 1169 var realLockFile;
1170 if (lockfile != null) { 1170 if (lockfile == null) {
1171 lockfile.forEach((name, version) { 1171 realLockFile = new LockFile.empty(cache.sources);
1172 version = new Version.parse(version); 1172 } else {
1173 realLockFile.packages[name] = 1173 realLockFile = new LockFile(lockfile.keys.map((name) {
1174 new PackageId(name, source1.name, version, name); 1174 var version = new Version.parse(lockfile[name]);
1175 }); 1175 return new PackageId(name, source1.name, version, name);
1176 }), cache.sources);
1176 } 1177 }
1177 1178
1178 // Resolve the versions. 1179 // Resolve the versions.
1179 log.verbosity = log.Verbosity.NONE; 1180 log.verbosity = log.Verbosity.NONE;
1180 var future = resolveVersions( 1181 var future = resolveVersions(
1181 downgrade ? SolveType.DOWNGRADE : SolveType.GET, 1182 downgrade ? SolveType.DOWNGRADE : SolveType.GET,
1182 cache.sources, root, lockFile: realLockFile); 1183 cache.sources, root, lockFile: realLockFile);
1183 1184
1184 var matcher; 1185 var matcher;
1185 if (result != null) { 1186 if (result != null) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } 1531 }
1531 1532
1532 var source = "mock1"; 1533 var source = "mock1";
1533 if (match[7] != null) { 1534 if (match[7] != null) {
1534 source = match[7]; 1535 source = match[7];
1535 if (source == "root") source = null; 1536 if (source == "root") source = null;
1536 } 1537 }
1537 1538
1538 return new PackageId(name, source, parsedVersion, description); 1539 return new PackageId(name, source, parsedVersion, description);
1539 } 1540 }
OLDNEW
« no previous file with comments | « test/test_pub.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698