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

Unified Diff: lib/src/source/git.dart

Issue 1239623005: "pub cache repair" prints a more detailed summary. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/source/cached.dart ('k') | lib/src/source/hosted.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/git.dart
diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart
index dc4c8b3e8a413a209474dc8b1b1431f851735885..8bd75c3d517ed8012970b64fad7b30b94c5c03c2 100644
--- a/lib/src/source/git.dart
+++ b/lib/src/source/git.dart
@@ -163,11 +163,11 @@ class GitSource extends CachedSource {
/// Resets all cached packages back to the pristine state of the Git
/// repository at the revision they are pinned to.
- Future<Pair<int, int>> repairCachedPackages() async {
- if (!dirExists(systemCacheRoot)) return new Pair(0, 0);
+ Future<Pair<List<PackageId>, List<PackageId>>> repairCachedPackages() async {
+ if (!dirExists(systemCacheRoot)) return new Pair([], []);
- var successes = 0;
- var failures = 0;
+ var successes = [];
+ var failures = [];
var packages = listDir(systemCacheRoot)
.where((entry) => dirExists(path.join(entry, ".git")))
@@ -180,6 +180,8 @@ class GitSource extends CachedSource {
packages.sort(Package.orderByNameAndVersion);
for (var package in packages) {
+ var id = new PackageId(package.name, this.name, package.version, null);
+
log.message("Resetting Git repository for "
"${log.bold(package.name)} ${package.version}...");
@@ -191,12 +193,12 @@ class GitSource extends CachedSource {
// Discard all changes to tracked files.
await git.run(["reset", "--hard", "HEAD"], workingDir: package.dir);
- successes++;
+ successes.add(id);
} on git.GitException catch (error, stackTrace) {
log.error("Failed to reset ${log.bold(package.name)} "
"${package.version}. Error:\n$error");
log.fine(stackTrace);
- failures++;
+ failures.add(id);
tryDeleteEntry(package.dir);
}
« no previous file with comments | « lib/src/source/cached.dart ('k') | lib/src/source/hosted.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698