forked from qt-creator/qt-creator
Git: Explicitly pop stored stashes
If the user created another stashed between save and pop, this stash will be restored instead of the intended one. Change-Id: I605c9f440345d8c7e0876f4f60daa7146bebb212 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -261,8 +261,8 @@ void BranchDialog::merge()
|
|||||||
if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
|
if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
|
||||||
gitClient->ensureStash(m_repository, QLatin1String("merge"), false, &stashMessage);
|
gitClient->ensureStash(m_repository, QLatin1String("merge"), false, &stashMessage);
|
||||||
|
|
||||||
if (gitClient->synchronousMerge(m_repository, branch) && (!stashMessage.isEmpty()))
|
if (gitClient->synchronousMerge(m_repository, branch) && !stashMessage.isEmpty())
|
||||||
gitClient->stashPop(m_repository);
|
gitClient->stashPop(m_repository, stashMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::rebase()
|
void BranchDialog::rebase()
|
||||||
@@ -278,8 +278,8 @@ void BranchDialog::rebase()
|
|||||||
if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
|
if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
|
||||||
gitClient->ensureStash(m_repository, QLatin1String("rebase"), false, &stashMessage);
|
gitClient->ensureStash(m_repository, QLatin1String("rebase"), false, &stashMessage);
|
||||||
|
|
||||||
if (gitClient->synchronousRebase(m_repository, baseBranch) && (!stashMessage.isEmpty()))
|
if (gitClient->synchronousRebase(m_repository, baseBranch) && !stashMessage.isEmpty())
|
||||||
gitClient->stashPop(m_repository);
|
gitClient->stashPop(m_repository, stashMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BranchDialog::changeEvent(QEvent *e)
|
void BranchDialog::changeEvent(QEvent *e)
|
||||||
|
|||||||
@@ -2277,14 +2277,21 @@ QString GitClient::msgNoChangedFiles()
|
|||||||
return tr("There are no modified files.");
|
return tr("There are no modified files.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::stashPop(const QString &workingDirectory)
|
void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
|
||||||
{
|
{
|
||||||
QStringList arguments(QLatin1String("stash"));
|
QStringList arguments(QLatin1String("stash"));
|
||||||
arguments << QLatin1String("pop");
|
arguments << QLatin1String("pop");
|
||||||
|
if (!stash.isEmpty())
|
||||||
|
arguments << stash;
|
||||||
VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true);
|
VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true);
|
||||||
connectRepositoryChanged(workingDirectory, cmd);
|
connectRepositoryChanged(workingDirectory, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitClient::stashPop(const QString &workingDirectory)
|
||||||
|
{
|
||||||
|
stashPop(workingDirectory, QString());
|
||||||
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
||||||
const QString &stash,
|
const QString &stash,
|
||||||
bool pop,
|
bool pop,
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ public:
|
|||||||
void synchronousSubversionFetch(const QString &workingDirectory);
|
void synchronousSubversionFetch(const QString &workingDirectory);
|
||||||
void subversionLog(const QString &workingDirectory);
|
void subversionLog(const QString &workingDirectory);
|
||||||
|
|
||||||
|
void stashPop(const QString &workingDirectory, const QString &stash);
|
||||||
void stashPop(const QString &workingDirectory);
|
void stashPop(const QString &workingDirectory);
|
||||||
void revert(const QStringList &files, bool revertStaging);
|
void revert(const QStringList &files, bool revertStaging);
|
||||||
void branchList(const QString &workingDirectory);
|
void branchList(const QString &workingDirectory);
|
||||||
|
|||||||
Reference in New Issue
Block a user