[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkdevplatform/1=2E2=5D_plugins/cvs=3A_CVS_plugin_wor?=
From: Andrey Batyiev <batyiev () gmail ! com>
Date: 2011-03-01 20:58:53
Message-ID: 20110301205853.C72CEA60C9 () git ! kde ! org
[Download RAW message or body]
Git commit f13027d1cee4388124fd2640a5095a9a7318337e by Andrey Batyiev.
Committed on 01/03/2011 at 21:18.
Pushed by abatyiev into branch '1.2'.
CVS plugin works incorrectly when first supplied location is directory.
Fixing it.
REVIEW: 100771
M +20 -35 plugins/cvs/cvsplugin.cpp
M +1 -0 plugins/cvs/cvsplugin.h
http://commits.kde.org/kdevplatform/f13027d1cee4388124fd2640a5095a9a7318337e
diff --git a/plugins/cvs/cvsplugin.cpp b/plugins/cvs/cvsplugin.cpp
index 8f00d59..984f38b 100644
--- a/plugins/cvs/cvsplugin.cpp
+++ b/plugins/cvs/cvsplugin.cpp
@@ -249,10 +249,8 @@ void CvsPlugin::ctxEditors()
{
KUrl::List const & urls = d->m_common->contextUrlList();
Q_ASSERT(!urls.empty());
- ///@todo find a common base directory for the files
- QFileInfo info(urls.front().toLocalFile());
- CvsJob* job = d->m_proxy->editors(info.absolutePath(),
+ CvsJob* job = d->m_proxy->editors(findWorkingDir(urls.front().toLocalFile()),
urls);
if (job) {
KDevelop::ICore::self()->runController()->registerJob(job);
@@ -261,7 +259,17 @@ void CvsPlugin::ctxEditors()
}
}
+QString CvsPlugin::findWorkingDir(const KUrl& location)
+{
+ QFileInfo fileInfo(location.toLocalFile());
+ // find out correct working directory
+ if (fileInfo.isFile()) {
+ return fileInfo.absolutePath();
+ } else {
+ return fileInfo.absoluteFilePath();
+ }
+}
// Begin: KDevelop::IBasicVersionControl
@@ -279,10 +287,7 @@ KDevelop::VcsJob * CvsPlugin::repositoryLocation(const KUrl & \
localLocation)
KDevelop::VcsJob * CvsPlugin::add(const KUrl::List & localLocations, \
KDevelop::IBasicVersionControl::RecursionMode recursion) {
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
-
- CvsJob* job = d->m_proxy->add(info.absolutePath(),
+ CvsJob* job = d->m_proxy->add(findWorkingDir(localLocations[0].toLocalFile()),
localLocations,
(recursion == \
KDevelop::IBasicVersionControl::Recursive) ? true : false); return job;
@@ -290,10 +295,7 @@ KDevelop::VcsJob * CvsPlugin::add(const KUrl::List & \
localLocations, KDevelop::I
KDevelop::VcsJob * CvsPlugin::remove(const KUrl::List & localLocations)
{
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
-
- CvsJob* job = d->m_proxy->remove(info.absolutePath(),
+ CvsJob* job = d->m_proxy->remove(findWorkingDir(localLocations[0].toLocalFile()),
localLocations);
return job;
}
@@ -306,10 +308,7 @@ KDevelop::VcsJob * CvsPlugin::localRevision(const KUrl & \
localLocation, KDevelop
KDevelop::VcsJob * CvsPlugin::status(const KUrl::List & localLocations, \
KDevelop::IBasicVersionControl::RecursionMode recursion) {
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
-
- CvsJob* job = d->m_proxy->status(info.absolutePath(),
+ CvsJob* job = d->m_proxy->status(findWorkingDir(localLocations[0].toLocalFile()),
localLocations,
(recursion == \
KDevelop::IBasicVersionControl::Recursive) ? true : false); return job;
@@ -317,19 +316,14 @@ KDevelop::VcsJob * CvsPlugin::status(const KUrl::List & \
localLocations, KDevelop
KDevelop::VcsJob * CvsPlugin::unedit(const KUrl & localLocation)
{
- ///@todo find a common base directory for the files
- QFileInfo info(localLocation.toLocalFile());
-
- CvsJob* job = d->m_proxy->unedit(info.absolutePath(),
+ CvsJob* job = d->m_proxy->unedit(findWorkingDir(localLocation.toLocalFile()),
localLocation);
return job;
}
KDevelop::VcsJob * CvsPlugin::edit(const KUrl & localLocation)
{
- QFileInfo info(localLocation.toLocalFile());
-
- CvsJob* job = d->m_proxy->edit(info.absolutePath(),
+ CvsJob* job = d->m_proxy->edit(findWorkingDir(localLocation.toLocalFile()),
localLocation);
return job;
}
@@ -341,11 +335,10 @@ KDevelop::VcsJob * CvsPlugin::copy(const KUrl & \
localLocationSrc, const KUrl & l return NULL;
}
- QFileInfo infoDstn(localLocationDstn.toLocalFile());
KUrl::List listDstn;
listDstn << localLocationDstn;
- CvsJob* job = d->m_proxy->add(infoDstn.absolutePath(),
+ CvsJob* job = d->m_proxy->add(findWorkingDir(localLocationDstn.toLocalFile()),
listDstn, true);
return job;
@@ -358,11 +351,8 @@ KDevelop::VcsJob * CvsPlugin::move(const KUrl &, const KUrl &)
KDevelop::VcsJob * CvsPlugin::revert(const KUrl::List & localLocations, \
KDevelop::IBasicVersionControl::RecursionMode recursion) {
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
-
KDevelop::VcsRevision rev;
- CvsJob* job = d->m_proxy->update(info.absolutePath(),
+ CvsJob* job = d->m_proxy->update(findWorkingDir(localLocations[0].toLocalFile()),
localLocations,
rev,
"-C",
@@ -373,10 +363,7 @@ KDevelop::VcsJob * CvsPlugin::revert(const KUrl::List & \
localLocations, KDevelop
KDevelop::VcsJob * CvsPlugin::update(const KUrl::List & localLocations, const \
KDevelop::VcsRevision & rev, KDevelop::IBasicVersionControl::RecursionMode recursion) \
{
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
-
- CvsJob* job = d->m_proxy->update(info.absolutePath(),
+ CvsJob* job = d->m_proxy->update(findWorkingDir(localLocations[0].toLocalFile()),
localLocations,
rev,
"",
@@ -395,10 +382,8 @@ KDevelop::VcsJob * CvsPlugin::commit(const QString & message, \
const KUrl::List & msg = dlg.message();
}
}
- ///@todo find a common base directory for the files
- QFileInfo info(localLocations[0].toLocalFile());
- CvsJob* job = d->m_proxy->commit(info.absolutePath(),
+ CvsJob* job = d->m_proxy->commit(findWorkingDir(localLocations[0].toLocalFile()),
localLocations,
msg);
return job;
diff --git a/plugins/cvs/cvsplugin.h b/plugins/cvs/cvsplugin.h
index 90a2d4e..9757d45 100644
--- a/plugins/cvs/cvsplugin.h
+++ b/plugins/cvs/cvsplugin.h
@@ -134,6 +134,7 @@ signals:
private:
void setupActions();
std::auto_ptr<CvsPluginPrivate> d;
+ QString findWorkingDir(const KUrl& location);
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic