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

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

Issue 12042053: Get rid of unneeded Future.immediate() calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 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 import 'git.dart' as git; 8 import 'git.dart' as git;
9 import 'io.dart'; 9 import 'io.dart';
10 import 'package.dart'; 10 import 'package.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 "Please ensure Git is correctly installed."); 42 "Please ensure Git is correctly installed.");
43 } 43 }
44 44
45 return ensureDir(join(systemCacheRoot, 'cache')); 45 return ensureDir(join(systemCacheRoot, 'cache'));
46 }).then((_) => _ensureRepoCache(id)) 46 }).then((_) => _ensureRepoCache(id))
47 .then((_) => _revisionCachePath(id)) 47 .then((_) => _revisionCachePath(id))
48 .then((path) { 48 .then((path) {
49 revisionCachePath = path; 49 revisionCachePath = path;
50 return exists(revisionCachePath); 50 return exists(revisionCachePath);
51 }).then((exists) { 51 }).then((exists) {
52 if (exists) return new Future.immediate(null); 52 if (exists) return;
53 return _clone(_repoCachePath(id), revisionCachePath, mirror: false); 53 return _clone(_repoCachePath(id), revisionCachePath, mirror: false);
54 }).then((_) { 54 }).then((_) {
55 var ref = _getEffectiveRef(id); 55 var ref = _getEffectiveRef(id);
56 if (ref == 'HEAD') return new Future.immediate(null); 56 if (ref == 'HEAD') return;
57 return _checkOut(revisionCachePath, ref); 57 return _checkOut(revisionCachePath, ref);
58 }).then((_) { 58 }).then((_) {
59 return Package.load(id.name, revisionCachePath, systemCache.sources); 59 return Package.load(id.name, revisionCachePath, systemCache.sources);
60 }); 60 });
61 } 61 }
62 62
63 /// Ensures [description] is a Git URL. 63 /// Ensures [description] is a Git URL.
64 void validateDescription(description, {bool fromLockFile: false}) { 64 void validateDescription(description, {bool fromLockFile: false}) {
65 // A single string is assumed to be a Git URL. 65 // A single string is assumed to be a Git URL.
66 if (description is String) return; 66 if (description is String) return;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return description['ref']; 191 return description['ref'];
192 } 192 }
193 193
194 /// Returns [description] if it's a description, or [PackageId.description] if 194 /// Returns [description] if it's a description, or [PackageId.description] if
195 /// it's a [PackageId]. 195 /// it's a [PackageId].
196 _getDescription(description) { 196 _getDescription(description) {
197 if (description is PackageId) return description.description; 197 if (description is PackageId) return description.description;
198 return description; 198 return description;
199 } 199 }
200 } 200 }
OLDNEW
« utils/pub/entrypoint.dart ('K') | « utils/pub/git.dart ('k') | utils/pub/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698