abort commit if commit message cannot be saved

This commit is contained in:
Oswald Buddenhagen
2011-03-30 12:43:17 +02:00
parent 096a7aa72b
commit 469199e7a5
6 changed files with 14 additions and 8 deletions
+2 -1
View File
@@ -630,7 +630,8 @@ bool BazaarPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submit
QStringList files = commitEditor->checkedFiles();
if (!files.empty()) {
//save the commit message
m_core->fileManager()->saveFile(editorFile);
if (!m_core->fileManager()->saveFile(editorFile))
return false;
//rewrite entries of the form 'file => newfile' to 'newfile' because
//this would mess the commit command
+3 -2
View File
@@ -501,8 +501,9 @@ bool CVSPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEdi
bool closeEditor = true;
if (!fileList.empty()) {
// get message & commit
Core::ICore::instance()->fileManager()->saveFile(fileIFace);
closeEditor= commit(m_commitMessageFileName, fileList);
closeEditor = Core::ICore::instance()->fileManager()->saveFile(fileIFace);
if (closeEditor)
closeEditor = commit(m_commitMessageFileName, fileList);
}
if (closeEditor)
cleanCommitMessageFile();
+2 -1
View File
@@ -781,7 +781,8 @@ bool GitPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEdi
bool closeEditor = true;
if (!fileList.empty() || !m_commitAmendSHA1.isEmpty()) {
// get message & commit
m_core->fileManager()->saveFile(fileIFace);
if (!m_core->fileManager()->saveFile(fileIFace))
return false;
closeEditor = m_gitClient->addAndCommit(m_submitRepository,
editor->panelData(),
+2 -1
View File
@@ -664,7 +664,8 @@ bool MercurialPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *sub
const QStringList files = commitEditor->checkedFiles();
if (!files.empty()) {
//save the commit message
core->fileManager()->saveFile(editorFile);
if (!core->fileManager()->saveFile(editorFile))
return false;
QHash<int, QVariant> extraOptions;
extraOptions[MercurialClient::AuthorCommitOptionId] = commitEditor->committerInfo();
+2 -1
View File
@@ -1365,7 +1365,8 @@ bool PerforcePlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *subm
m_settings.setPromptToSubmit(wantsPrompt);
m_settings.toSettings(Core::ICore::instance()->settings());
}
Core::ICore::instance()->fileManager()->saveFile(fileIFace);
if (!Core::ICore::instance()->fileManager()->saveFile(fileIFace))
return false;
if (answer == VCSBase::VCSBaseSubmitEditor::SubmitDiscarded) {
cleanCommitMessageFile();
return true;
+3 -2
View File
@@ -512,8 +512,9 @@ bool SubversionPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *su
bool closeEditor = true;
if (!fileList.empty()) {
// get message & commit
Core::ICore::instance()->fileManager()->saveFile(fileIFace);
closeEditor= commit(m_commitMessageFileName, fileList);
closeEditor = Core::ICore::instance()->fileManager()->saveFile(fileIFace);
if (closeEditor)
closeEditor = commit(m_commitMessageFileName, fileList);
}
if (closeEditor)
cleanCommitMessageFile();