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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/source/git.dart

Issue 844263004: Properly update git binary snapshots during pub upgrade. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix tests Created 5 years, 11 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
Index: sdk/lib/_internal/pub_generated/lib/src/source/git.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/source/git.dart b/sdk/lib/_internal/pub_generated/lib/src/source/git.dart
index 18b4954f17016b0718fa38a4eff6a4d0271b2b7b..abf8125b3155af12ac842e061b37744e2a33c7cd 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/source/git.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/source/git.dart
@@ -117,14 +117,36 @@ class GitSource extends CachedSource {
return description;
}
+ /// If [description] has a resolved ref, print it out in short-form.
+ ///
+ /// This helps distinguish different git commits with the same pubspec
+ /// version.
+ String formatDescription(String containingPath, description) {
+ if (description is Map && description.containsKey('resolved-ref')) {
+ return "${description['url']} at "
+ "${description['resolved-ref'].substring(0, 6)}";
+ } else {
+ return super.formatDescription(containingPath, description);
+ }
+ }
+
/// Two Git descriptions are equal if both their URLs and their refs are
/// equal.
bool descriptionsEqual(description1, description2) {
// TODO(nweiz): Do we really want to throw an error if you have two
// dependencies on some repo, one of which specifies a ref and one of which
// doesn't? If not, how do we handle that case in the version solver?
- return _getUrl(description1) == _getUrl(description2) &&
- _getRef(description1) == _getRef(description2);
+ if (_getUrl(description1) != _getUrl(description2)) return false;
+ if (_getRef(description1) != _getRef(description2)) return false;
+
+ if (description1 is Map &&
+ description1.containsKey('resolved-ref') &&
+ description2 is Map &&
+ description2.containsKey('resolved-ref')) {
+ return description1['resolved-ref'] == description2['resolved-ref'];
+ }
+
+ return true;
}
/// Attaches a specific commit to [id] to disambiguate it.

Powered by Google App Engine
This is Rietveld 408576698