Version control: Improve detection.

Merge managesDirectory() and findTopLevelForDirectory()
into one giving managesDirectory() an optional topLevel
parameter. This removes the need to go up the directory
hierarchy twice when checking for Merurial or git and also
saves some checks for CVS/Subversion.
VCSManager: Check cache in reverse order starting out with
the full path first to improve handling of nested repositories.
Rubber-stamped-by: con
Acked-by: dt
This commit is contained in:
Friedemann Kleint
2010-05-20 16:24:39 +02:00
parent 58a5da63a8
commit 7003b82e2b
19 changed files with 157 additions and 157 deletions

View File

@@ -848,7 +848,20 @@ void PerforcePlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_updateAllAction->setEnabled(true);
}
bool PerforcePlugin::managesDirectory(const QString &directory)
bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */)
{
const bool rc = managesDirectoryFstat(directory);
if (topLevel) {
if (rc) {
*topLevel = m_settings.topLevelSymLinkTarget();
} else {
topLevel->clear();
}
}
return rc;
}
bool PerforcePlugin::managesDirectoryFstat(const QString &directory)
{
if (!m_settings.isValid())
return false;
@@ -875,13 +888,6 @@ bool PerforcePlugin::managesDirectory(const QString &directory)
return managed;
}
QString PerforcePlugin::findTopLevelForDirectory(const QString &dir)
{
if (!m_settings.isValid())
return QString();
return managesDirectory(dir) ? m_settings.topLevelSymLinkTarget() : QString();
}
bool PerforcePlugin::vcsOpen(const QString &workingDir, const QString &fileName)
{
if (Perforce::Constants::debug)