Changeset View
Changeset View
Standalone View
Standalone View
plugins/git/gitplugin.cpp
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Line(s) | |||||
346 | 346 | | |||
347 | VcsJob* GitPlugin::diff(const QUrl& fileOrDirectory, const KDevelop::VcsRevision& srcRevision, const KDevelop::VcsRevision& dstRevision, | 347 | VcsJob* GitPlugin::diff(const QUrl& fileOrDirectory, const KDevelop::VcsRevision& srcRevision, const KDevelop::VcsRevision& dstRevision, | ||
348 | VcsDiff::Type /*type*/, IBasicVersionControl::RecursionMode recursion) | 348 | VcsDiff::Type /*type*/, IBasicVersionControl::RecursionMode recursion) | ||
349 | { | 349 | { | ||
350 | //TODO: control different types | 350 | //TODO: control different types | ||
351 | 351 | | |||
352 | DVcsJob* job = new GitJob(dotGitDirectory(fileOrDirectory), this, KDevelop::OutputJob::Silent); | 352 | DVcsJob* job = new GitJob(dotGitDirectory(fileOrDirectory), this, KDevelop::OutputJob::Silent); | ||
353 | job->setType(VcsJob::Diff); | 353 | job->setType(VcsJob::Diff); | ||
354 | *job << "git" << "diff" << "--no-color" << "--no-ext-diff"; | 354 | *job << "git" << "diff" << "--no-color" << "--no-ext-diff" << "--full-index"; | ||
355 | if (!usePrefix()) { | 355 | if (!usePrefix()) { | ||
356 | // KDE's ReviewBoard now requires p1 patchfiles, so `git diff --no-prefix` to generate p0 patches | 356 | // KDE's ReviewBoard now requires p1 patchfiles, so `git diff --no-prefix` to generate p0 patches | ||
357 | // has become optional. | 357 | // has become optional. | ||
358 | *job << "--no-prefix"; | 358 | *job << "--no-prefix"; | ||
359 | } | 359 | } | ||
360 | if (m_contextLines > 0) { | ||||
361 | *job << QStringLiteral("-U%1").arg(m_contextLines); | ||||
362 | } | ||||
360 | if (dstRevision.revisionType() == VcsRevision::Special && | 363 | if (dstRevision.revisionType() == VcsRevision::Special && | ||
361 | dstRevision.specialType() == VcsRevision::Working) { | 364 | dstRevision.specialType() == VcsRevision::Working) { | ||
362 | if (srcRevision.revisionType() == VcsRevision::Special && | 365 | if (srcRevision.revisionType() == VcsRevision::Special && | ||
363 | srcRevision.specialType() == VcsRevision::Base) { | 366 | srcRevision.specialType() == VcsRevision::Base) { | ||
364 | *job << "HEAD"; | 367 | *job << "HEAD"; | ||
365 | } else { | 368 | } else { | ||
366 | *job << "--cached" << srcRevision.revisionValue().toString(); | 369 | *job << "--cached" << srcRevision.revisionValue().toString(); | ||
367 | } | 370 | } | ||
368 | } else { | 371 | } else { | ||
369 | QString revstr = revisionInterval(srcRevision, dstRevision); | 372 | QString revstr = revisionInterval(srcRevision, dstRevision); | ||
370 | if(!revstr.isEmpty()) | 373 | if(!revstr.isEmpty()) | ||
371 | *job << revstr; | 374 | *job << revstr; | ||
372 | } | 375 | } | ||
373 | 376 | | |||
374 | *job << "--"; | 377 | *job << "--"; | ||
375 | if (recursion == IBasicVersionControl::Recursive) { | 378 | if (recursion == IBasicVersionControl::Recursive) { | ||
376 | *job << fileOrDirectory; | 379 | *job << fileOrDirectory; | ||
377 | } else { | 380 | } else { | ||
378 | *job << preventRecursion(QList<QUrl>() << fileOrDirectory); | 381 | *job << preventRecursion(QList<QUrl>() << fileOrDirectory); | ||
379 | } | 382 | } | ||
383 | qWarning() << "git diff job:" << job->dvcsCommand(); | ||||
380 | 384 | | |||
381 | connect(job, &DVcsJob::readyForParsing, this, &GitPlugin::parseGitDiffOutput); | 385 | connect(job, &DVcsJob::readyForParsing, this, &GitPlugin::parseGitDiffOutput); | ||
382 | return job; | 386 | return job; | ||
383 | } | 387 | } | ||
384 | 388 | | |||
385 | VcsJob* GitPlugin::revert(const QList<QUrl>& localLocations, IBasicVersionControl::RecursionMode recursion) | 389 | VcsJob* GitPlugin::revert(const QList<QUrl>& localLocations, IBasicVersionControl::RecursionMode recursion) | ||
386 | { | 390 | { | ||
387 | if(localLocations.isEmpty() ) | 391 | if(localLocations.isEmpty() ) | ||
▲ Show 20 Lines • Show All 1130 Lines • Show Last 20 Lines |