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

Side by Side Diff: utils/pub/git.dart

Issue 11830017: Fix ALL the pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Helper functionality for invoking Git. 5 /// Helper functionality for invoking Git.
6 library git; 6 library git;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'io.dart'; 9 import 'io.dart';
10 import 'log.dart' as log; 10 import 'log.dart' as log;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 }); 58 });
59 }).then((command) { 59 }).then((command) {
60 log.fine('Determined git command $command.'); 60 log.fine('Determined git command $command.');
61 _gitCommandCache = command; 61 _gitCommandCache = command;
62 return command; 62 return command;
63 }); 63 });
64 } 64 }
65 65
66 /// Checks whether [command] is the Git command for this computer. 66 /// Checks whether [command] is the Git command for this computer.
67 Future<bool> _tryGitCommand(String command) { 67 Future<bool> _tryGitCommand(String command) {
68 var completer = new Completer<bool>();
69
70 // If "git --version" prints something familiar, git is working. 68 // If "git --version" prints something familiar, git is working.
71 var future = runProcess(command, ["--version"]); 69 return runProcess(command, ["--version"]).then((results) {
72 70 var regexp = new RegExp("^git version");
73 future 71 return results.stdout.length == 1 && regexp.hasMatch(results.stdout[0]);
74 .then((results) { 72 }).catchError((err) {
75 var regex = new RegExp("^git version"); 73 // If the process failed, they probably don't have it.
76 completer.complete(results.stdout.length == 1 && 74 return false;
77 regex.hasMatch(results.stdout[0])); 75 });
Bob Nystrom 2013/01/09 16:49:23 Much nicer!
78 })
79 .catchError((err) {
80 // If the process failed, they probably don't have it.
81 completer.complete(false);
82 });
83
84 return completer.future;
85 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698