Utils: Use CommandLine in ShellCommand

... and adapt users.

Change-Id: I218523ffe34720d5fe199aa0ca6892a8dc2985fc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2019-06-07 15:27:50 +02:00
parent 749eaaad81
commit 00b692e67e
29 changed files with 78 additions and 90 deletions

View File

@@ -315,7 +315,7 @@ void QueryContext::start()
m_progress.reportStarted();
// Order: synchronous call to error handling if something goes wrong.
VcsOutputWindow::appendCommand(
m_process.workingDirectory(), Utils::FilePath::fromString(m_binary), m_arguments);
m_process.workingDirectory(), {Utils::FilePath::fromString(m_binary), m_arguments});
m_timer.start();
m_process.start(m_binary, m_arguments);
m_process.closeWriteChannel();

View File

@@ -170,7 +170,7 @@ void FetchContext::start()
m_progress.reportStarted();
// Order: initialize future before starting the process in case error handling is invoked.
const QStringList args = m_change->gitFetchArguments(m_server);
VcsBase::VcsOutputWindow::appendCommand(m_repository, m_git, args);
VcsBase::VcsOutputWindow::appendCommand(m_repository, {m_git, args});
m_process.start(m_git.toString(), args);
m_process.closeWriteChannel();
}

View File

@@ -243,7 +243,7 @@ int GerritServer::testConnection()
static GitClient *const client = GitPlugin::client();
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), FilePath::fromString(curlBinary), arguments,
QString(), {FilePath::fromString(curlBinary), arguments},
Core::ShellCommand::NoOutput);
if (resp.result == SynchronousProcessResponse::Finished) {
QString output = resp.stdOut();
@@ -345,7 +345,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
arguments << p.portFlag << QString::number(port);
arguments << hostArgument() << "gerrit" << "version";
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), FilePath::fromString(p.ssh), arguments,
QString(), {FilePath::fromString(p.ssh), arguments},
Core::ShellCommand::NoOutput);
QString stdOut = resp.stdOut().trimmed();
stdOut.remove("gerrit version ");
@@ -353,7 +353,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
} else {
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), FilePath::fromString(curlBinary), arguments,
QString(), {FilePath::fromString(curlBinary), arguments},
Core::ShellCommand::NoOutput);
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid
// if it fails.

View File

@@ -2421,7 +2421,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs()));
if (!fileName.isEmpty())
arguments << "--" << fileName;
VcsOutputWindow::appendCommand(workingDirectory, FilePath::fromString(binary), arguments);
VcsOutputWindow::appendCommand(workingDirectory, {FilePath::fromString(binary), arguments});
// This should always use QProcess::startDetached (as not to kill
// the child), but that does not have an environment parameter.
bool success = false;
@@ -3147,7 +3147,7 @@ VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory,
| VcsCommand::ShowSuccessMessage);
// For rebase, Git might request an editor (which means the process keeps running until the
// user closes it), so run without timeout.
command->addJob(vcsBinary(), arguments, isRebase ? 0 : command->defaultTimeoutS());
command->addJob({vcsBinary(), arguments}, isRebase ? 0 : command->defaultTimeoutS());
ConflictHandler::attachToCommand(command, abortCommand);
if (isRebase)
GitProgressParser::attachToCommand(command);

View File

@@ -196,7 +196,7 @@ public:
connect(&watcher, &QFutureWatcher<FileSearchResultList>::canceled,
command.data(), &VcsCommand::cancel);
connect(command.data(), &VcsCommand::stdOutText, this, &GitGrepRunner::read);
SynchronousProcessResponse resp = command->runCommand(client->vcsBinary(), arguments, 0);
SynchronousProcessResponse resp = command->runCommand({client->vcsBinary(), arguments}, 0);
switch (resp.result) {
case SynchronousProcessResponse::TerminatedAbnormally:
case SynchronousProcessResponse::StartFailed:

View File

@@ -159,7 +159,7 @@ Core::ShellCommand *GitVersionControl::createInitialCheckoutCommand(const QStrin
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_client->processEnvironment());
command->addFlags(VcsBase::VcsCommand::SuppressStdErr);
command->addJob(m_client->vcsBinary(), args, -1);
command->addJob({m_client->vcsBinary(), args}, -1);
return command;
}

View File

@@ -62,7 +62,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
m_process->setProcessEnvironment(env);
m_process->setProcessChannelMode(QProcess::MergedChannels);
const Utils::FilePath binary = GitPlugin::client()->vcsBinary();
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
VcsOutputWindow::appendCommand(workingDirectory, {binary, arguments});
m_process->start(binary.toString(), arguments);
if (m_process->waitForStarted()) {
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),