]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/revisioncontrolplugin.cpp
Assure that no empty error message is shown in the statusbar. This should not happen...
[dolphin.git] / src / revisioncontrolplugin.cpp
index 79e35e386b61d4f5fc0cd55d900378e13c564040..683398879f4102bfd4762db45cbc65a878737272 100644 (file)
@@ -59,7 +59,8 @@ SubversionPlugin::SubversionPlugin() :
     m_errorMsg(),
     m_operationCompletedMsg(),
     m_contextDir(),
-    m_contextItems()
+    m_contextItems(),
+    m_tempFile()
 {
     m_updateAction = new KAction(this);
     m_updateAction->setIcon(KIcon("view-refresh"));
@@ -272,8 +273,21 @@ void SubversionPlugin::commitFiles()
     dialog.restoreDialogSize(dialogConfig);
 
     if (dialog.exec() == QDialog::Accepted) {
-        const QString description = editor->toPlainText();
-        execSvnCommand("commit -m " + KShell::quoteArg(description),
+        // Write the commit description into a temporary file, so
+        // that it can be read by the command "svn commit -F". The temporary
+        // file must stay alive until slotOperationCompleted() is invoked and will
+        // be destroyed when the revision plugin is destructed.
+        if (!m_tempFile.open())  {
+            emit errorMessage(i18nc("@info:status", "Commit of SVN changes failed."));
+            return;
+        }
+
+        QTextStream out(&m_tempFile);
+        const QString fileName = m_tempFile.fileName();
+        out << editor->toPlainText();
+        m_tempFile.close();
+
+        execSvnCommand("commit -F " + KShell::quoteArg(fileName),
                        i18nc("@info:status", "Committing SVN changes..."),
                        i18nc("@info:status", "Commit of SVN changes failed."),
                        i18nc("@info:status", "Committed SVN changes."));
@@ -338,14 +352,13 @@ void SubversionPlugin::startSvnCommandProcess()
     connect(process, SIGNAL(error(QProcess::ProcessError)),
             this, SLOT(slotOperationError()));
 
-    QStringList arguments;
-    arguments << m_command;
+    const QString program = "svn " + m_command + ' ';
     if (!m_contextDir.isEmpty()) {
-        process->start("svn", arguments << KShell::quoteArg(m_contextDir));
+        process->start(program + KShell::quoteArg(m_contextDir));
         m_contextDir.clear();
     } else {
         const KFileItem item = m_contextItems.takeLast();
-        process->start("svn", arguments << KShell::quoteArg(item.localPath()));
+        process->start(program + KShell::quoteArg(item.localPath()));
         // the remaining items of m_contextItems will be executed
         // after the process has finished (see slotOperationFinished())
     }