| 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 'git.dart' as git; | 7 import 'git.dart' as git; |
| 8 import 'io.dart'; | 8 import 'io.dart'; |
| 9 import 'package.dart'; | 9 import 'package.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 * If [mirror] is true, create a bare, mirrored clone. This doesn't check out | 146 * If [mirror] is true, create a bare, mirrored clone. This doesn't check out |
| 147 * the working tree, but instead makes the repository a local mirror of the | 147 * the working tree, but instead makes the repository a local mirror of the |
| 148 * remote repository. See the manpage for `git clone` for more information. | 148 * remote repository. See the manpage for `git clone` for more information. |
| 149 */ | 149 */ |
| 150 Future _clone(String from, String to, {bool mirror: false}) { | 150 Future _clone(String from, String to, {bool mirror: false}) { |
| 151 // Git on Windows does not seem to automatically create the destination | 151 // Git on Windows does not seem to automatically create the destination |
| 152 // directory. | 152 // directory. |
| 153 return ensureDir(to).chain((_) { | 153 return ensureDir(to).chain((_) { |
| 154 var args = ["clone", from, to]; | 154 var args = ["clone", from, to]; |
| 155 if (mirror) args.insertRange(1, 1, "--mirror"); | 155 if (mirror) args.insertRange(1, 1, "--mirror"); |
| 156 return git.run(args, workingDir: currentWorkingDir); | 156 return git.run(args); |
| 157 }).transform((result) => null); | 157 }).transform((result) => null); |
| 158 } | 158 } |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Checks out the reference [ref] in [repoPath]. | 161 * Checks out the reference [ref] in [repoPath]. |
| 162 */ | 162 */ |
| 163 Future _checkOut(String repoPath, String ref) { | 163 Future _checkOut(String repoPath, String ref) { |
| 164 return git.run(["checkout", ref], workingDir: repoPath).transform( | 164 return git.run(["checkout", ref], workingDir: repoPath).transform( |
| 165 (result) => null); | 165 (result) => null); |
| 166 } | 166 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 /** | 218 /** |
| 219 * Returns [description] if it's a description, or [PackageId.description] if | 219 * Returns [description] if it's a description, or [PackageId.description] if |
| 220 * it's a [PackageId]. | 220 * it's a [PackageId]. |
| 221 */ | 221 */ |
| 222 _getDescription(description) { | 222 _getDescription(description) { |
| 223 if (description is PackageId) return description.description; | 223 if (description is PackageId) return description.description; |
| 224 return description; | 224 return description; |
| 225 } | 225 } |
| 226 } | 226 } |
| OLD | NEW |