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

Unified Diff: sdk/lib/_internal/pub/lib/src/system_cache.dart

Issue 228703006: Add “pub cache repair” to forcibly re-install previously cached packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 8 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
Index: sdk/lib/_internal/pub/lib/src/system_cache.dart
diff --git a/sdk/lib/_internal/pub/lib/src/system_cache.dart b/sdk/lib/_internal/pub/lib/src/system_cache.dart
index 4e011dd8f2047c8a9cc86733aee02724125f7230..9cfca43046c3c820b8b6f75b105a8f162e1e4711 100644
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart
@@ -82,7 +82,10 @@ class SystemCache {
///
/// It is an error to try downloading a package from a source with
/// `shouldCache == false`.
- Future<Package> download(PackageId id) {
+ ///
+ /// If [force] is `true`, then the package is downloaded even if it already
+ /// exists in the cache. The previous one will be deleted.
+ Future<Package> download(PackageId id, {bool force}) {
var source = sources[id.source];
if (!source.shouldCache) {
@@ -92,7 +95,8 @@ class SystemCache {
var pending = _pendingDownloads[id];
if (pending != null) return pending;
- var future = source.downloadToSystemCache(id).whenComplete(() {
+ var future = source.downloadToSystemCache(id, force: force)
+ .whenComplete(() {
_pendingDownloads.remove(id);
});

Powered by Google App Engine
This is Rietveld 408576698