forked from qt-creator/qt-creator
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 <orgads@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user