| 222 | } |
| 223 | |
| 224 | void DiffViewsCtrl::updateDiff(const QUrl& url, const RepoStatusModel::Areas area, const UpdateDiffParams p) |
| 225 | { |
| 226 | // If p == NoActivate and the url+area has no associated view |
| 227 | // return early |
| 228 | auto key = viewKey(url, area); |
| 229 | if (p == NoActivate && m_views.find(key) == m_views.end()) |
| 230 | return; |
| 231 | |
| 232 | if (auto* vcs = gitForUrl(url)) { |
| 233 | VcsRevision src, dst; |
| 234 | if (area == RepoStatusModel::Index || area == RepoStatusModel::IndexRoot) { |
| 235 | dst = VcsRevision::createSpecialRevision(VcsRevision::Working); |
| 236 | src = VcsRevision::createSpecialRevision(VcsRevision::Head); |
| 237 | src.setRevisionValue(QStringLiteral("HEAD"), VcsRevision::Special); |
| 238 | } else if (area == RepoStatusModel::WorkTree || area == RepoStatusModel::WorkTreeRoot) { |
| 239 | dst = VcsRevision::createSpecialRevision(VcsRevision::Base); |
| 240 | src = VcsRevision::createSpecialRevision(VcsRevision::Working); |
| 241 | } else |
| 242 | return; |
| 243 | VcsJob* job = nullptr; |
| 244 | if (area == RepoStatusModel::Index || area == RepoStatusModel::WorkTree) |
| 245 | job = vcs->diff(url, src, dst, IBasicVersionControl::NonRecursive); |
| 246 | else if (area == RepoStatusModel::IndexRoot || area == RepoStatusModel::WorkTreeRoot) |
| 247 | job = vcs->diff(url, src, dst); |
| 248 | if (job) { |
| 249 | job->setProperty("key", QVariant::fromValue<QString>(key)); |
| 250 | job->setProperty("url", QVariant::fromValue<QUrl>(url)); |
| 251 | job->setProperty("area", area); |
| 252 | job->setProperty("activate", p); |
| 253 | connect(job, &VcsJob::resultsReady, this, &DiffViewsCtrl::diffReady); |
| 254 | ICore::self()->runController()->registerJob(job); |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | void DiffViewsCtrl::updateProjectDiffs(KDevelop::IProject* proj) |
| 260 | { |
no test coverage detected