Commit 67ac492c authored by Jonathan Liu's avatar Jonathan Liu Committed by Tobias Hunger

SVN: Fix handling of svn:externals for Subversion 1.7

Change-Id: I3f869fd316d2f2a3a41c622321cebb79575c423f
Merge-request: 409
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 5442a91f
......@@ -1370,7 +1370,22 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
if (topLevel)
topLevel->clear();
bool manages = false;
// Subversion >= 1.7: Check for furthest parent containing
// ".svn/wc.db". Need to check for furthest parent as closer
// parents may be svn:externals.
if (dir.exists()) {
QDir parentDir = dir;
while (parentDir.cdUp()) {
if (checkSVNSubDir(parentDir, QLatin1String("wc.db"))) {
manages = true;
if (topLevel)
*topLevel = parentDir.absolutePath();
}
}
}
do {
if (manages)
break;
if (!dir.exists() || !checkSVNSubDir(dir))
break;
manages = true;
......@@ -1387,18 +1402,6 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
}
}
} while (false);
// Subversion >= 1.7: Check for first parent containing ".svn"
if (!manages) {
QDir parentDir = dir;
while (parentDir.cdUp()) {
if (checkSVNSubDir(parentDir)) {
manages = true;
if (topLevel)
*topLevel = parentDir.absolutePath();
break;
}
}
}
if (Subversion::Constants::debug) {
QDebug nsp = qDebug().nospace();
nsp << "SubversionPlugin::managesDirectory" << directory << manages;
......@@ -1409,13 +1412,16 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe
}
// Check whether SVN management subdirs exist.
bool SubversionPlugin::checkSVNSubDir(const QDir &directory) const
bool SubversionPlugin::checkSVNSubDir(const QDir &directory, const QString &fileName) const
{
const int dirCount = m_svnDirectories.size();
for (int i = 0; i < dirCount; i++) {
const QString svnDir = directory.absoluteFilePath(m_svnDirectories.at(i));
if (QFileInfo(svnDir).isDir())
return true;
if (!QFileInfo(svnDir).isDir())
continue;
if (!fileName.isEmpty() && !QDir(svnDir).exists(fileName))
continue;
return true;
}
return false;
}
......
......@@ -163,7 +163,7 @@ private:
bool enableAnnotationContextMenu = false);
void svnStatus(const QString &workingDir, const QStringList &relativePath = QStringList());
void svnUpdate(const QString &workingDir, const QStringList &relativePaths = QStringList());
bool checkSVNSubDir(const QDir &directory) const;
bool checkSVNSubDir(const QDir &directory, const QString &fileName = QString()) const;
void startCommit(const QString &workingDir, const QStringList &files = QStringList());
bool commit(const QString &messageFile, const QStringList &subVersionFileList);
void cleanCommitMessageFile();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment