Commit be3e0438 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Git: Rename asyncCommand to vcsExecAbortable



This name makes it more clear what the method does.

Refactor to use VcsBaseClientImpl::vcsExec.

Change-Id: I4cf742c2b172d2589bd7d6740461e4a4c8d470ed
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent d45dea6c
......@@ -2935,34 +2935,36 @@ bool GitClient::canRebase(const QString &workingDirectory) const
void GitClient::rebase(const QString &workingDirectory, const QString &argument)
{
asyncCommand(workingDirectory, QStringList() << QLatin1String("rebase") << argument, true);
VcsCommand *command = vcsExecAbortable(workingDirectory,
QStringList() << QLatin1String("rebase") << argument);
GitProgressParser::attachToCommand(command);
}
void GitClient::cherryPick(const QString &workingDirectory, const QString &argument)
{
asyncCommand(workingDirectory, QStringList() << QLatin1String("cherry-pick") << argument);
vcsExecAbortable(workingDirectory, QStringList() << QLatin1String("cherry-pick") << argument);
}
void GitClient::revert(const QString &workingDirectory, const QString &argument)
{
asyncCommand(workingDirectory, QStringList() << QLatin1String("revert") << argument);
vcsExecAbortable(workingDirectory, QStringList() << QLatin1String("revert") << argument);
}
// Executes a command asynchronously. Work tree is expected to be clean.
// Stashing is handled prior to this call.
void GitClient::asyncCommand(const QString &workingDirectory, const QStringList &arguments,
bool hasProgress)
VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory,
const QStringList &arguments)
{
QTC_ASSERT(!arguments.isEmpty(), return 0);
QString abortCommand = arguments.at(0);
// Git might request an editor, so this must be done asynchronously
// and without timeout
QString gitCommand = arguments.first();
VcsOutputWindow::appendCommand(workingDirectory, vcsBinary(), arguments);
VcsCommand *command = createCommand(workingDirectory, 0, VcsWindowOutputBind);
ConflictHandler::attachToCommand(command, gitCommand);
if (hasProgress)
GitProgressParser::attachToCommand(command);
command->setCookie(workingDirectory);
enqueueJob(command, arguments);
VcsCommand *command = vcsExec(workingDirectory, arguments, 0, true, 0, workingDirectory);
// ... and without timeout
command->setDefaultTimeoutS(0);
ConflictHandler::attachToCommand(command, abortCommand);
return command;
}
bool GitClient::synchronousRevert(const QString &workingDirectory, const QString &commit)
......@@ -3004,7 +3006,8 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString
VcsOutputWindow::appendCommand(workingDirectory, vcsBinary(), arguments);
if (fixup)
m_disableEditor = true;
asyncCommand(workingDirectory, arguments, true);
VcsCommand *command = vcsExecAbortable(workingDirectory, arguments);
GitProgressParser::attachToCommand(command);
if (fixup)
m_disableEditor = false;
}
......
......@@ -143,6 +143,8 @@ public:
Utils::FileName vcsBinary() const override;
unsigned gitVersion(QString *errorMessage = 0) const;
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory, const QStringList &arguments);
QString findRepositoryForDirectory(const QString &dir) const;
QString findGitDirForRepository(const QString &repositoryDir) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
......@@ -266,8 +268,7 @@ public:
void rebase(const QString &workingDirectory, const QString &argument);
void cherryPick(const QString &workingDirectory, const QString &argument);
void revert(const QString &workingDirectory, const QString &argument);
void asyncCommand(const QString &workingDirectory, const QStringList &arguments,
bool hasProgress = false);
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment