ClearCase: Fix: Status actions was not correct for unix

A set view on unix will get / as topLevel. The output of
"cleartool -ls" with / as topLevel listed files with absolute path,
while with relative path for the the other cases (working directory
view and on windows). Root as topLevel is not 100% correct and should
be fixed in another patch. However, this patch fixes an annoying bug
for unix. (Before this patch multiple entries for the same file was
inserted in the status map - one with relative path and one with
absolute. Resulting in wrong lookup in updateStatusActions and thus
wrong status on the active file.

Change-Id: I178bafd21d712a445aca8e60ae3346549b55faaf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Knut Petter Svendsen
2013-04-02 13:10:07 +02:00
parent f172818588
commit 91fe5f84d9

View File

@@ -114,21 +114,21 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
if (atatpos != -1) { // probably managed file if (atatpos != -1) { // probably managed file
// find first whitespace. anything before that is not interesting // find first whitespace. anything before that is not interesting
int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s"))); int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
const QString file = QDir::fromNativeSeparators(buffer.left(atatpos)); const QString relFile = topLevelDir.relativeFilePath(QDir::fromNativeSeparators(buffer.left(atatpos)));
QString ccState; QString ccState;
QRegExp reState(QLatin1String("^\\s*\\[[^\\]]*\\]")); // [hijacked]; [loaded but missing] QRegExp reState(QLatin1String("^\\s*\\[[^\\]]*\\]")); // [hijacked]; [loaded but missing]
if (reState.indexIn(buffer, wspos + 1, QRegExp::CaretAtOffset) != -1) { if (reState.indexIn(buffer, wspos + 1, QRegExp::CaretAtOffset) != -1) {
ccState = reState.cap(); ccState = reState.cap();
if (ccState.indexOf(QLatin1String("hijacked")) != -1) if (ccState.indexOf(QLatin1String("hijacked")) != -1)
m_plugin->setStatus(file, FileStatus::Hijacked, true); m_plugin->setStatus(relFile, FileStatus::Hijacked, true);
else if (ccState.indexOf(QLatin1String("loaded but missing")) != -1) else if (ccState.indexOf(QLatin1String("loaded but missing")) != -1)
m_plugin->setStatus(file, FileStatus::Missing, false); m_plugin->setStatus(relFile, FileStatus::Missing, false);
} }
else if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1) else if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
m_plugin->setStatus(file, FileStatus::CheckedOut, true); m_plugin->setStatus(relFile, FileStatus::CheckedOut, true);
// don't care about checked-in files not listed in project // don't care about checked-in files not listed in project
else if (m_statusMap->contains(file)) else if (m_statusMap->contains(relFile))
m_plugin->setStatus(file, FileStatus::CheckedIn, true); m_plugin->setStatus(relFile, FileStatus::CheckedIn, true);
} }
buffer.clear(); buffer.clear();
future.setProgressValue(qMin(total, ++processed)); future.setProgressValue(qMin(total, ++processed));