Commit 48fdbe24 authored by Knut Petter Svendsen's avatar Knut Petter Svendsen

ClearCase: Handle Derived Objects

Derived Objects (DO) should not be checked in or out. Ideally they should
not be edited at all, but in the case where a user by accident opens
a DO and it is read only do not offer to vcsOpen() the file.

Change-Id: I5aee9655ca8696c6d7291950946052261526c751
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 0bb76dc9
......@@ -256,16 +256,22 @@ FileStatus::Status ClearCasePlugin::getFileStatus(const QString &fileName) const
QString buffer = runCleartoolSync(viewRoot, args);
const int atatpos = buffer.indexOf(QLatin1String("@@"));
if (atatpos != -1) { // probably managed file
// find first whitespace. anything before that is not interesting
const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
if (atatpos != -1) { // probably a managed file
const QString absFile =
viewRootDir.absoluteFilePath(
QDir::fromNativeSeparators(buffer.left(atatpos)));
QTC_CHECK(QFile(absFile).exists());
QTC_CHECK(!absFile.isEmpty());
// "cleartool ls" of a derived object looks like this:
// /path/to/file/export/MyFile.h@@--11-13T19:52.266580
const QChar c = buffer.at(atatpos + 2);
const bool isDerivedObject = c != QLatin1Char('/') && c != QLatin1Char('\\');
if (isDerivedObject)
return FileStatus::Derived;
// find first whitespace. anything before that is not interesting
const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
return FileStatus::CheckedOut;
else
......@@ -1940,7 +1946,8 @@ bool ClearCasePlugin::ccCheckUcm(const QString &viewname, const QString &working
bool ClearCasePlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
{
QString absFile = QFileInfo(QDir(workingDirectory), fileName).absoluteFilePath();
return getFileStatus(absFile) != FileStatus::NotManaged;
const FileStatus::Status status = getFileStatus(absFile);
return status != FileStatus::NotManaged && status != FileStatus::Derived;
}
ViewData ClearCasePlugin::ccGetView(const QString &workingDir) const
......
......@@ -89,7 +89,8 @@ public:
CheckedOut = 0x02,
Hijacked = 0x04,
NotManaged = 0x08,
Missing = 0x10
Missing = 0x10,
Derived = 0x20
} status;
QFile::Permissions permissions;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment