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

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

Issue 937243002: Revert "Revert "Use native async/await support in pub."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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_generated/lib/src/git.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/git.dart b/sdk/lib/_internal/pub_generated/lib/src/git.dart
deleted file mode 100644
index a574e8a6865e7814c2ef024dc1b502106a2b0dfa..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/pub_generated/lib/src/git.dart
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Helper functionality for invoking Git.
-library pub.git;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:stack_trace/stack_trace.dart';
-
-import 'exceptions.dart';
-import 'io.dart';
-import 'log.dart' as log;
-import 'utils.dart';
-
-/// An exception thrown because a git command failed.
-class GitException implements ApplicationException {
- /// 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.
-bool get isInstalled {
- if (_isInstalledCache != null) return _isInstalledCache;
- _isInstalledCache = _gitCommand != null;
- return _isInstalledCache;
-}
-bool _isInstalledCache;
-
-/// Run a git process with [args] from [workingDir].
-///
-/// Returns the stdout as a list of strings if it succeeded. Completes to an
-/// exception if it failed.
-Future<List<String>> run(List<String> args, {String workingDir, Map<String,
- String> environment}) {
- if (!isInstalled) {
- fail(
- "Cannot find a Git executable.\n" "Please ensure Git is correctly installed.");
- }
-
- log.muteProgress();
- return runProcess(
- _gitCommand,
- args,
- workingDir: workingDir,
- environment: environment).then((result) {
- if (!result.success) throw new GitException(args, result.stderr.join("\n"));
-
- return result.stdout;
- }).whenComplete(() {
- log.unmuteProgress();
- });
-}
-
-/// Like [run], but synchronous.
-List<String> runSync(List<String> args, {String workingDir, Map<String,
- String> environment}) {
- if (!isInstalled) {
- fail(
- "Cannot find a Git executable.\n" "Please ensure Git is correctly installed.");
- }
-
- var result = runProcessSync(
- _gitCommand,
- args,
- workingDir: workingDir,
- environment: environment);
- if (!result.success) throw new GitException(args, result.stderr.join("\n"));
- return result.stdout;
-}
-
-/// Returns the name of the git command-line app, or null if Git could not be
-/// found on the user's PATH.
-String get _gitCommand {
- if (_commandCache != null) return _commandCache;
-
- var command;
- if (_tryGitCommand("git")) {
- _commandCache = "git";
- } else if (_tryGitCommand("git.cmd")) {
- _commandCache = "git.cmd";
- } else {
- return null;
- }
-
- log.fine('Determined git command $command.');
- return _commandCache;
-}
-String _commandCache;
-
-/// Checks whether [command] is the Git command for this computer.
-bool _tryGitCommand(String command) {
- // If "git --version" prints something familiar, git is working.
- try {
- var result = runProcessSync(command, ["--version"]);
- var regexp = new RegExp("^git version");
- return result.stdout.length == 1 && regexp.hasMatch(result.stdout.single);
- } on ProcessException catch (error, stackTrace) {
- var chain = new Chain.forTrace(stackTrace);
- // If the process failed, they probably don't have it.
- log.message('Git command is not "$command": $error\n$chain');
- return false;
- }
-}
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/exit_codes.dart ('k') | sdk/lib/_internal/pub_generated/lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698