| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |