GitClient: Replace rev-list command with QtcProcess

There is no need to use VcsCommand when NoOutput is passed.
Get rid of asyncUpstreamStatus().

Change-Id: Iae6869be9640c7662545906d28314ac47cd69e3d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-09-01 16:42:54 +02:00
parent 28fdeefe6f
commit 4e74e2aa03
3 changed files with 14 additions and 15 deletions

View File

@@ -8,8 +8,10 @@
#include <vcsbase/vcscommand.h>
#include <vcsbase/vcsoutputwindow.h>
#include <utils/environment.h>
#include <utils/filesystemwatcher.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
#include <QDateTime>
@@ -886,9 +888,17 @@ void BranchModel::updateUpstreamStatus(BranchNode *node)
{
if (node->tracking.isEmpty())
return;
VcsCommand *command = d->client->asyncUpstreamStatus(
d->workingDirectory, node->fullRef(), node->tracking);
QObject::connect(command, &VcsCommand::stdOutText, node, [this, node](const QString &text) {
QtcProcess *process = new QtcProcess(node);
process->setEnvironment(d->client->processEnvironment());
process->setCommand({d->client->vcsBinary(), {"rev-list", "--no-color", "--left-right",
"--count", node->fullRef() + "..." + node->tracking}});
process->setWorkingDirectory(d->workingDirectory);
connect(process, &QtcProcess::done, this, [this, process, node] {
process->deleteLater();
if (process->result() != ProcessResult::FinishedWithSuccess)
return;
const QString text = process->cleanedStdOut();
if (text.isEmpty())
return;
const QStringList split = text.trimmed().split('\t');
@@ -898,6 +908,7 @@ void BranchModel::updateUpstreamStatus(BranchNode *node)
const QModelIndex idx = nodeToIndex(node, ColumnBranch);
emit dataChanged(idx, idx);
});
process->start();
}
QString BranchModel::toolTip(const QString &sha) const