| OLD | NEW |
| 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 library git_source; | 5 library git_source; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 /// | 141 /// |
| 142 /// If [mirror] is true, create a bare, mirrored clone. This doesn't check out | 142 /// If [mirror] is true, create a bare, mirrored clone. This doesn't check out |
| 143 /// the working tree, but instead makes the repository a local mirror of the | 143 /// the working tree, but instead makes the repository a local mirror of the |
| 144 /// remote repository. See the manpage for `git clone` for more information. | 144 /// remote repository. See the manpage for `git clone` for more information. |
| 145 Future _clone(String from, String to, {bool mirror: false}) { | 145 Future _clone(String from, String to, {bool mirror: false}) { |
| 146 return new Future.of(() { | 146 return new Future.of(() { |
| 147 // Git on Windows does not seem to automatically create the destination | 147 // Git on Windows does not seem to automatically create the destination |
| 148 // directory. | 148 // directory. |
| 149 ensureDir(to); | 149 ensureDir(to); |
| 150 var args = ["clone", from, to]; | 150 var args = ["clone", from, to]; |
| 151 if (mirror) args.insertRange(1, 1, "--mirror"); | 151 if (mirror) args.insert(1, "--mirror"); |
| 152 return git.run(args); | 152 return git.run(args); |
| 153 }).then((result) => null); | 153 }).then((result) => null); |
| 154 } | 154 } |
| 155 | 155 |
| 156 /// Checks out the reference [ref] in [repoPath]. | 156 /// Checks out the reference [ref] in [repoPath]. |
| 157 Future _checkOut(String repoPath, String ref) { | 157 Future _checkOut(String repoPath, String ref) { |
| 158 return git.run(["checkout", ref], workingDir: repoPath).then( | 158 return git.run(["checkout", ref], workingDir: repoPath).then( |
| 159 (result) => null); | 159 (result) => null); |
| 160 } | 160 } |
| 161 | 161 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return description['ref']; | 202 return description['ref']; |
| 203 } | 203 } |
| 204 | 204 |
| 205 /// Returns [description] if it's a description, or [PackageId.description] if | 205 /// Returns [description] if it's a description, or [PackageId.description] if |
| 206 /// it's a [PackageId]. | 206 /// it's a [PackageId]. |
| 207 _getDescription(description) { | 207 _getDescription(description) { |
| 208 if (description is PackageId) return description.description; | 208 if (description is PackageId) return description.description; |
| 209 return description; | 209 return description; |
| 210 } | 210 } |
| 211 } | 211 } |
| OLD | NEW |