use of org.eclipse.egit.core.op.CommitOperation in project egit by eclipse.
the class FeatureFinishHandler method rewordCommitMessage.
private void rewordCommitMessage(Shell activeShell, final GitFlowRepository gfRepo) throws CoreException, IOException {
Repository repository = gfRepo.getRepository();
CommitHelper commitHelper = new CommitHelper(repository);
CommitMessageEditorDialog messageEditorDialog = new CommitMessageEditorDialog(activeShell, repository.readSquashCommitMsg(), UIText.FeatureFinishHandler_rewordSquashedCommitMessage);
if (Window.OK == messageEditorDialog.open()) {
String commitMessage = stripCommentLines(messageEditorDialog.getCommitMessage());
CommitOperation commitOperation = new CommitOperation(repository, commitHelper.getAuthor(), commitHelper.getCommitter(), commitMessage);
commitOperation.execute(null);
}
}
use of org.eclipse.egit.core.op.CommitOperation in project egit by eclipse.
the class InitOperation method execute.
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
try {
setPrefixes(feature, release, hotfix, versionTag);
setBranches(develop, master);
repository.getRepository().getConfig().save();
} catch (IOException e) {
throw new CoreException(error(e.getMessage(), e));
}
SubMonitor progress = SubMonitor.convert(monitor, 3);
if (!repository.hasBranches()) {
new CommitOperation(repository.getRepository(), repository.getConfig().getUser(), repository.getConfig().getUser(), CoreText.InitOperation_initialCommit).execute(progress.newChild(1));
}
try {
if (!isMasterBranchAvailable()) {
throw new CoreException(error(NLS.bind(CoreText.InitOperation_localMasterDoesNotExist, master)));
}
RevCommit head = repository.findHead();
if (!repository.hasBranch(develop)) {
CreateLocalBranchOperation branchFromHead = createBranchFromHead(develop, head);
branchFromHead.execute(progress.newChild(1));
BranchOperation checkoutOperation = new BranchOperation(repository.getRepository(), develop);
checkoutOperation.execute(progress.newChild(1));
}
} catch (WrongGitFlowStateException e) {
throw new CoreException(error(e));
} catch (GitAPIException e) {
throw new CoreException(error(e.getMessage(), e));
}
}
Aggregations