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

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.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 | « sdk/lib/_internal/pub/lib/src/command/upgrade.dart ('k') | sdk/lib/_internal/pub/test/test_pub.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/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index d5f328711bcdd4ce06a1a529d142eb6a2b102f55..1ec25d536df3dac552cb293bc98aafa5a32fe14b 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -108,13 +108,14 @@ class Entrypoint {
/// previously locked packages.
///
/// If [useLatest] is non-empty or [upgradeAll] is true, displays a detailed
- /// report of the changes made relative to the previous lockfile.
+ /// report of the changes made relative to the previous lockfile. If [dryRun]
+ /// is `true`, no physical changes are made.
///
/// Returns a [Future] that completes to the number of changed dependencies.
/// It completes when an up-to-date lockfile has been generated and all
/// dependencies are available.
Future<int> acquireDependencies({List<String> useLatest,
- bool upgradeAll: false}) {
+ bool upgradeAll: false, bool dryRun: false}) {
var numChanged = 0;
return syncFuture(() {
@@ -128,18 +129,20 @@ class Entrypoint {
// https://code.google.com/p/dart/issues/detail?id=15587
numChanged = result.showReport(showAll: useLatest != null || upgradeAll);
+ if (dryRun) return numChanged;
+
// Install the packages.
cleanDir(packagesDir);
return Future.wait(result.packages.map((id) {
if (id.isRoot) return new Future.value(id);
return get(id);
- }).toList());
- }).then((ids) {
- _saveLockFile(ids);
- _linkSelf();
- _linkSecondaryPackageDirs();
+ }).toList()).then((ids) {
+ _saveLockFile(ids);
+ _linkSelf();
+ _linkSecondaryPackageDirs();
- return numChanged;
+ return numChanged;
+ });
});
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/upgrade.dart ('k') | sdk/lib/_internal/pub/test/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698