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

Unified Diff: utils/pub/git_source.dart

Issue 10399076: Get codebase ready for actually supporting versioning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 7 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/io.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 22c5c5500bc45a86ebeb434d3efeb7f370ee1134..cc08e39113482b6a606d53ac5747e51fa1df1762 100644
--- a/utils/pub/git_source.dart
+++ b/utils/pub/git_source.dart
@@ -8,9 +8,12 @@
class GitSource extends Source {
final String name = "git";
- // TODO(nweiz): this should be cached since it uses the network, but until we
- // support versions there's no good way to distinguish between different
- // checkouts of the same repository.
+ // TODO(rnystrom): Git packages could in theory be cached, but that adds a
+ // lot of complexity. When you install a git package, you are installing
+ // and pinning to a specific commit. That means different installs of the
+ // same git path but at different commits need to be disambiguated in the
+ // system cache. It may also lead to a lot of garbage in the system cache.
+ // For now, we are punting and simply not caching them.
final bool shouldCache = false;
GitSource();
@@ -19,7 +22,7 @@ class GitSource extends Source {
* Clones a Git repo to the local filesystem.
*/
Future<bool> install(PackageId id, String destPath) {
- return runProcess("git", ["clone", "--progress", id.fullName, destPath],
+ return runProcess("git", ["clone", "--progress", id.description, destPath],
pipeStdout: true, pipeStderr: true).
transform((result) => result.success);
}
@@ -29,5 +32,14 @@ class GitSource extends Source {
* it'll be cloned.
*/
String packageName(PackageId id) =>
- basename(id.fullName).replaceFirst(const RegExp("\.git\$"), "");
+ basename(id.description).replaceFirst(const RegExp("\.git\$"), "");
+
+ /**
+ * Ensures [description] is a Git URL.
+ */
+ void validateDescription(description) {
+ if (description is! String) {
+ throw new FormatException("The description must be a git URL.");
+ }
+ }
}
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698