forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user