[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevplatform/1.4] plugins/cvs: Separate "directory valid" and "file is known" conditions in CVS plu
From: Ivan Shapovalov <intelfx100 () gmail ! com>
Date: 2012-07-30 15:15:09
Message-ID: 20120730151509.9D818A60C9 () git ! kde ! org
[Download RAW message or body]
Git commit 2613b89f6f8e800a8e544f7d401ea3e47f77775a by Ivan Shapovalov.
Committed on 25/07/2012 at 14:53.
Pushed by shapovalov into branch '1.4'.
Separate "directory valid" and "file is known" conditions in CVS plugin.
This fixes behavior of "Add"/"Revert" actions, allowing to add new files
to the CVS index.
REVIEW: 105795
M +2 -2 plugins/cvs/cvsplugin.cpp
M +29 -7 plugins/cvs/cvsproxy.cpp
M +1 -0 plugins/cvs/cvsproxy.h
http://commits.kde.org/kdevplatform/2613b89f6f8e800a8e544f7d401ea3e47f77775a
diff --git a/plugins/cvs/cvsplugin.cpp b/plugins/cvs/cvsplugin.cpp
index 6802cbc..36bbdac 100644
--- a/plugins/cvs/cvsplugin.cpp
+++ b/plugins/cvs/cvsplugin.cpp
@@ -183,7 +183,7 @@ KDevelop::ContextMenuExtension CvsPlugin::contextMenuExtension(KDevelop::Context
bool hasVersionControlledEntries = false;
foreach(const KUrl &url, ctxUrlList) {
- if (isVersionControlled(url)) {
+ if (d->m_proxy->isValidDirectory(url)) {
hasVersionControlledEntries = true;
break;
}
@@ -276,7 +276,7 @@ QString CvsPlugin::findWorkingDir(const KUrl& location)
bool CvsPlugin::isVersionControlled(const KUrl & localLocation)
{
- return d->m_proxy->isValidDirectory(localLocation);
+ return d->m_proxy->isVersionControlled(localLocation);
}
KDevelop::VcsJob * CvsPlugin::repositoryLocation(const KUrl & localLocation)
diff --git a/plugins/cvs/cvsproxy.cpp b/plugins/cvs/cvsproxy.cpp
index b21c624..a2cb216 100644
--- a/plugins/cvs/cvsproxy.cpp
+++ b/plugins/cvs/cvsproxy.cpp
@@ -38,16 +38,38 @@ CvsProxy::~CvsProxy()
bool CvsProxy::isValidDirectory(const KUrl & dirPath) const
{
- QString path = dirPath.toLocalFile();
- QFileInfo fsObject(path);
- if (fsObject.isFile())
- path = fsObject.path() + QDir::separator() + "CVS";
- else
- path = path + QDir::separator() + "CVS";
- fsObject.setFile(path);
+ QFileInfo fsObject( dirPath.toLocalFile() );
+ if( !fsObject.isDir() )
+ dirPath.setFileName( QString() );
+
+ dirPath.addPath( "CVS" );
+ fsObject.setFile( dirPath.toLocalFile() );
return fsObject.exists();
}
+bool CvsProxy::isVersionControlled(const KUrl& filePath) const
+{
+ QFileInfo fsObject( filePath.toLocalFile() );
+ if( !fsObject.isDir() )
+ filePath.setFileName( QString() );
+
+ filePath.addPath( "CVS" );
+ QFileInfo cvsObject( filePath.toLocalFile() );
+ if( !cvsObject.exists() )
+ return false;
+
+ if( fsObject.isDir() )
+ return true;
+
+ filePath.addPath( "Entries" );
+ QFile cvsEntries( filePath.toLocalFile() );
+ cvsEntries.open( QIODevice::ReadOnly );
+ QString cvsEntriesData = cvsEntries.readAll();
+ cvsEntries.close();
+ return ( cvsEntriesData.indexOf( fsObject.fileName() ) != -1 );
+}
+
+
bool CvsProxy::prepareJob(CvsJob* job, const QString& repository, enum RequestedOperation op)
{
// Only do this check if it's a normal operation like diff, log ...
diff --git a/plugins/cvs/cvsproxy.h b/plugins/cvs/cvsproxy.h
index 6172239..9a660c5 100644
--- a/plugins/cvs/cvsproxy.h
+++ b/plugins/cvs/cvsproxy.h
@@ -54,6 +54,7 @@ public:
~CvsProxy();
bool isValidDirectory(const KUrl &dirPath) const;
+ bool isVersionControlled(const KUrl& filePath) const;
CvsJob* import(const KUrl& directory,
const QString & server, const QString& repositoryName,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic