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

Method updateCommit

3rdparty/unioncode-GitQlient/src/cache/GitCache.cpp:348–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void GitCache::updateCommit(const QString &oldSha, CommitInfo newCommit)
349{
350 QMutexLocker lock(&mCommitsMutex);
351 QMutexLocker lock2(&mRevisionsMutex);
352
353 auto &oldCommit = mCommitsMap[oldSha];
354 const auto oldCommitParens = oldCommit.parents();
355 const auto newCommitSha = newCommit.sha;
356
357 mCommitsMap.remove(oldSha);
358 mCommitsMap.insert(newCommitSha, std::move(newCommit));
359 mCommits[1] = &mCommitsMap[newCommitSha];
360
361 for (const auto &parent : oldCommitParens)
362 {
363 mCommitsMap[parent].removeChild(&oldCommit);
364 mCommitsMap[parent].appendChild(&mCommitsMap[newCommitSha]);
365 }
366
367 const auto tags = getReferences(oldSha, References::Type::LocalTag);
368 for (const auto &tag : tags)
369 {
370 insertReference(newCommitSha, References::Type::LocalTag, tag);
371 deleteReference(oldSha, References::Type::LocalTag, tag);
372 }
373
374 const auto localBranches = getReferences(oldSha, References::Type::LocalBranch);
375 for (const auto &branch : localBranches)
376 {
377 insertReference(newCommitSha, References::Type::LocalBranch, branch);
378 deleteReference(oldSha, References::Type::LocalBranch, branch);
379 }
380}
381
382void GitCache::calculateLanes(CommitInfo &c)
383{

Callers 1

commitChangesMethod · 0.80

Calls 5

parentsMethod · 0.80
insertMethod · 0.80
removeChildMethod · 0.80
removeMethod · 0.45
appendChildMethod · 0.45

Tested by

no test coverage detected