| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 * | 145 * |
| 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 // TODO(rnystrom): For some mysterious reason, the Windows buildbots do not | 151 // TODO(rnystrom): For some mysterious reason, the Windows buildbots do not |
| 152 // have the right working directory when pub spawns git, so the relative | 152 // have the right working directory when pub spawns git, so the relative |
| 153 // path fails. To work around it, if [from] looks like a relative path then | 153 // path fails. To work around it, if [from] looks like a relative path then |
| 154 // manually make it absolute here. Should figure out what's really going on. | 154 // manually make it absolute here. Should figure out what's really going on. |
| 155 var URL_LIKE = new RegExp(r'^[a-z]+\:'); | 155 const URL_LIKE = const RegExp(r'^[a-z]+\:'); |
| 156 if (!URL_LIKE.hasMatch(from)) { | 156 if (!URL_LIKE.hasMatch(from)) { |
| 157 from = getFullPath(from); | 157 from = getFullPath(from); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Git on Windows does not seem to automatically create the destination | 160 // Git on Windows does not seem to automatically create the destination |
| 161 // directory. | 161 // directory. |
| 162 return ensureDir(to).chain((_) { | 162 return ensureDir(to).chain((_) { |
| 163 var args = ["clone", from, to]; | 163 var args = ["clone", from, to]; |
| 164 if (mirror) args.insertRange(1, 1, "--mirror"); | 164 if (mirror) args.insertRange(1, 1, "--mirror"); |
| 165 return git.run(args); | 165 return git.run(args); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 /** | 227 /** |
| 228 * Returns [description] if it's a description, or [PackageId.description] if | 228 * Returns [description] if it's a description, or [PackageId.description] if |
| 229 * it's a [PackageId]. | 229 * it's a [PackageId]. |
| 230 */ | 230 */ |
| 231 _getDescription(description) { | 231 _getDescription(description) { |
| 232 if (description is PackageId) return description.description; | 232 if (description is PackageId) return description.description; |
| 233 return description; | 233 return description; |
| 234 } | 234 } |
| 235 } | 235 } |
| OLD | NEW |