forked from qt-creator/qt-creator
Subversion: Do not close the editor if commit fails
Fixes: QTCREATORBUG-15227 Change-Id: I975c88d686e75bbb33e827a4a591b172b4f68bbd Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
50ce82d26a
commit
78b551e756
@@ -76,7 +76,7 @@ SubversionClient::SubversionClient() : VcsBaseClient(new SubversionSettings)
|
||||
});
|
||||
}
|
||||
|
||||
VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot,
|
||||
bool SubversionClient::doCommit(const QString &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions) const
|
||||
@@ -88,11 +88,11 @@ VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot,
|
||||
<< QLatin1String("--encoding") << QLatin1String("UTF-8")
|
||||
<< QLatin1String("--file") << commitMessageFile;
|
||||
|
||||
VcsCommand *cmd = createCommand(repositoryRoot);
|
||||
cmd->addFlags(VcsCommand::ShowStdOut);
|
||||
QStringList args(vcsCommandString(CommitCommand));
|
||||
cmd->addJob(vcsBinary(), args << svnExtraOptions << escapeFiles(files));
|
||||
return cmd;
|
||||
SynchronousProcessResponse resp =
|
||||
vcsSynchronousExec(repositoryRoot, args << svnExtraOptions << escapeFiles(files),
|
||||
VcsCommand::ShowStdOut | VcsCommand::NoFullySync);
|
||||
return resp.result == SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
void SubversionClient::commit(const QString &repositoryRoot,
|
||||
@@ -103,8 +103,7 @@ void SubversionClient::commit(const QString &repositoryRoot,
|
||||
if (Subversion::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << commitMessageFile << files;
|
||||
|
||||
VcsCommand *cmd = createCommitCmd(repositoryRoot, files, commitMessageFile, extraOptions);
|
||||
cmd->execute();
|
||||
doCommit(repositoryRoot, files, commitMessageFile, extraOptions);
|
||||
}
|
||||
|
||||
Id SubversionClient::vcsEditorKind(VcsCommandTag cmd) const
|
||||
|
||||
@@ -43,7 +43,7 @@ class SubversionClient : public VcsBase::VcsBaseClient
|
||||
public:
|
||||
SubversionClient();
|
||||
|
||||
VcsBase::VcsCommand *createCommitCmd(const QString &repositoryRoot,
|
||||
bool doCommit(const QString &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions = QStringList()) const;
|
||||
|
||||
@@ -442,15 +442,10 @@ bool SubversionPlugin::submitEditorAboutToClose()
|
||||
bool closeEditor = true;
|
||||
if (!fileList.empty()) {
|
||||
// get message & commit
|
||||
closeEditor = DocumentManager::saveDocument(editorDocument);
|
||||
if (closeEditor) {
|
||||
VcsCommand *commitCmd = m_client->createCommitCmd(m_commitRepository,
|
||||
fileList,
|
||||
m_commitMessageFileName);
|
||||
QObject::connect(commitCmd, &VcsCommand::finished,
|
||||
this, [this]() { cleanCommitMessageFile(); });
|
||||
commitCmd->execute();
|
||||
}
|
||||
closeEditor = DocumentManager::saveDocument(editorDocument)
|
||||
&& m_client->doCommit(m_commitRepository, fileList, m_commitMessageFileName);
|
||||
if (closeEditor)
|
||||
cleanCommitMessageFile();
|
||||
}
|
||||
return closeEditor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user