forked from qt-creator/qt-creator
ClearCase: Fixed get active VOBs
The correct way to check if a VOB is active (mounted) is to check for a "*" in the output of "cleartool lsvob". On windows a directory for each active VOB exists under topLevel, but this is not true for unix where directories (mount points) for all VOBs exists always. Change-Id: Iccb0e38a39dfcae72326d68b9ff43b2555187f6c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
6d3e0fbd04
commit
567098f210
@@ -555,21 +555,40 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const
|
|||||||
return response.stdOut;
|
return response.stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Get a list of paths to active VOBs.
|
||||||
|
//! Paths are relative to topLevel
|
||||||
QStringList ClearCasePlugin::ccGetActiveVobs() const
|
QStringList ClearCasePlugin::ccGetActiveVobs() const
|
||||||
{
|
{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
QStringList args(QLatin1String("lsvob"));
|
QStringList args(QLatin1String("lsvob"));
|
||||||
args << QLatin1String("-short");
|
const QString topLevel = currentState().topLevel();
|
||||||
QString topLevel = currentState().topLevel();
|
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(topLevel, args, m_settings.timeOutMS(), SilentRun);
|
runCleartool(topLevel, args, m_settings.timeOutMS(), SilentRun);
|
||||||
if (response.error)
|
if (response.error)
|
||||||
return res;
|
return res;
|
||||||
foreach (QString dir, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) {
|
|
||||||
dir = dir.mid(1); // omit first slash
|
// format of output unix:
|
||||||
QFileInfo fi(topLevel, dir);
|
// * /path/to/vob /path/to/vob/storage.vbs <and some text omitted here>
|
||||||
if (fi.exists())
|
// format of output windows:
|
||||||
res.append(dir);
|
// * \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;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user