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

Unified Diff: utils/pub/git_source.dart

Issue 12294039: Support relative paths in path dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise Created 7 years, 10 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 | « utils/pub/entrypoint.dart ('k') | utils/pub/hosted_source.dart » ('j') | no next file with comments »
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 fdb0ed4828c8e9ebcc35ea2ebceadab57f4136ed..2b54c7290f32e8ca365d2b3ca636109e9aab3fc0 100644
--- a/utils/pub/git_source.dart
+++ b/utils/pub/git_source.dart
@@ -10,6 +10,7 @@ import '../../pkg/path/lib/path.dart' as path;
import 'git.dart' as git;
import 'io.dart';
+import 'log.dart' as log;
import 'package.dart';
import 'source.dart';
import 'source_registry.dart';
@@ -67,24 +68,33 @@ class GitSource extends Source {
return path.join(systemCacheRoot, revisionCacheName);
});
}
+
/// Ensures [description] is a Git URL.
- void validateDescription(description, {bool fromLockFile: false}) {
+ dynamic parseDescription(String containingPath, description,
+ {bool fromLockFile: false}) {
+ // TODO(rnystrom): Handle git URLs that are relative file paths (#8570).
+ // TODO(rnystrom): Now that this function can modify the description, it
+ // may as well canonicalize it to a map so that other code in the source
+ // can assume that.
// A single string is assumed to be a Git URL.
- if (description is String) return;
+ if (description is String) return description;
if (description is! Map || !description.containsKey('url')) {
throw new FormatException("The description must be a Git URL or a map "
"with a 'url' key.");
}
- description = new Map.from(description);
- description.remove('url');
- description.remove('ref');
- if (fromLockFile) description.remove('resolved-ref');
-
- if (!description.isEmpty) {
- var plural = description.length > 1;
- var keys = description.keys.join(', ');
+
+ var parsed = new Map.from(description);
+ parsed.remove('url');
+ parsed.remove('ref');
+ if (fromLockFile) parsed.remove('resolved-ref');
+
+ if (!parsed.isEmpty) {
+ var plural = parsed.length > 1;
+ var keys = parsed.keys.join(', ');
throw new FormatException("Invalid key${plural ? 's' : ''}: $keys.");
}
+
+ return description;
}
/// Two Git descriptions are equal if both their URLs and their refs are
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/pub/hosted_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698