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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/upgrade.dart

Issue 329303006: Add "--dry-run" to pub upgrade. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/entrypoint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/command/upgrade.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/upgrade.dart b/sdk/lib/_internal/pub/lib/src/command/upgrade.dart
index 64a5b15496d12efda61fef41b40b31dd2dd7cfa8..1f4a191fab0963d606d99e4cc10d7434bd41be58 100644
--- a/sdk/lib/_internal/pub/lib/src/command/upgrade.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/upgrade.dart
@@ -22,20 +22,32 @@ class UpgradeCommand extends PubCommand {
UpgradeCommand() {
commandParser.addFlag('offline',
help: 'Use cached packages instead of accessing the network.');
+
+ commandParser.addFlag('dry-run', abbr: 'n', negatable: false,
+ help: 'Report what dependencies would change but do not change any.');
}
Future onRun() {
var upgradeAll = commandOptions.rest.isEmpty;
+ var dryRun = commandOptions['dry-run'];
return entrypoint.acquireDependencies(useLatest: commandOptions.rest,
- upgradeAll: upgradeAll).then((numChanged) {
- // TODO(rnystrom): Show a more detailed message about what was added,
- // removed, modified, and/or upgraded?
- if (numChanged == 0) {
- log.message("No dependencies changed.");
- } else if (numChanged == 1) {
- log.message("Changed $numChanged dependency!");
+ upgradeAll: upgradeAll, dryRun: dryRun).then((numChanged) {
+ if (dryRun) {
+ if (numChanged == 0) {
+ log.message("No dependencies would change.");
+ } else if (numChanged == 1) {
+ log.message("Would change $numChanged dependency.");
+ } else {
+ log.message("Would change $numChanged dependencies.");
+ }
} else {
- log.message("Changed $numChanged dependencies!");
+ if (numChanged == 0) {
+ log.message("No dependencies changed.");
+ } else if (numChanged == 1) {
+ log.message("Changed $numChanged dependency!");
+ } else {
+ log.message("Changed $numChanged dependencies!");
+ }
}
if (isOffline) {
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698