MCPcopy Create free account
hub / github.com/KDE/kdevelop / initBranchHash

Method initBranchHash

plugins/git/gitplugin.cpp:1206–1238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204}
1205
1206void GitPlugin::initBranchHash(const QString &repo)
1207{
1208 const QUrl repoUrl = QUrl::fromLocalFile(repo);
1209 const QStringList gitBranches = runSynchronously(branches(repoUrl)).toStringList();
1210 qCDebug(PLUGIN_GIT) << "BRANCHES: " << gitBranches;
1211 //Now root branch is the current branch. In future it should be the longest branch
1212 //other commitLists are got with git-rev-lits branch ^br1 ^ br2
1213 QString root = runSynchronously(currentBranch(repoUrl)).toString();
1214 QScopedPointer<DVcsJob> job(gitRevList(repo, QStringList(root)));
1215 bool ret = job->exec();
1216 Q_ASSERT(ret && job->status()==VcsJob::JobSucceeded && "TODO: provide a fall back in case of failing");
1217 Q_UNUSED(ret);
1218 const QStringList commits = job->output().split(QLatin1Char('\n'), Qt::SkipEmptyParts);
1219 // qCDebug(PLUGIN_GIT) << "\n\n\n commits" << commits << "\n\n\n";
1220 branchesShas.append(commits);
1221 for (const QString& branch : gitBranches) {
1222 if (branch == root)
1223 continue;
1224 QStringList args(branch);
1225 for (const QString& branch_arg : gitBranches) {
1226 if (branch_arg != branch)
1227 //man gitRevList for '^'
1228 args << QLatin1Char('^') + branch_arg;
1229 }
1230 QScopedPointer<DVcsJob> job(gitRevList(repo, args));
1231 bool ret = job->exec();
1232 Q_ASSERT(ret && job->status()==VcsJob::JobSucceeded && "TODO: provide a fall back in case of failing");
1233 Q_UNUSED(ret);
1234 const QStringList commits = job->output().split(QLatin1Char('\n'), Qt::SkipEmptyParts);
1235 // qCDebug(PLUGIN_GIT) << "\n\n\n commits" << commits << "\n\n\n";
1236 branchesShas.append(commits);
1237 }
1238}
1239
1240//Actually we can just copy the output without parsing. So it's a kind of draft for future
1241void GitPlugin::parseLogOutput(const DVcsJob* job, QVector<DVcsEvent>& commits) const

Callers

nothing calls this directly

Calls 9

QStringListClass · 0.85
execMethod · 0.80
outputMethod · 0.80
runSynchronouslyFunction · 0.70
toStringListMethod · 0.45
toStringMethod · 0.45
statusMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected