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,
|
||||
const QString &stash,
|
||||
bool pop,
|
||||
const QString &branch /* = QString()*/,
|
||||
QString *errorMessage)
|
||||
const QString &branch /* = QString()*/)
|
||||
{
|
||||
QStringList arguments(QLatin1String("stash"));
|
||||
if (branch.isEmpty())
|
||||
arguments << QLatin1String(pop ? "pop" : "apply") << stash;
|
||||
else
|
||||
arguments << QLatin1String("branch") << branch << stash;
|
||||
QByteArray outputText;
|
||||
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;
|
||||
return executeAndHandleConflicts(workingDirectory, arguments);
|
||||
}
|
||||
|
||||
bool GitClient::synchronousStashRemove(const QString &workingDirectory,
|
||||
|
||||
@@ -197,8 +197,7 @@ public:
|
||||
bool synchronousStashRestore(const QString &workingDirectory,
|
||||
const QString &stash,
|
||||
bool pop = false,
|
||||
const QString &branch = QString(),
|
||||
QString *errorMessage = 0);
|
||||
const QString &branch = QString());
|
||||
bool synchronousStashRemove(const QString &workingDirectory,
|
||||
const QString &stash = QString(),
|
||||
QString *errorMessage = 0);
|
||||
|
||||
@@ -323,12 +323,10 @@ void StashDialog::restoreCurrent()
|
||||
QString name = m_model->at(index).name;
|
||||
// Make sure repository is not modified, restore. The command will
|
||||
// output to window on success.
|
||||
const bool success = promptForRestore(&name, 0, &errorMessage)
|
||||
&& gitClient()->synchronousStashRestore(m_repository, name, false, QString(), &errorMessage);
|
||||
if (success) {
|
||||
if (promptForRestore(&name, 0, &errorMessage)
|
||||
&& gitClient()->synchronousStashRestore(m_repository, name)) {
|
||||
refresh(m_repository, true); // Might have stashed away local changes.
|
||||
} else {
|
||||
if (!errorMessage.isEmpty())
|
||||
} else if (!errorMessage.isEmpty()) {
|
||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||
}
|
||||
}
|
||||
@@ -340,13 +338,11 @@ void StashDialog::restoreCurrentInBranch()
|
||||
QString errorMessage;
|
||||
QString branch;
|
||||
QString name = m_model->at(index).name;
|
||||
const bool success = promptForRestore(&name, &branch, &errorMessage)
|
||||
&& gitClient()->synchronousStashRestore(m_repository, name, false, branch, &errorMessage);
|
||||
if (success) {
|
||||
if (promptForRestore(&name, &branch, &errorMessage)
|
||||
&& gitClient()->synchronousStashRestore(m_repository, name, false, branch)) {
|
||||
refresh(m_repository, true); // git deletes the stash, unfortunately.
|
||||
} else {
|
||||
if (!errorMessage.isEmpty())
|
||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||
} else if (!errorMessage.isEmpty()) {
|
||||
warning(msgRestoreFailedTitle(name), errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user