run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
Future run() async {
var args = argResults!.rest;
if (args.length != 2) {
print('Incorrect usage');
return;
}
var gitRootDir = GitRepository.findRootDir(Directory.current.path)!;
var repo = await GitRepository.load(gitRootDir);
var aHash = GitHash(args[0]);
var bHash = GitHash(args[1]);
var aRes = await repo.objStorage.readCommit(aHash);
var bRes = await repo.objStorage.readCommit(bHash);
var commits = await repo.mergeBase(aRes.get(), bRes.get());
for (var c in commits) {
print(c.hash);
}
}