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

Unified Diff: lib/src/source/git.dart

Issue 2079303003: Track Source objects in PackageNames. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 6 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 | « lib/src/source.dart ('k') | lib/src/source/hosted.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/git.dart
diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart
index 452b6890e3d4054a8c8352f0bb6b019ea984bbb3..90f417777f39f93bfebad9dd9b7498c9d85be0fd 100644
--- a/lib/src/source/git.dart
+++ b/lib/src/source/git.dart
@@ -28,7 +28,7 @@ class GitSource extends Source {
///
/// If passed, [reference] is the Git reference. It defaults to `"HEAD"`.
PackageRef refFor(String name, String url, {String reference}) =>
- new PackageRef(name, "git", {'url': url, 'ref': reference ?? 'HEAD'});
+ new PackageRef(name, this, {'url': url, 'ref': reference ?? 'HEAD'});
/// Given a valid git package description, returns the URL of the repository
/// it pulls from.
@@ -56,7 +56,7 @@ class GitSource extends Source {
"string.");
}
- return new PackageRef(name, this.name, {
+ return new PackageRef(name, this, {
"url": description["url"],
"ref": description["ref"] ?? "HEAD"
});
@@ -86,7 +86,7 @@ class GitSource extends Source {
"must be a string.");
}
- return new PackageId(name, this.name, version, {
+ return new PackageId(name, this, version, {
"url": description["url"],
"ref": description["ref"] ?? "HEAD",
"resolved-ref": description["resolved-ref"]
@@ -132,6 +132,12 @@ class GitSource extends Source {
return true;
}
+
+ int hashDescription(description) {
+ // Don't include the resolved ref in the hash code because we ignore it in
+ // [descriptionsEqual] if only one description defines it.
+ return description['url'].hashCode ^ description['ref'].hashCode;
+ }
}
/// The [BoundSource] for [GitSource].
@@ -165,7 +171,7 @@ class BoundGitSource extends CachedSource {
var pubspec = await _describeUncached(ref, revision);
return [
- new PackageId(ref.name, source.name, pubspec.version, {
+ new PackageId(ref.name, source, pubspec.version, {
'url': ref.description['url'],
'ref': ref.description['ref'],
'resolved-ref': revision
@@ -257,7 +263,7 @@ class BoundGitSource extends CachedSource {
packages.sort(Package.orderByNameAndVersion);
for (var package in packages) {
- var id = new PackageId(package.name, source.name, package.version, null);
+ var id = new PackageId(package.name, source, package.version, null);
log.message("Resetting Git repository for "
"${log.bold(package.name)} ${package.version}...");
« no previous file with comments | « lib/src/source.dart ('k') | lib/src/source/hosted.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698