forked from qt-creator/qt-creator
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 <orgads@gmail.com>
This commit is contained in:
@@ -256,16 +256,22 @@ FileStatus::Status ClearCasePlugin::getFileStatus(const QString &fileName) const
|
|||||||
QString buffer = runCleartoolSync(viewRoot, args);
|
QString buffer = runCleartoolSync(viewRoot, args);
|
||||||
|
|
||||||
const int atatpos = buffer.indexOf(QLatin1String("@@"));
|
const int atatpos = buffer.indexOf(QLatin1String("@@"));
|
||||||
if (atatpos != -1) { // probably managed file
|
if (atatpos != -1) { // probably a managed file
|
||||||
// find first whitespace. anything before that is not interesting
|
|
||||||
const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
|
|
||||||
const QString absFile =
|
const QString absFile =
|
||||||
viewRootDir.absoluteFilePath(
|
viewRootDir.absoluteFilePath(
|
||||||
QDir::fromNativeSeparators(buffer.left(atatpos)));
|
QDir::fromNativeSeparators(buffer.left(atatpos)));
|
||||||
|
|
||||||
QTC_CHECK(QFile(absFile).exists());
|
QTC_CHECK(QFile(absFile).exists());
|
||||||
QTC_CHECK(!absFile.isEmpty());
|
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)
|
if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
|
||||||
return FileStatus::CheckedOut;
|
return FileStatus::CheckedOut;
|
||||||
else
|
else
|
||||||
@@ -1940,7 +1946,8 @@ bool ClearCasePlugin::ccCheckUcm(const QString &viewname, const QString &working
|
|||||||
bool ClearCasePlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
|
bool ClearCasePlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||||
{
|
{
|
||||||
QString absFile = QFileInfo(QDir(workingDirectory), fileName).absoluteFilePath();
|
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
|
ViewData ClearCasePlugin::ccGetView(const QString &workingDir) const
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ public:
|
|||||||
CheckedOut = 0x02,
|
CheckedOut = 0x02,
|
||||||
Hijacked = 0x04,
|
Hijacked = 0x04,
|
||||||
NotManaged = 0x08,
|
NotManaged = 0x08,
|
||||||
Missing = 0x10
|
Missing = 0x10,
|
||||||
|
Derived = 0x20
|
||||||
} status;
|
} status;
|
||||||
|
|
||||||
QFile::Permissions permissions;
|
QFile::Permissions permissions;
|
||||||
|
|||||||
Reference in New Issue
Block a user