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

Side by Side Diff: lib/src/solver/solve_report.dart

Issue 2079303003: Track Source objects in PackageNames. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 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 | « lib/src/solver/backtracking_solver.dart ('k') | lib/src/solver/version_solver.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'package:pub_semver/pub_semver.dart'; 5 import 'package:pub_semver/pub_semver.dart';
6 6
7 import '../lock_file.dart'; 7 import '../lock_file.dart';
8 import '../log.dart' as log; 8 import '../log.dart' as log;
9 import '../package.dart'; 9 import '../package.dart';
10 import '../source_registry.dart'; 10 import '../source_registry.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 var numChanged = dependencies.where((name) { 56 var numChanged = dependencies.where((name) {
57 var oldId = _previousLockFile.packages[name]; 57 var oldId = _previousLockFile.packages[name];
58 var newId = _dependencies[name]; 58 var newId = _dependencies[name];
59 59
60 // Added or removed dependencies count. 60 // Added or removed dependencies count.
61 if (oldId == null) return true; 61 if (oldId == null) return true;
62 if (newId == null) return true; 62 if (newId == null) return true;
63 63
64 // The dependency existed before, so see if it was modified. 64 // The dependency existed before, so see if it was modified.
65 return !_sources.idsEqual(oldId, newId); 65 return oldId != newId;
66 }).length; 66 }).length;
67 67
68 if (dryRun) { 68 if (dryRun) {
69 if (numChanged == 0) { 69 if (numChanged == 0) {
70 log.message("No dependencies would change."); 70 log.message("No dependencies would change.");
71 } else if (numChanged == 1) { 71 } else if (numChanged == 1) {
72 log.message("Would change $numChanged dependency."); 72 log.message("Would change $numChanged dependency.");
73 } else { 73 } else {
74 log.message("Would change $numChanged dependencies."); 74 log.message("Would change $numChanged dependencies.");
75 } 75 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // * Any other change between the old and new package. 160 // * Any other change between the old and new package.
161 var icon; 161 var icon;
162 if (isOverridden) { 162 if (isOverridden) {
163 icon = log.magenta("! "); 163 icon = log.magenta("! ");
164 } else if (newId == null) { 164 } else if (newId == null) {
165 icon = log.red("- "); 165 icon = log.red("- ");
166 addedOrRemoved = true; 166 addedOrRemoved = true;
167 } else if (oldId == null) { 167 } else if (oldId == null) {
168 icon = log.green("+ "); 168 icon = log.green("+ ");
169 addedOrRemoved = true; 169 addedOrRemoved = true;
170 } else if (!_sources.idDescriptionsEqual(oldId, newId)) { 170 } else if (!oldId.samePackage(newId)) {
171 icon = log.cyan("* "); 171 icon = log.cyan("* ");
172 changed = true; 172 changed = true;
173 } else if (oldId.version < newId.version) { 173 } else if (oldId.version < newId.version) {
174 icon = log.green("> "); 174 icon = log.green("> ");
175 changed = true; 175 changed = true;
176 } else if (oldId.version > newId.version) { 176 } else if (oldId.version > newId.version) {
177 icon = log.cyan("< "); 177 icon = log.cyan("< ");
178 changed = true; 178 changed = true;
179 } else { 179 } else {
180 // Unchanged. 180 // Unchanged.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (message != null) _output.write(" ${log.cyan(message)}"); 231 if (message != null) _output.write(" ${log.cyan(message)}");
232 } 232 }
233 233
234 _output.writeln(); 234 _output.writeln();
235 } 235 }
236 236
237 /// Writes a terse description of [id] (not including its name) to the output. 237 /// Writes a terse description of [id] (not including its name) to the output.
238 void _writeId(PackageId id) { 238 void _writeId(PackageId id) {
239 _output.write(id.version); 239 _output.write(id.version);
240 240
241 var source = _sources[id.source]; 241 if (id.source != _sources.defaultSource) {
242 if (source != _sources.defaultSource) { 242 var description = id.source.formatDescription(_root.dir, id.description);
243 var description = source.formatDescription(_root.dir, id.description);
244 _output.write(" from ${id.source} $description"); 243 _output.write(" from ${id.source} $description");
245 } 244 }
246 } 245 }
247 } 246 }
OLDNEW
« no previous file with comments | « lib/src/solver/backtracking_solver.dart ('k') | lib/src/solver/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698