MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / configure

Method configure

3rdparty/unioncode-GitQlient/src/commits/AmendWidget.cpp:25–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void AmendWidget::configure(const QString &sha)
26{
27 const auto commit = mCache->commitInfo(sha);
28
29 ui->amendFrame->setVisible(true);
30 ui->warningButton->setVisible(true);
31
32 if (commit.parentsCount() <= 0)
33 return;
34
35 QScopedPointer<GitWip> git(new GitWip(mGit, mCache));
36 git->updateWip();
37
38 const auto files = mCache->revisionFile(CommitInfo::ZERO_SHA, sha);
39 auto amendFiles = mCache->revisionFile(sha, commit.firstParent());
40
41 if (!amendFiles)
42 {
43 QScopedPointer<GitHistory> git(new GitHistory(mGit));
44 const auto ret = git->getDiffFiles(mCurrentSha, commit.firstParent());
45
46 if (ret.success)
47 {
48 amendFiles = RevisionFiles(ret.output);
49 mCache->insertRevisionFiles(mCurrentSha, commit.firstParent(), amendFiles.value());
50 }
51 }
52
53 if (mCurrentSha != sha)
54 {
55 QLog_Info("UI", QString("Amending sha {%1}.").arg(mCurrentSha));
56
57 mCurrentSha = sha;
58
59 const auto author = commit.author.split("<");
60 ui->leAuthorName->setText(author.first());
61 ui->leAuthorEmail->setText(author.last().mid(0, author.last().count() - 1));
62 ui->teDescription->setPlainText(commit.longLog.trimmed());
63 ui->leCommitTitle->setText(commit.shortLog);
64
65 blockSignals(true);
66 ui->unstagedFilesList->clear();
67 ui->stagedFilesList->clear();
68 mInternalCache.clear();
69 blockSignals(false);
70
71 if (files)
72 insertFiles(files.value(), ui->unstagedFilesList);
73
74 if (amendFiles)
75 insertFiles(amendFiles.value(), ui->stagedFilesList);
76 }
77 else
78 {
79 QLog_Info("UI", QString("Updating files for SHA {%1}").arg(mCurrentSha));
80
81 prepareCache();
82

Callers

nothing calls this directly

Calls 15

commitInfoMethod · 0.80
setVisibleMethod · 0.80
parentsCountMethod · 0.80
revisionFileMethod · 0.80
firstParentMethod · 0.80
getDiffFilesMethod · 0.80
insertRevisionFilesMethod · 0.80
RevisionFilesClass · 0.70
QStringClass · 0.50
updateWipMethod · 0.45
valueMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected