aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clearcase/clearcaseplugin.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2013-04-11 18:27:52 +0200
committerEike Ziller <[email protected]>2013-04-11 18:27:52 +0200
commit9ff8979da32642e60029cb7cf8536eed6442c270 (patch)
tree4c1bb2288209c4c9b65408d7ec104747b278cd43 /src/plugins/clearcase/clearcaseplugin.cpp
parente6eb061293a63bf52fb34dc39016d0fa8bbbe12b (diff)
parent567098f210a7f73b98f02132a545bd5b5420e5a4 (diff)
Merge remote-tracking branch 'origin/2.7'
Conflicts: src/plugins/cpptools/cppchecksymbols.h src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp Change-Id: I887ba071fa637ad44e39bcae581738fa078a6612
Diffstat (limited to 'src/plugins/clearcase/clearcaseplugin.cpp')
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 04442011c01..2412ca1cc3b 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -555,21 +555,40 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const
return response.stdOut;
}
+//! Get a list of paths to active VOBs.
+//! Paths are relative to topLevel
QStringList ClearCasePlugin::ccGetActiveVobs() const
{
QStringList res;
QStringList args(QLatin1String("lsvob"));
- args << QLatin1String("-short");
- QString topLevel = currentState().topLevel();
+ const QString topLevel = currentState().topLevel();
const ClearCaseResponse response =
runCleartool(topLevel, args, m_settings.timeOutMS(), SilentRun);
if (response.error)
return res;
- foreach (QString dir, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) {
- dir = dir.mid(1); // omit first slash
- QFileInfo fi(topLevel, dir);
- if (fi.exists())
- res.append(dir);
+
+ // format of output unix:
+ // * /path/to/vob /path/to/vob/storage.vbs <and some text omitted here>
+ // format of output windows:
+ // * \vob \\share\path\to\vob\storage.vbs <and some text omitted here>
+ QString prefix = topLevel;
+ if (!prefix.endsWith(QLatin1Char('/')))
+ prefix += QLatin1Char('/');
+
+ foreach (const QString &line, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) {
+ const bool isActive = line.at(0) == QLatin1Char('*');
+ if (!isActive)
+ continue;
+
+ const QString dir =
+ QDir::fromNativeSeparators(line.mid(3, line.indexOf(QLatin1Char(' '), 3) - 3));
+ const QString relativeDir = QDir(topLevel).relativeFilePath(dir);
+
+ // Snapshot views does not necessarily have all active VOBs loaded, so we'll have to
+ // check if the dirs exists as well. Else the command will work, but the output will
+ // complain about the element not being loaded.
+ if (QFile::exists(prefix + relativeDir))
+ res.append(relativeDir);
}
return res;
}