forked from qt-creator/qt-creator
Git: Replace synchronousStash with ensureStash
When flags are not used. syncStash doesn't return result, which can be useful for StashGuard Change-Id: I1327b5d8d10410e7a3b9fdb07a03b476d5abcdc4 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
8b67ae7395
commit
89d16332d1
@@ -1578,7 +1578,11 @@ GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, c
|
||||
}
|
||||
|
||||
// Ensure that changed files are stashed before a pull or similar
|
||||
GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, const QString &keyword, QString *message, QString *errorMessage)
|
||||
GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory,
|
||||
const QString &keyword,
|
||||
bool askUser,
|
||||
QString *message,
|
||||
QString *errorMessage)
|
||||
{
|
||||
QString statusOutput;
|
||||
switch (gitStatus(workingDirectory, StatusMode(NoUntracked | NoSubmodules),
|
||||
@@ -1591,23 +1595,24 @@ GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, c
|
||||
return StashFailed;
|
||||
}
|
||||
|
||||
const int answer = askWithDetailedText(Core::ICore::mainWindow(), tr("Changes"),
|
||||
tr("Would you like to stash your changes?"),
|
||||
statusOutput, QMessageBox::Yes, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
switch (answer) {
|
||||
case QMessageBox::Cancel:
|
||||
return StashCanceled;
|
||||
case QMessageBox::Yes: {
|
||||
const QString stashMessage = creatorStashMessage(keyword);
|
||||
if (!executeSynchronousStash(workingDirectory, stashMessage, errorMessage))
|
||||
return StashFailed;
|
||||
if (message)
|
||||
*message = stashMessage;
|
||||
break;
|
||||
}
|
||||
case QMessageBox::No: // At your own risk, so.
|
||||
return NotStashed;
|
||||
if (askUser) {
|
||||
const int answer = askWithDetailedText(Core::ICore::mainWindow(), tr("Changes"),
|
||||
tr("Would you like to stash your changes?"),
|
||||
statusOutput, QMessageBox::Yes, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
switch (answer) {
|
||||
case QMessageBox::Cancel:
|
||||
return StashCanceled;
|
||||
case QMessageBox::No: // At your own risk, so.
|
||||
return NotStashed;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString stashMessage = creatorStashMessage(keyword);
|
||||
if (!executeSynchronousStash(workingDirectory, stashMessage, errorMessage))
|
||||
return StashFailed;
|
||||
if (message)
|
||||
*message = stashMessage;
|
||||
return Stashed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user