Address comments

in https://dart-review.googlesource.com/c/sdk/+/6860

Change-Id: I466e9123d152537005898f97998b62200d81ee45
Reviewed-on: https://dart-review.googlesource.com/6961
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2017-09-19 12:28:40 +00:00
parent e61f8461f3
commit 08c0d36b6d
2 changed files with 15 additions and 14 deletions

View file

@ -16,6 +16,7 @@ import 'cache_new.dart';
import 'logger.dart';
import 'luci.dart' hide Timing;
import 'luci_services.dart';
import 'try.dart';
import 'util.dart';
Future mainInternal(Bot bot, List<String> args,
@ -50,20 +51,22 @@ Future<Map<BuildUri, List<BuildResult>>> loadBuildResults(
Logger logger = createLogger(verbose: verbose);
CreateCacheFunction createCache =
createCacheFunction(logger, disableCache: noCache);
buildDetails = (await fetchBuildsForCommmit(
luci, logger, DART_CLIENT, commit, createCache, 25))
.value;
if (buildDetails.isEmpty) {
print('No builds found for $commit');
buildDetails = null;
} else {
if (verbose) {
log('Found builds for commit $commit:');
buildDetails.forEach((b) => log(' ${b.botName}: ${b.buildNumber}'));
Try<List<BuildDetail>> tryBuildDetails = await fetchBuildsForCommmit(
luci, logger, DART_CLIENT, commit, createCache, 25);
tryBuildDetails.fold(exceptionPrint('Failed to fetch commits.'),
(List<BuildDetail> result) {
if (result.isEmpty) {
print('No builds found for $commit');
} else {
print('Found ${buildDetails.length} builds for commit $commit.');
buildDetails = result;
if (verbose) {
log('Found builds for commit $commit:');
buildDetails.forEach((b) => log(' ${b.botName}: ${b.buildNumber}'));
} else {
print('Found ${buildDetails.length} builds for commit $commit.');
}
}
}
});
}
BuildUri updateWithCommit(BuildUri buildUri) {

View file

@ -26,7 +26,6 @@ class Try<T> {
try {
return new Try<S>.from(f(_val));
} catch (ex, stackTrace) {
print('$ex\n$stackTrace');
return new Try<S>.fail(ex, stackTrace);
}
}
@ -38,7 +37,6 @@ class Try<T> {
try {
return new Try.from(await f(_val));
} catch (ex, stackTrace) {
print(ex);
return new Try.fail(ex, stackTrace);
}
}