aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clearcase/clearcaseplugin.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <[email protected]>2012-11-29 22:41:18 +0200
committerTobias Hunger <[email protected]>2012-11-30 11:15:08 +0100
commit7127b38a1acb50dc53c2b5d8414ac3ee0d81c97a (patch)
tree175d9e0eb1a84e4814f5c507327cfc893631d245 /src/plugins/clearcase/clearcaseplugin.cpp
parent17a73005fc1a73c2db18ae9814a08a97a840b28d (diff)
ClearCase: Cache ccGetView
Used in vcsTopic, should avoid executing external tools as much as possible Change-Id: I8100f50fb695cb0a8df7b09b99bdb90e029ad44a Reviewed-by: Knut Petter Svendsen <[email protected]> Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/clearcase/clearcaseplugin.cpp')
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index e54715173f9..27ac04307c0 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -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;
}