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

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

Issue 221383002: Don't fetch git repository unnecessarily when running "pub get". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: missing docs Created 6 years, 9 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/source/git.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/git.dart
diff --git a/sdk/lib/_internal/pub/lib/src/git.dart b/sdk/lib/_internal/pub/lib/src/git.dart
index 3f61dc19823823b0faf418f1797ff93c938fc942..510ca7eecd3819dea05246c6beea8e2e6edebfab 100644
--- a/sdk/lib/_internal/pub/lib/src/git.dart
+++ b/sdk/lib/_internal/pub/lib/src/git.dart
@@ -11,6 +11,22 @@ import 'dart:io';
import 'io.dart';
import 'log.dart' as log;
+/// An exception thrown because a git command failed.
+class GitException implements Exception {
Bob Nystrom 2014/04/01 23:43:34 I think we tend to import this library with a pref
nweiz 2014/04/02 00:41:19 I think shadowing core types is worse than having
+ /// The arguments to the git command.
+ final List<String> args;
+
+ /// The standard error emitted by git.
+ final String stderr;
+
+ String get message => 'Git error. Command: git ${args.join(" ")}\n$stderr';
+
+ GitException(Iterable<String> args, this.stderr)
+ : args = args.toList();
+
+ String toString() => message;
+}
+
/// Tests whether or not the git command-line app is available for use.
Future<bool> get isInstalled {
if (_isGitInstalledCache != null) {
@@ -28,10 +44,7 @@ Future<List<String>> run(List<String> args,
return runProcess(git, args, workingDir: workingDir,
environment: environment);
}).then((result) {
- if (!result.success) throw new Exception(
- 'Git error. Command: git ${args.join(" ")}\n'
- '${result.stderr.join("\n")}');
-
+ if (!result.success) throw new GitException(args, result.stderr.join("\n"));
return result.stdout;
});
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/source/git.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698