Commit d96535bd authored by Tobias Hunger's avatar Tobias Hunger
Browse files

VCS: Clear directory cache when availability of VCSes changes



We could have gotten new VCSes or existing ones might have gone,
so clear the cache of which VCS manages which directory.

Change-Id: I87a1b9c894e2867773ea4df221e463adb14f4ee9
Reviewed-by: default avatarPetar Perisin <petar.perisin@gmail.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 3a5597ec
......@@ -106,6 +106,11 @@ public:
return result;
}
void clearCache()
{
m_cachedMatches.clear();
}
void resetCache(const QString &dir)
{
QTC_ASSERT(QDir(dir).isAbsolute(), return);
......@@ -381,4 +386,12 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
}
}
void VcsManager::clearVersionControlCache()
{
QStringList repoList = d->m_cachedMatches.keys();
d->clearCache();
foreach (const QString &repo, repoList)
emit repositoryChanged(repo);
}
} // namespace Core
......@@ -95,6 +95,9 @@ public:
signals:
void repositoryChanged(const QString &repository);
public slots:
void clearVersionControlCache();
private:
VcsManagerPrivate *d;
};
......
......@@ -549,6 +549,9 @@ void VcsBasePlugin::initializeVcs(Core::IVersionControl *vc)
SIGNAL(stateChanged(VcsBase::Internal::State,Core::IVersionControl*)),
this,
SLOT(slotStateChanged(VcsBase::Internal::State,Core::IVersionControl*)));
// VCSes might have become (un-)available, so clear the VCS directory cache
connect(vc, SIGNAL(configurationChanged()),
Core::ICore::vcsManager(), SLOT(clearVersionControlCache()));
}
void VcsBasePlugin::extensionsInitialized()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment