forked from qt-creator/qt-creator
Git: Suggest continuing rebase after conflicts are resolved
Change-Id: Icf74397ee7a3cedd7e46c63777832e1fc9f46033 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
099345d110
commit
3e9f2d688c
@@ -2036,11 +2036,8 @@ bool GitClient::synchronousFetch(const QString &workingDirectory, const QString
|
||||
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
bool GitClient::synchronousPullOrRebase(const QString &workingDirectory, const QStringList &arguments, bool rebase)
|
||||
{
|
||||
QStringList arguments(QLatin1String("pull"));
|
||||
if (rebase)
|
||||
arguments << QLatin1String("--rebase");
|
||||
// Disable UNIX terminals to suppress SSH prompting.
|
||||
const unsigned flags = VcsBase::VcsBasePlugin::SshPasswordPrompt|VcsBase::VcsBasePlugin::ShowStdOutInLogWindow;
|
||||
const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
||||
@@ -2053,6 +2050,21 @@ bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
{
|
||||
QStringList arguments(QLatin1String("pull"));
|
||||
if (rebase)
|
||||
arguments << QLatin1String("--rebase");
|
||||
return synchronousPullOrRebase(workingDirectory, arguments, rebase);
|
||||
}
|
||||
|
||||
bool GitClient::synchronousRebaseContinue(const QString &workingDirectory)
|
||||
{
|
||||
QStringList arguments(QLatin1String("rebase"));
|
||||
arguments << QLatin1String("--continue");
|
||||
return synchronousPullOrRebase(workingDirectory, arguments, true);
|
||||
}
|
||||
|
||||
void GitClient::handleMergeConflicts(const QString &workingDir, bool rebase)
|
||||
{
|
||||
QMessageBox mergeOrAbort(QMessageBox::Question, tr("Conflicts detected"),
|
||||
|
||||
@@ -168,6 +168,7 @@ public:
|
||||
QString vcsGetRepositoryURL(const QString &directory);
|
||||
bool synchronousFetch(const QString &workingDirectory, const QString &remote);
|
||||
bool synchronousPull(const QString &workingDirectory, bool rebase);
|
||||
bool synchronousRebaseContinue(const QString &workingDirectory);
|
||||
bool synchronousPush(const QString &workingDirectory, const QString &remote = QString());
|
||||
|
||||
// git svn support (asynchronous).
|
||||
@@ -284,6 +285,7 @@ private:
|
||||
QString *errorMessage,
|
||||
bool revertStaging);
|
||||
void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd);
|
||||
bool synchronousPullOrRebase(const QString &workingDirectory, const QStringList &arguments, bool rebase);
|
||||
void handleMergeConflicts(const QString &workingDir, bool rebase);
|
||||
bool tryLauchingGitK(const QProcessEnvironment &env,
|
||||
const QString &workingDirectory,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
@@ -257,10 +258,21 @@ void MergeTool::done()
|
||||
{
|
||||
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
|
||||
int exitCode = m_process->exitCode();
|
||||
if (!exitCode)
|
||||
if (!exitCode) {
|
||||
outputWindow->append(tr("Merge tool process finished successully"));
|
||||
else
|
||||
QString workingDirectory = m_process->workingDirectory();
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
QString gitDir = client->findGitDirForRepository(workingDirectory);
|
||||
if (QFile::exists(gitDir + QLatin1String("/rebase-apply/rebasing"))) {
|
||||
if (QMessageBox::question(0, tr("Continue Rebase"),
|
||||
tr("Continue rebase?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
||||
client->synchronousRebaseContinue(workingDirectory);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outputWindow->append(tr("Merge tool process terminated with exit code %1").arg(exitCode));
|
||||
}
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user