Commit 4ea1d416 authored by Nikolai Krasheninnikov's avatar Nikolai Krasheninnikov
Browse files

[svn] Fixed items status inside unversioned directory.

Added special checks for items inside unversioned dirs.
Previously those items was indicated as normal revision with a capability to launch SVN commands on it (SVN Delete, for example). Those commands ends up with an error.

Unversioned item is a special case because in any other cases 'svn status' will mark every file or dir as added, removed, conflicted and so on.

Test Plan:
Inside a repo create dir with a following structure:

1) Check any SVN actions available only for "dir", selecting other dirs and files causes no actions available.
2) Check items status showing correct.
3) Do 'SVN Add' for dir, 'SVN Revert' for dir2.
4) Check dir (with dir1.txt, file1.txt) and dir/dir1 (with file2.txt) and dir/dir1/dir2 has SVN Actions while dir/dir1/dir2/dir3 don't.
5) Check items status showing correct.

Reviewers: meven, elvisangelaccio, #dolphin

Reviewed By: meven, elvisangelaccio, #dolphin

Differential Revision:
parent 71daf138
......@@ -226,6 +226,11 @@ KVersionControlPlugin::ItemVersion FileViewSvnPlugin::itemVersion(const KFileIte
return m_versionInfoHash.value(itemUrl);
// If parent directory is unversioned item itself is unversioned.
if (isInUnversionedDir(item)) {
return UnversionedVersion;
if (!item.isDir()) {
// files that have not been listed by 'svn status' (= m_versionInfoHash)
// are under version control per definition
......@@ -254,6 +259,14 @@ KVersionControlPlugin::ItemVersion FileViewSvnPlugin::itemVersion(const KFileIte
QList<QAction*> FileViewSvnPlugin::actions(const KFileItemList& items) const
// Special case: if any item is in unversioned directory we shouldn't add any actions because
// we can do nothing with this item.
for (const auto &i : items) {
if (isInUnversionedDir(i)) {
return {};
if (items.count() == 1 && items.first().isDir()) {
return directoryActions(items.first());
......@@ -656,4 +669,18 @@ QList<QAction*> FileViewSvnPlugin::directoryActions(const KFileItem& directory)
return actions;
bool FileViewSvnPlugin::isInUnversionedDir(const KFileItem& item) const
const QString itemPath = item.localPath();
for (auto it = m_versionInfoHash.cbegin(); it != m_versionInfoHash.cend(); ++it) {
// Add QDir::separator() to m_versionInfoHash entry to ensure this is a directory.
if (it.value() == UnversionedVersion && itemPath.startsWith(it.key() + QDir::separator())) {
return true;
return false;
#include "fileviewsvnplugin.moc"
......@@ -96,6 +96,13 @@ private:
QList<QAction*> directoryActions(const KFileItem &directory) const;
* Checks #item parent directory (or its parent directory and so on) is unversioned.
* @param item Item to check.
* @return True item is in unversioned directory, false otherwise.
bool isInUnversionedDir(const KFileItem& item) const;
bool m_pendingOperation;
QHash<QString, ItemVersion> m_versionInfoHash;
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