┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/revisioncontrolplugin.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-07-22 07:07:43 +0000
committerPeter Penz <[email protected]>2009-07-22 07:07:43 +0000
commitebf78d6ac26467560e66beeb106d0650aafd60f3 (patch)
treed314cc3d95e7ae933109935023479c8907b81f99 /src/revisioncontrolplugin.cpp
parentc92c5cada0bb687d29f4af1eb1230f28cc2bdf6c (diff)
- Documentation updates.
- Allow the revision plugin to emit a signal which indicates a changed revision state. - Update the revision state if the state of file items has been changed. - Check also the content of a file if the size of a local and revisioned file is equal. svn path=/trunk/KDE/kdebase/apps/; revision=1000831
Diffstat (limited to 'src/revisioncontrolplugin.cpp')
-rw-r--r--src/revisioncontrolplugin.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/revisioncontrolplugin.cpp b/src/revisioncontrolplugin.cpp
index 5e6783335..d5f2e4e5d 100644
--- a/src/revisioncontrolplugin.cpp
+++ b/src/revisioncontrolplugin.cpp
@@ -32,6 +32,8 @@ RevisionControlPlugin::~RevisionControlPlugin()
{
}
+#include "revisioncontrolplugin.moc"
+
// ----------------------------------------------------------------------------
SubversionPlugin::SubversionPlugin() :
@@ -94,18 +96,47 @@ RevisionControlPlugin::RevisionState SubversionPlugin::revisionState(const KFile
const QDateTime versionedTimeStamp = info.timeStamp;
if (localTimeStamp > versionedTimeStamp) {
- if (info.size != item.size()) {
+ if ((info.size != item.size()) || !equalRevisionContent(item.name())) {
return RevisionControlPlugin::EditingRevision;
}
- // TODO: a comparison of the content is required
} else if (localTimeStamp < versionedTimeStamp) {
- if (info.size != item.size()) {
+ if ((info.size != item.size()) || !equalRevisionContent(item.name())) {
return RevisionControlPlugin::UpdateRequiredRevision;
}
- // TODO: a comparison of the content is required
}
return RevisionControlPlugin::LatestRevision;
}
return RevisionControlPlugin::LocalRevision;
}
+
+QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items) const
+{
+ Q_UNUSED(items);
+ // TODO...
+ return QList<QAction*>();
+}
+
+bool SubversionPlugin::equalRevisionContent(const QString& name) const
+{
+ QFile localFile(m_directory + '/' + name);
+ if (!localFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ return false;
+ }
+
+ QFile revisionedFile(m_directory + "/.svn/text-base/" + name + ".svn-base");
+ if (!revisionedFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ return false;
+ }
+
+ QTextStream localText(&localFile);
+ QTextStream revisionedText(&revisionedFile);
+ while (!localText.atEnd() && !revisionedText.atEnd()) {
+ if (localText.readLine() != revisionedText.readLine()) {
+ return false;
+ }
+ }
+
+ return localText.atEnd() && revisionedText.atEnd();
+}
+