aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clearcase/clearcaseplugin.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <[email protected]>2013-02-03 23:30:22 +0200
committerOrgad Shaneh <[email protected]>2013-02-07 09:21:16 +0100
commit75ef7e84f91668cd1425e97c46757921020c2346 (patch)
tree442b206b282a1ee19ac141bb1b17d2742cc3d61f /src/plugins/clearcase/clearcaseplugin.cpp
parenta35f37636930a9342bee378bf552040e97d64f8f (diff)
ClearCase: Support also ".view.dat" as repository root indicator
Change-Id: Iabae8151c3334dadb60e62258cb4f7d541335dda Reviewed-by: Knut Petter Svendsen <[email protected]> Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/clearcase/clearcaseplugin.cpp')
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 5d71a3698c6..2103324488a 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -118,6 +118,7 @@ static const char CMD_ID_UPDATEINDEX[] = "ClearCase.UpdateIndex";
static const char CMD_ID_UPDATE_VIEW[] = "ClearCase.UpdateView";
static const char CMD_ID_CHECKIN_ALL[] = "ClearCase.CheckInAll";
static const char CMD_ID_STATUS[] = "ClearCase.Status";
+static const char *CLEARCASE_ROOT_FILES[] = { "view.dat", ".view.dat" };
static const VcsBase::VcsBaseEditorParameters editorParameters[] = {
{
@@ -219,10 +220,27 @@ bool ClearCasePlugin::isCheckInEditorOpen() const
return !m_checkInMessageFileName.isEmpty();
}
+static QString ccFindRepositoryForDirectory(const QString &dirS)
+{
+ const QString home = QDir::homePath();
+
+ QDir directory(dirS);
+ do {
+ const QString absDirPath = directory.absolutePath();
+ if (directory.isRoot() || absDirPath == home)
+ break;
+
+ for (uint i = 0; i < sizeof(CLEARCASE_ROOT_FILES) / sizeof(*CLEARCASE_ROOT_FILES); ++i)
+ if (QFileInfo(directory, QLatin1String(CLEARCASE_ROOT_FILES[i])).isFile())
+ return absDirPath;
+ } while (directory.cdUp());
+ return QString();
+}
+
/*! Find top level for view that contains \a directory
*
- * - Snapshot Views will have the CLEARCASE_ROOT_FILE (view.dat) in its top dir
- * - Dynamic views can either be
+ * - Snapshot view has one of CLEARCASE_ROOT_FILES (view.dat or .view.dat) in its top dir
+ * - Dynamic view can either be
* - M:/view_name,
* - or mapped to a drive letter, like Z:/
* (drive letters are just examples)
@@ -235,7 +253,7 @@ QString ClearCasePlugin::findTopLevel(const QString &directory) const
// Snapshot view
QString topLevel =
- findRepositoryForDirectory(directory, QLatin1String(ClearCase::Constants::CLEARCASE_ROOT_FILE));
+ ccFindRepositoryForDirectory(directory);
if (!topLevel.isEmpty() || !clearCaseControl()->isConfigured())
return topLevel;