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

Side by Side Diff: utils/pub/git_source.dart

Issue 12755024: add cache list command to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 8
9 import '../../pkg/pathos/lib/path.dart' as path; 9 import '../../pkg/pathos/lib/path.dart' as path;
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 /// Attaches a specific commit to [id] to disambiguate it. 110 /// Attaches a specific commit to [id] to disambiguate it.
111 Future<PackageId> resolveId(PackageId id) { 111 Future<PackageId> resolveId(PackageId id) {
112 return _revisionAt(id).then((revision) { 112 return _revisionAt(id).then((revision) {
113 var description = {'url': _getUrl(id), 'ref': _getRef(id)}; 113 var description = {'url': _getUrl(id), 'ref': _getRef(id)};
114 description['resolved-ref'] = revision; 114 description['resolved-ref'] = revision;
115 return new PackageId(id.name, this, id.version, description); 115 return new PackageId(id.name, this, id.version, description);
116 }); 116 });
117 } 117 }
118 118
119 Future<List<Package>> getCachedPackages() {
120 //TODO(keertip): to be impelemented.
Bob Nystrom 2013/03/13 17:44:07 Remove the entire implementation (so that the thro
keertip 2013/03/13 18:09:48 Done.
121 }
122
119 /// Ensure that the canonical clone of the repository referred to by [id] (the 123 /// Ensure that the canonical clone of the repository referred to by [id] (the
120 /// one in `<system cache>/git/cache`) exists and is up-to-date. Returns a 124 /// one in `<system cache>/git/cache`) exists and is up-to-date. Returns a
121 /// future that completes once this is finished and throws an exception if it 125 /// future that completes once this is finished and throws an exception if it
122 /// fails. 126 /// fails.
123 Future _ensureRepoCache(PackageId id) { 127 Future _ensureRepoCache(PackageId id) {
124 return defer(() { 128 return defer(() {
125 var path = _repoCachePath(id); 129 var path = _repoCachePath(id);
126 if (!entryExists(path)) return _clone(_getUrl(id), path, mirror: true); 130 if (!entryExists(path)) return _clone(_getUrl(id), path, mirror: true);
127 return git.run(["fetch"], workingDir: path).then((result) => null); 131 return git.run(["fetch"], workingDir: path).then((result) => null);
128 }); 132 });
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return description['ref']; 204 return description['ref'];
201 } 205 }
202 206
203 /// Returns [description] if it's a description, or [PackageId.description] if 207 /// Returns [description] if it's a description, or [PackageId.description] if
204 /// it's a [PackageId]. 208 /// it's a [PackageId].
205 _getDescription(description) { 209 _getDescription(description) {
206 if (description is PackageId) return description.description; 210 if (description is PackageId) return description.description;
207 return description; 211 return description;
208 } 212 }
209 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698