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

Unified Diff: utils/pub/git_source.dart

Issue 10905202: Look for git.cmd on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/git_source.dart
diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart
index 5437ece8ef73eda473bb72c84453eb3ea6d26ae7..f38f753798fc48402466864ac9b1e25cb4367cb3 100644
--- a/utils/pub/git_source.dart
+++ b/utils/pub/git_source.dart
@@ -124,8 +124,7 @@ class GitSource extends Source {
return exists(path).chain((exists) {
if (!exists) return _clone(_getUrl(id), path, mirror: true);
- return runProcess("git", ["fetch"], workingDir: path)
- .transform((result) {
+ return _runGit(["fetch"], workingDir: path).transform((result) {
if (!result.success) throw 'Git failed.';
return null;
});
@@ -136,7 +135,7 @@ class GitSource extends Source {
* Returns a future that completes to the revision hash of [id].
*/
Future<String> _revisionAt(PackageId id) {
- return runProcess("git", ["rev-parse", _getEffectiveRef(id)],
+ return _runGit(["rev-parse", _getEffectiveRef(id)],
workingDir: _repoCachePath(id)).transform((result) {
if (!result.success) throw 'Git failed.';
return result.stdout[0];
@@ -163,7 +162,7 @@ class GitSource extends Source {
Future _clone(String from, String to, [bool mirror=false]) {
var args = ["clone", from, to];
if (mirror) args.insertRange(1, 1, "--mirror");
- return runProcess("git", args).transform((result) {
+ return _runGit(args).transform((result) {
if (!result.success) throw 'Git failed.';
return null;
});
@@ -173,8 +172,7 @@ class GitSource extends Source {
* Checks out the reference [ref] in [repoPath].
*/
Future _checkOut(String repoPath, String ref) {
- return runProcess("git", ["checkout", ref], workingDir: repoPath)
- .transform((result) {
+ return _runGit(["checkout", ref], workingDir: repoPath).transform((result) {
if (!result.success) throw 'Git failed.';
return null;
});
@@ -238,4 +236,8 @@ class GitSource extends Source {
if (description is PackageId) return description.description;
return description;
}
+
+ /// Run a git process with [args] from [workingDir].
+ Future<PubProcessResult> _runGit(List<String> args, [String workingDir]) =>
Bob Nystrom 2012/09/11 16:18:55 How about moving this into io.dart? There's alread
nweiz 2012/09/11 19:25:11 Done.
+ gitCommand.chain((git) => runProcess(git, args, workingDir));
}
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698