ClearCase: Cache ccGetView

Used in vcsTopic, should avoid executing external tools as much as possible

Change-Id: I8100f50fb695cb0a8df7b09b99bdb90e029ad44a
Reviewed-by: Knut Petter Svendsen <knutpett@pvv.org>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2012-11-29 22:41:18 +02:00
committed by Tobias Hunger
parent 17a73005fc
commit 7127b38a1a

View File

@@ -1712,13 +1712,19 @@ bool ClearCasePlugin::ccCheckUcm(const QString &viewname, const QString &working
ViewData ClearCasePlugin::ccGetView(const QString &workingDir) const
{
ViewData res;
QStringList args(QLatin1String("lsview"));
args << QLatin1String("-cview");
QString data = runCleartoolSync(workingDir, args);
res.isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
res.name = data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
res.isUcm = ccCheckUcm(res.name, workingDir);
static QHash<QString, ViewData> viewCache;
bool inCache = viewCache.contains(workingDir);
ViewData &res = viewCache[workingDir];
if (!inCache) {
QStringList args(QLatin1String("lsview"));
args << QLatin1String("-cview");
QString data = runCleartoolSync(workingDir, args);
res.isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
res.name = data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
res.isUcm = ccCheckUcm(res.name, workingDir);
}
return res;
}