forked from qt-creator/qt-creator
Git: Suggest mergetool on stash restore conflicts
Removed warning popup, but stderr is still visible in Version Control pane Change-Id: I6f5779f0382b8ead1e7140eb6ad533ea0c91dcc2 Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
d7b8b291a9
commit
647c65c96e
@@ -3529,26 +3529,14 @@ void GitClient::stashPop(const QString &workingDirectory)
|
|||||||
bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
||||||
const QString &stash,
|
const QString &stash,
|
||||||
bool pop,
|
bool pop,
|
||||||
const QString &branch /* = QString()*/,
|
const QString &branch /* = QString()*/)
|
||||||
QString *errorMessage)
|
|
||||||
{
|
{
|
||||||
QStringList arguments(QLatin1String("stash"));
|
QStringList arguments(QLatin1String("stash"));
|
||||||
if (branch.isEmpty())
|
if (branch.isEmpty())
|
||||||
arguments << QLatin1String(pop ? "pop" : "apply") << stash;
|
arguments << QLatin1String(pop ? "pop" : "apply") << stash;
|
||||||
else
|
else
|
||||||
arguments << QLatin1String("branch") << branch << stash;
|
arguments << QLatin1String("branch") << branch << stash;
|
||||||
QByteArray outputText;
|
return executeAndHandleConflicts(workingDirectory, arguments);
|
||||||
QByteArray errorText;
|
|
||||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText,
|
|
||||||
VcsBasePlugin::ExpectRepoChanges);
|
|
||||||
if (rc) {
|
|
||||||
const QString output = commandOutputFromLocal8Bit(outputText);
|
|
||||||
if (!output.isEmpty())
|
|
||||||
outputWindow()->append(output);
|
|
||||||
} else {
|
|
||||||
msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousStashRemove(const QString &workingDirectory,
|
bool GitClient::synchronousStashRemove(const QString &workingDirectory,
|
||||||
|
|||||||
@@ -197,8 +197,7 @@ public:
|
|||||||
bool synchronousStashRestore(const QString &workingDirectory,
|
bool synchronousStashRestore(const QString &workingDirectory,
|
||||||
const QString &stash,
|
const QString &stash,
|
||||||
bool pop = false,
|
bool pop = false,
|
||||||
const QString &branch = QString(),
|
const QString &branch = QString());
|
||||||
QString *errorMessage = 0);
|
|
||||||
bool synchronousStashRemove(const QString &workingDirectory,
|
bool synchronousStashRemove(const QString &workingDirectory,
|
||||||
const QString &stash = QString(),
|
const QString &stash = QString(),
|
||||||
QString *errorMessage = 0);
|
QString *errorMessage = 0);
|
||||||
|
|||||||
@@ -323,12 +323,10 @@ void StashDialog::restoreCurrent()
|
|||||||
QString name = m_model->at(index).name;
|
QString name = m_model->at(index).name;
|
||||||
// Make sure repository is not modified, restore. The command will
|
// Make sure repository is not modified, restore. The command will
|
||||||
// output to window on success.
|
// output to window on success.
|
||||||
const bool success = promptForRestore(&name, 0, &errorMessage)
|
if (promptForRestore(&name, 0, &errorMessage)
|
||||||
&& gitClient()->synchronousStashRestore(m_repository, name, false, QString(), &errorMessage);
|
&& gitClient()->synchronousStashRestore(m_repository, name)) {
|
||||||
if (success) {
|
|
||||||
refresh(m_repository, true); // Might have stashed away local changes.
|
refresh(m_repository, true); // Might have stashed away local changes.
|
||||||
} else {
|
} else if (!errorMessage.isEmpty()) {
|
||||||
if (!errorMessage.isEmpty())
|
|
||||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,12 +338,10 @@ void StashDialog::restoreCurrentInBranch()
|
|||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QString branch;
|
QString branch;
|
||||||
QString name = m_model->at(index).name;
|
QString name = m_model->at(index).name;
|
||||||
const bool success = promptForRestore(&name, &branch, &errorMessage)
|
if (promptForRestore(&name, &branch, &errorMessage)
|
||||||
&& gitClient()->synchronousStashRestore(m_repository, name, false, branch, &errorMessage);
|
&& gitClient()->synchronousStashRestore(m_repository, name, false, branch)) {
|
||||||
if (success) {
|
|
||||||
refresh(m_repository, true); // git deletes the stash, unfortunately.
|
refresh(m_repository, true); // git deletes the stash, unfortunately.
|
||||||
} else {
|
} else if (!errorMessage.isEmpty()) {
|
||||||
if (!errorMessage.isEmpty())
|
|
||||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user