forked from qt-creator/qt-creator
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: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user