forked from qt-creator/qt-creator
Git: Execute rebase asynchronously
Rebase --continue might request an editor, which hangs if run synchronously Change-Id: I28127884408f6f8fbd351bb1024dc8d3c2b339b8 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
fc2a5d7f50
commit
096daac0bd
@@ -303,7 +303,7 @@ void BranchDialog::rebase()
|
||||
const QString baseBranch = m_model->branchName(idx);
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
||||
client->synchronousRebase(m_repository, baseBranch);
|
||||
client->rebase(m_repository, baseBranch);
|
||||
}
|
||||
|
||||
QModelIndex BranchDialog::selectedIndex()
|
||||
|
||||
@@ -2350,21 +2350,10 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
|
||||
synchronousAbortCommand(workingDirectory, gitCommand);
|
||||
break;
|
||||
default: // Continue/Skip
|
||||
if (isRebase) {
|
||||
// Git might request an editor, so this must be done asynchronously
|
||||
// and without timeout
|
||||
QStringList arguments;
|
||||
arguments << gitCommand << QLatin1String(hasChanges ? "--continue" : "--skip");
|
||||
outputWindow()->appendCommand(workingDirectory,
|
||||
settings()->stringValue(GitSettings::binaryPathKey),
|
||||
arguments);
|
||||
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
|
||||
new ConflictHandler(command, workingDirectory, gitCommand);
|
||||
command->addJob(arguments, -1);
|
||||
command->execute();
|
||||
} else {
|
||||
if (isRebase)
|
||||
rebase(workingDirectory, QLatin1String(hasChanges ? "--continue" : "--skip"));
|
||||
else
|
||||
GitPlugin::instance()->startCommit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2997,17 +2986,20 @@ bool GitClient::canRebase(const QString &workingDirectory) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousRebase(const QString &workingDirectory, const QString &baseBranch,
|
||||
const QString &topicBranch)
|
||||
void GitClient::rebase(const QString &workingDirectory, const QString &baseBranch)
|
||||
{
|
||||
QString command = QLatin1String("rebase");
|
||||
// Git might request an editor, so this must be done asynchronously
|
||||
// and without timeout
|
||||
QString gitCommand = QLatin1String("rebase");
|
||||
QStringList arguments;
|
||||
|
||||
arguments << command << baseBranch;
|
||||
if (!topicBranch.isEmpty())
|
||||
arguments << topicBranch;
|
||||
|
||||
return executeAndHandleConflicts(workingDirectory, arguments, command);
|
||||
arguments << gitCommand << baseBranch;
|
||||
outputWindow()->appendCommand(workingDirectory,
|
||||
settings()->stringValue(GitSettings::binaryPathKey),
|
||||
arguments);
|
||||
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
|
||||
new ConflictHandler(command, workingDirectory, gitCommand);
|
||||
command->addJob(arguments, -1);
|
||||
command->execute();
|
||||
}
|
||||
|
||||
bool GitClient::synchronousRevert(const QString &workingDirectory, const QString &commit)
|
||||
|
||||
@@ -240,9 +240,7 @@ public:
|
||||
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
|
||||
bool synchronousMerge(const QString &workingDirectory, const QString &branch);
|
||||
bool canRebase(const QString &workingDirectory) const;
|
||||
bool synchronousRebase(const QString &workingDirectory,
|
||||
const QString &baseBranch,
|
||||
const QString &topicBranch = QString());
|
||||
void rebase(const QString &workingDirectory, const QString &baseBranch);
|
||||
bool synchronousRevert(const QString &workingDirectory, const QString &commit);
|
||||
bool synchronousCherryPick(const QString &workingDirectory, const QString &commit);
|
||||
void interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup);
|
||||
|
||||
@@ -1149,13 +1149,13 @@ void GitPlugin::continueOrAbortCommand()
|
||||
if (action == m_abortMergeAction)
|
||||
m_gitClient->synchronousMerge(state.topLevel(), QLatin1String("--abort"));
|
||||
else if (action == m_abortRebaseAction)
|
||||
m_gitClient->synchronousRebase(state.topLevel(), QLatin1String("--abort"));
|
||||
m_gitClient->rebase(state.topLevel(), QLatin1String("--abort"));
|
||||
else if (action == m_abortCherryPickAction)
|
||||
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--abort"));
|
||||
else if (action == m_abortRevertAction)
|
||||
m_gitClient->synchronousRevert(state.topLevel(), QLatin1String("--abort"));
|
||||
else if (action == m_continueRebaseAction)
|
||||
m_gitClient->synchronousRebase(state.topLevel(), QLatin1String("--continue"));
|
||||
m_gitClient->rebase(state.topLevel(), QLatin1String("--continue"));
|
||||
else if (action == m_continueCherryPickAction)
|
||||
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--continue"));
|
||||
else if (action == m_continueRevertAction)
|
||||
|
||||
Reference in New Issue
Block a user