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);
|
const QString baseBranch = m_model->branchName(idx);
|
||||||
GitClient *client = GitPlugin::instance()->gitClient();
|
GitClient *client = GitPlugin::instance()->gitClient();
|
||||||
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
|
||||||
client->synchronousRebase(m_repository, baseBranch);
|
client->rebase(m_repository, baseBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex BranchDialog::selectedIndex()
|
QModelIndex BranchDialog::selectedIndex()
|
||||||
|
|||||||
@@ -2350,22 +2350,11 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory,
|
|||||||
synchronousAbortCommand(workingDirectory, gitCommand);
|
synchronousAbortCommand(workingDirectory, gitCommand);
|
||||||
break;
|
break;
|
||||||
default: // Continue/Skip
|
default: // Continue/Skip
|
||||||
if (isRebase) {
|
if (isRebase)
|
||||||
// Git might request an editor, so this must be done asynchronously
|
rebase(workingDirectory, QLatin1String(hasChanges ? "--continue" : "--skip"));
|
||||||
// and without timeout
|
else
|
||||||
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 {
|
|
||||||
GitPlugin::instance()->startCommit();
|
GitPlugin::instance()->startCommit();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quietly retrieve branch list of remote repository URL
|
// Quietly retrieve branch list of remote repository URL
|
||||||
@@ -2997,17 +2986,20 @@ bool GitClient::canRebase(const QString &workingDirectory) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousRebase(const QString &workingDirectory, const QString &baseBranch,
|
void GitClient::rebase(const QString &workingDirectory, const QString &baseBranch)
|
||||||
const QString &topicBranch)
|
|
||||||
{
|
{
|
||||||
QString command = QLatin1String("rebase");
|
// Git might request an editor, so this must be done asynchronously
|
||||||
|
// and without timeout
|
||||||
|
QString gitCommand = QLatin1String("rebase");
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
arguments << gitCommand << baseBranch;
|
||||||
arguments << command << baseBranch;
|
outputWindow()->appendCommand(workingDirectory,
|
||||||
if (!topicBranch.isEmpty())
|
settings()->stringValue(GitSettings::binaryPathKey),
|
||||||
arguments << topicBranch;
|
arguments);
|
||||||
|
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
|
||||||
return executeAndHandleConflicts(workingDirectory, arguments, command);
|
new ConflictHandler(command, workingDirectory, gitCommand);
|
||||||
|
command->addJob(arguments, -1);
|
||||||
|
command->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousRevert(const QString &workingDirectory, const QString &commit)
|
bool GitClient::synchronousRevert(const QString &workingDirectory, const QString &commit)
|
||||||
|
|||||||
@@ -240,9 +240,7 @@ public:
|
|||||||
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
|
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
|
||||||
bool synchronousMerge(const QString &workingDirectory, const QString &branch);
|
bool synchronousMerge(const QString &workingDirectory, const QString &branch);
|
||||||
bool canRebase(const QString &workingDirectory) const;
|
bool canRebase(const QString &workingDirectory) const;
|
||||||
bool synchronousRebase(const QString &workingDirectory,
|
void rebase(const QString &workingDirectory, const QString &baseBranch);
|
||||||
const QString &baseBranch,
|
|
||||||
const QString &topicBranch = QString());
|
|
||||||
bool synchronousRevert(const QString &workingDirectory, const QString &commit);
|
bool synchronousRevert(const QString &workingDirectory, const QString &commit);
|
||||||
bool synchronousCherryPick(const QString &workingDirectory, const QString &commit);
|
bool synchronousCherryPick(const QString &workingDirectory, const QString &commit);
|
||||||
void interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup);
|
void interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup);
|
||||||
|
|||||||
@@ -1149,13 +1149,13 @@ void GitPlugin::continueOrAbortCommand()
|
|||||||
if (action == m_abortMergeAction)
|
if (action == m_abortMergeAction)
|
||||||
m_gitClient->synchronousMerge(state.topLevel(), QLatin1String("--abort"));
|
m_gitClient->synchronousMerge(state.topLevel(), QLatin1String("--abort"));
|
||||||
else if (action == m_abortRebaseAction)
|
else if (action == m_abortRebaseAction)
|
||||||
m_gitClient->synchronousRebase(state.topLevel(), QLatin1String("--abort"));
|
m_gitClient->rebase(state.topLevel(), QLatin1String("--abort"));
|
||||||
else if (action == m_abortCherryPickAction)
|
else if (action == m_abortCherryPickAction)
|
||||||
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--abort"));
|
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--abort"));
|
||||||
else if (action == m_abortRevertAction)
|
else if (action == m_abortRevertAction)
|
||||||
m_gitClient->synchronousRevert(state.topLevel(), QLatin1String("--abort"));
|
m_gitClient->synchronousRevert(state.topLevel(), QLatin1String("--abort"));
|
||||||
else if (action == m_continueRebaseAction)
|
else if (action == m_continueRebaseAction)
|
||||||
m_gitClient->synchronousRebase(state.topLevel(), QLatin1String("--continue"));
|
m_gitClient->rebase(state.topLevel(), QLatin1String("--continue"));
|
||||||
else if (action == m_continueCherryPickAction)
|
else if (action == m_continueCherryPickAction)
|
||||||
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--continue"));
|
m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--continue"));
|
||||||
else if (action == m_continueRevertAction)
|
else if (action == m_continueRevertAction)
|
||||||
|
|||||||
Reference in New Issue
Block a user