Git: Save all documents before stash pop

... and refresh the stash dialog

Change-Id: Iba16efc4f612cd1997493206704100ec57493932
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Orgad Shaneh
2015-02-04 20:50:11 +02:00
committed by Orgad Shaneh
parent 15e7446fda
commit 2a677ce8b3
4 changed files with 13 additions and 8 deletions

View File

@@ -509,7 +509,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
stashMenu->addSeparator(context);
action = createRepositoryAction(stashMenu, tr("Stash Pop"), "Git.StashPop",
context, true, &GitClient::stashPop);
context, true, SLOT(stashPop()));
action->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
@@ -1284,6 +1284,16 @@ void GitPlugin::stashSnapshot()
m_stashDialog->refresh(state.topLevel(), true);
}
void GitPlugin::stashPop()
{
if (!DocumentManager::saveAllModifiedDocuments())
return;
const QString repository = currentState().topLevel();
m_gitClient->stashPop(repository);
if (m_stashDialog)
m_stashDialog->refresh(repository, true);
}
// Create a non-modal dialog with refresh function or raise if it exists
template <class NonModalDialog>
inline void showNonModalDialog(const QString &topLevel,