use of org.eclipse.egit.ui.internal.commit.CommitHelper in project egit by eclipse.
the class StagingView method resetCommitMessageComponent.
/**
* Resets the commit message component state and saves the overwritten
* commit message into message history
*/
public void resetCommitMessageComponent() {
if (currentRepository != null) {
String commitMessage = commitMessageComponent.getCommitMessage();
if (commitMessage.trim().length() > 0) {
CommitMessageHistory.saveCommitHistory(commitMessage);
}
loadInitialState(new CommitHelper(currentRepository));
}
}
use of org.eclipse.egit.ui.internal.commit.CommitHelper in project egit by eclipse.
the class InitHandler method createInitialCommit.
private void createInitialCommit(Repository repository) throws ExecutionException {
CommitHelper commitHelper = new CommitHelper(repository);
CommitOperation commitOperation;
try {
commitOperation = new CommitOperation(repository, commitHelper.getAuthor(), commitHelper.getCommitter(), UIText.InitHandler_initialCommit);
commitOperation.execute(null);
} catch (CoreException e) {
throw new ExecutionException(e.getMessage(), e);
}
}
use of org.eclipse.egit.ui.internal.commit.CommitHelper in project egit by eclipse.
the class StagingView method updateCommitMessageComponent.
void updateCommitMessageComponent(boolean repositoryChanged, boolean indexDiffAvailable) {
if (repositoryChanged)
if (commitMessageComponent.isAmending() || userEnteredCommitMessage())
saveCommitMessageComponentState();
else
deleteCommitMessageComponentState();
if (!indexDiffAvailable)
// only try to restore the stored repo commit message if
return;
// indexDiff is ready
CommitHelper helper = new CommitHelper(currentRepository);
CommitMessageComponentState oldState = null;
if (repositoryChanged || commitMessageComponent.getRepository() != currentRepository) {
oldState = loadCommitMessageComponentState();
commitMessageComponent.setRepository(currentRepository);
if (oldState == null)
loadInitialState(helper);
else
loadExistingState(helper, oldState);
} else {
// repository did not change
if (!commitMessageComponent.getHeadCommit().equals(helper.getPreviousCommit()) || !commitMessageComponent.isAmending()) {
if (!commitMessageComponent.isAmending() && userEnteredCommitMessage())
addHeadChangedWarning(commitMessageComponent.getCommitMessage());
else
loadInitialState(helper);
}
}
amendPreviousCommitAction.setChecked(commitMessageComponent.isAmending());
amendPreviousCommitAction.setEnabled(helper.amendAllowed());
updateMessage();
}
use of org.eclipse.egit.ui.internal.commit.CommitHelper 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);
}
}
Aggregations