| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library testing.analyze; | 5 library testing.analyze; |
| 6 | 6 |
| 7 import 'dart:async' show Stream, Future; | 7 import 'dart:async' show Stream, Future; |
| 8 | 8 |
| 9 import 'dart:convert' show LineSplitter, UTF8; | 9 import 'dart:convert' show LineSplitter, UTF8; |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Future<Null> analyzeUris( | 151 Future<Null> analyzeUris( |
| 152 Uri analysisOptions, | 152 Uri analysisOptions, |
| 153 Uri packages, | 153 Uri packages, |
| 154 List<Uri> uris, | 154 List<Uri> uris, |
| 155 List<RegExp> exclude, | 155 List<RegExp> exclude, |
| 156 List<String> gitGrepPathspecs, | 156 List<String> gitGrepPathspecs, |
| 157 List<String> gitGrepPatterns) async { | 157 List<String> gitGrepPatterns) async { |
| 158 if (uris.isEmpty) return; | 158 if (uris.isEmpty) return; |
| 159 String topLevel; | 159 String topLevel; |
| 160 try { | 160 try { |
| 161 topLevel = Uri | 161 topLevel = new Uri.directory( |
| 162 .directory(await git("rev-parse", <String>["--show-toplevel"])) | 162 await git("rev-parse", <String>["--show-toplevel"]).trimRight()) |
| 163 .toFilePath(); | 163 .toFilePath(windows: false); |
| 164 } catch (e) { | 164 } catch (e) { |
| 165 topLevel = Uri.base.toFilePath(windows: false); | 165 topLevel = Uri.base.toFilePath(windows: false); |
| 166 } | 166 } |
| 167 | 167 |
| 168 String toFilePath(Uri uri) { | 168 String toFilePath(Uri uri) { |
| 169 String path = uri.toFilePath(windows: false); | 169 String path = uri.toFilePath(windows: false); |
| 170 return path.startsWith(topLevel) ? path.substring(topLevel.length) : path; | 170 return path.startsWith(topLevel) ? path.substring(topLevel.length) : path; |
| 171 } | 171 } |
| 172 | 172 |
| 173 Set<String> filesToAnalyze = new Set<String>(); | 173 Set<String> filesToAnalyze = new Set<String>(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 ProcessResult result = await Process.run( | 272 ProcessResult result = await Process.run( |
| 273 Platform.isWindows ? "git.bat" : "git", | 273 Platform.isWindows ? "git.bat" : "git", |
| 274 <String>[command]..addAll(arguments), | 274 <String>[command]..addAll(arguments), |
| 275 workingDirectory: workingDirectory); | 275 workingDirectory: workingDirectory); |
| 276 if (result.exitCode != 0) { | 276 if (result.exitCode != 0) { |
| 277 throw "Non-zero exit code from git $command (${result.exitCode})\n" | 277 throw "Non-zero exit code from git $command (${result.exitCode})\n" |
| 278 "${result.stdout}\n${result.stderr}"; | 278 "${result.stdout}\n${result.stderr}"; |
| 279 } | 279 } |
| 280 return result.stdout; | 280 return result.stdout; |
| 281 } | 281 } |
| OLD | NEW |