forked from qt-creator/qt-creator
VCS: Offer to save-all before commit
Task-number: QTCREATORBUG-3857 Change-Id: I3ff3d90803eec4134b9da4af5567753ad7bffafb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -509,6 +509,9 @@ void BazaarPlugin::createSubmitEditorActions()
|
|||||||
|
|
||||||
void BazaarPlugin::commit()
|
void BazaarPlugin::commit()
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit()))
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -837,6 +837,11 @@ void ClearCasePlugin::updateActions(VcsBasePlugin::ActionState as)
|
|||||||
updateStatusActions();
|
updateStatusActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ClearCasePlugin::commitDisplayName() const
|
||||||
|
{
|
||||||
|
return tr("check in", "\"commit\" action for ClearCase.");
|
||||||
|
}
|
||||||
|
|
||||||
void ClearCasePlugin::checkOutCurrentFile()
|
void ClearCasePlugin::checkOutCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
@@ -1206,6 +1211,9 @@ void ClearCasePlugin::startCheckInActivity()
|
|||||||
* check in will start. */
|
* check in will start. */
|
||||||
void ClearCasePlugin::startCheckIn(const QString &workingDir, const QStringList &files)
|
void ClearCasePlugin::startCheckIn(const QString &workingDir, const QStringList &files)
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -199,6 +199,7 @@ private:
|
|||||||
void syncSlot();
|
void syncSlot();
|
||||||
Q_INVOKABLE void updateStatusActions();
|
Q_INVOKABLE void updateStatusActions();
|
||||||
|
|
||||||
|
QString commitDisplayName() const final;
|
||||||
void checkOutCurrentFile();
|
void checkOutCurrentFile();
|
||||||
void addCurrentFile();
|
void addCurrentFile();
|
||||||
void undoCheckOutCurrent();
|
void undoCheckOutCurrent();
|
||||||
|
@@ -651,6 +651,9 @@ void CvsPlugin::startCommitAll()
|
|||||||
* commit will start. */
|
* commit will start. */
|
||||||
void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
|
void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
if (isCommitEditorOpen()) {
|
if (isCommitEditorOpen()) {
|
||||||
|
@@ -926,6 +926,9 @@ void GitPlugin::gitGui()
|
|||||||
|
|
||||||
void GitPlugin::startCommit(CommitType commitType)
|
void GitPlugin::startCommit(CommitType commitType)
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
if (isCommitEditorOpen()) {
|
if (isCommitEditorOpen()) {
|
||||||
|
@@ -37,12 +37,12 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
@@ -494,6 +494,9 @@ void MercurialPlugin::createSubmitEditorActions()
|
|||||||
|
|
||||||
void MercurialPlugin::commit()
|
void MercurialPlugin::commit()
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -556,6 +556,8 @@ void PerforcePlugin::printOpenedFileList()
|
|||||||
|
|
||||||
void PerforcePlugin::startSubmitProject()
|
void PerforcePlugin::startSubmitProject()
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
@@ -1225,6 +1227,11 @@ void PerforceDiffConfig::triggerReRun()
|
|||||||
emit reRunDiff(effectiveParameters);
|
emit reRunDiff(effectiveParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PerforcePlugin::commitDisplayName() const
|
||||||
|
{
|
||||||
|
return tr("submit", "\"commit\" action for perforce");
|
||||||
|
}
|
||||||
|
|
||||||
void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
|
void PerforcePlugin::p4Diff(const QString &workingDir, const QStringList &files)
|
||||||
{
|
{
|
||||||
PerforceDiffParameters p;
|
PerforceDiffParameters p;
|
||||||
|
@@ -113,6 +113,7 @@ private slots:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString commitDisplayName() const final;
|
||||||
void p4Diff(const PerforceDiffParameters &p);
|
void p4Diff(const PerforceDiffParameters &p);
|
||||||
|
|
||||||
void openCurrentFile();
|
void openCurrentFile();
|
||||||
|
@@ -642,6 +642,9 @@ void SubversionPlugin::startCommitProject()
|
|||||||
* commit will start. */
|
* commit will start. */
|
||||||
void SubversionPlugin::startCommit(const QString &workingDir, const QStringList &files)
|
void SubversionPlugin::startCommit(const QString &workingDir, const QStringList &files)
|
||||||
{
|
{
|
||||||
|
if (!promptBeforeCommit())
|
||||||
|
return;
|
||||||
|
|
||||||
if (raiseSubmitEditor())
|
if (raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
if (isCommitEditorOpen()) {
|
if (isCommitEditorOpen()) {
|
||||||
|
@@ -641,6 +641,16 @@ bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *menuAction) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString VcsBasePlugin::commitDisplayName() const
|
||||||
|
{
|
||||||
|
return tr("commit", "name of \"commit\" action of the VCS.");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VcsBasePlugin::promptBeforeCommit()
|
||||||
|
{
|
||||||
|
return DocumentManager::saveAllModifiedDocuments(tr("Save before %1?").arg(commitDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
void VcsBasePlugin::promptToDeleteCurrentFile()
|
void VcsBasePlugin::promptToDeleteCurrentFile()
|
||||||
{
|
{
|
||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
|
@@ -178,6 +178,11 @@ public:
|
|||||||
const QProcessEnvironment &env = QProcessEnvironment());
|
const QProcessEnvironment &env = QProcessEnvironment());
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// Display name of the commit action:
|
||||||
|
virtual QString commitDisplayName() const;
|
||||||
|
// Prompt to save all files before commit:
|
||||||
|
bool promptBeforeCommit();
|
||||||
|
|
||||||
// Convenience slot for "Delete current file" action. Prompts to
|
// Convenience slot for "Delete current file" action. Prompts to
|
||||||
// delete the file via VcsManager.
|
// delete the file via VcsManager.
|
||||||
void promptToDeleteCurrentFile();
|
void promptToDeleteCurrentFile();
|
||||||
|
Reference in New Issue
Block a user