Vcs: Hide topic cache in new IVersionControl pimpl

Potentially more stable api long-term. Also simplifies the
user side code a bit.

Change-Id: I6913e27e2a5dc14907e72f252081cdbed34842a3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2024-02-07 16:13:22 +01:00
parent 5a643b1c0a
commit 0b44cc5589
6 changed files with 134 additions and 176 deletions

View File

@@ -382,25 +382,6 @@ public:
static GitPluginPrivate *dd = nullptr;
class GitTopicCache : public IVersionControl::TopicCache
{
public:
GitTopicCache() {}
protected:
FilePath trackFile(const FilePath &repository) override
{
const FilePath gitDir = gitClient().findGitDirForRepository(repository);
return gitDir.isEmpty() ? FilePath() : gitDir / "HEAD";
}
QString refreshTopic(const FilePath &repository) override
{
emit dd->repositoryChanged(repository);
return gitClient().synchronousTopic(repository);
}
};
GitPluginPrivate::~GitPluginPrivate()
{
cleanCommitMessageFile();
@@ -560,7 +541,14 @@ GitPluginPrivate::GitPluginPrivate()
{
dd = this;
setTopicCache(new GitTopicCache);
setTopicFileTracker([](const FilePath &repository) {
const FilePath gitDir = gitClient().findGitDirForRepository(repository);
return gitDir.isEmpty() ? FilePath() : gitDir / "HEAD";
});
setTopicRefresher([this](const FilePath &repository) {
emit repositoryChanged(repository);
return gitClient().synchronousTopic(repository);
});
m_fileActions.reserve(10);
m_projectActions.reserve(10);