Add a Flutter version comparison function (#12959)

* add git version comparison function

* use [] in dartdoc

* Make method instance method
This commit is contained in:
xster
2017-11-14 18:50:15 -08:00
committed by GitHub
parent 473d75a6e3
commit 9a0d4cf75b
2 changed files with 44 additions and 0 deletions

View File

@@ -167,6 +167,20 @@ class FlutterVersion {
return _branch;
}
/// Returns true if `tentativeDescendantRevision` is a direct descendant to
/// the `tentativeAncestorRevision` revision on the Flutter framework repo
/// tree.
bool checkRevisionAncestry({
String tentativeDescendantRevision,
String tentativeAncestorRevision,
}) {
final ProcessResult result = processManager.runSync(
<String>['git', 'merge-base', '--is-ancestor', tentativeAncestorRevision, tentativeDescendantRevision],
workingDirectory: Cache.flutterRoot,
);
return result.exitCode == 0;
}
/// The amount of time we wait before pinging the server to check for the
/// availability of a newer version of Flutter.
@visibleForTesting