initialize method

  1. @override
List<UndoableCommand> initialize()
override

Implementation

@override
List<UndoableCommand> initialize() {
  Repository repository = Repository(Directory.current.path);
  debugPrintToConsole(message: "Repository path is ${repository.path}");

  Branch otherBranch = Branch(otherBranchName, repository);
  State state = State(repository);
  Branch? thisBranch = state.getCurrentBranch(
    onNoStateFile: () => debugPrintToConsole(
      message: "Missing repository state file",
    ),
  );

  if (thisBranch == null) {
    return [ShowErrorCommand("error")];
  }

  return [
    MergeBranchCommand(repository, thisBranch, otherBranch),
  ];
}