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 import 'git.dart' as git; | 8 import 'git.dart' as git; |
9 import 'io.dart'; | 9 import 'io.dart'; |
10 import 'package.dart'; | 10 import 'package.dart'; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 throw new FormatException("The description must be a Git URL or a map " | 72 throw new FormatException("The description must be a Git URL or a map " |
73 "with a 'url' key."); | 73 "with a 'url' key."); |
74 } | 74 } |
75 description = new Map.from(description); | 75 description = new Map.from(description); |
76 description.remove('url'); | 76 description.remove('url'); |
77 description.remove('ref'); | 77 description.remove('ref'); |
78 if (fromLockFile) description.remove('resolved-ref'); | 78 if (fromLockFile) description.remove('resolved-ref'); |
79 | 79 |
80 if (!description.isEmpty) { | 80 if (!description.isEmpty) { |
81 var plural = description.length > 1; | 81 var plural = description.length > 1; |
82 var keys = Strings.join(description.keys, ', '); | 82 var keys = description.keys.join(', '); |
83 throw new FormatException("Invalid key${plural ? 's' : ''}: $keys."); | 83 throw new FormatException("Invalid key${plural ? 's' : ''}: $keys."); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 /// Two Git descriptions are equal if both their URLs and their refs are | 87 /// Two Git descriptions are equal if both their URLs and their refs are |
88 /// equal. | 88 /// equal. |
89 bool descriptionsEqual(description1, description2) { | 89 bool descriptionsEqual(description1, description2) { |
90 // TODO(nweiz): Do we really want to throw an error if you have two | 90 // TODO(nweiz): Do we really want to throw an error if you have two |
91 // dependencies on some repo, one of which specifies a ref and one of which | 91 // dependencies on some repo, one of which specifies a ref and one of which |
92 // doesn't? If not, how do we handle that case in the version solver? | 92 // doesn't? If not, how do we handle that case in the version solver? |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return description['ref']; | 187 return description['ref']; |
188 } | 188 } |
189 | 189 |
190 /// Returns [description] if it's a description, or [PackageId.description] if | 190 /// Returns [description] if it's a description, or [PackageId.description] if |
191 /// it's a [PackageId]. | 191 /// it's a [PackageId]. |
192 _getDescription(description) { | 192 _getDescription(description) { |
193 if (description is PackageId) return description.description; | 193 if (description is PackageId) return description.description; |
194 return description; | 194 return description; |
195 } | 195 } |
196 } | 196 } |
OLD | NEW |