[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevplatform] /: Correctly handle non-zero exit codes of "cvs diff".
From: Ivan Shapovalov <intelfx100 () gmail ! com>
Date: 2012-07-30 15:22:50
Message-ID: 20120730152250.9E9E4A6094 () git ! kde ! org
[Download RAW message or body]
Git commit 0d71c7e778e012fae1c679723eb372a33511b296 by Ivan Shapovalov.
Committed on 18/07/2012 at 08:29.
Pushed by shapovalov into branch 'master'.
Correctly handle non-zero exit codes of "cvs diff".
Non-zero exit code of "cvs diff" does not necessary indicate an error.
There was a check for it, but the job still appeared as failed to the user.
REVIEW: 105792
M +8 -15 plugins/cvs/cvsdiffjob.cpp
M +5 -1 plugins/cvs/cvsdiffjob.h
M +3 -1 vcs/dvcs/dvcsjob.h
http://commits.kde.org/kdevplatform/0d71c7e778e012fae1c679723eb372a33511b296
diff --git a/plugins/cvs/cvsdiffjob.cpp b/plugins/cvs/cvsdiffjob.cpp
index 86a41cf..62a33c2 100644
--- a/plugins/cvs/cvsdiffjob.cpp
+++ b/plugins/cvs/cvsdiffjob.cpp
@@ -39,21 +39,14 @@ QVariant CvsDiffJob::fetchResults()
return qVariantFromValue( diff );
}
-KDevelop::VcsJob::JobStatus CvsDiffJob::status() const
-{
- KDevelop::VcsJob::JobStatus rv = CvsJob::status();
-
- // CVS has a bit of a weird return value handling.
- // Although cvs diff went ok it still returns non-zero
- if (rv == KDevelop::VcsJob::JobFailed) {
- // so if the output contains the "Index:" mark the diff seams to be ok
- // -> change the return value according to this
- if (output().contains("Index:")) {
- rv = KDevelop::VcsJob::JobSucceeded;
- }
- }
-
- return rv;
+void CvsDiffJob::slotProcessError(QProcess::ProcessError error) {
+ // Do not blindly raise an error on non-zero return code of "cvs diff".
+ // If its output contains the "Index:" mark, the diff is probably intact,
+ // and non-zero return code indicates just that there are changes.
+ if (error == QProcess::UnknownError && output().contains("Index:"))
+ return;
+
+ KDevelop::DVcsJob::slotProcessError(error);
}
#include "cvsdiffjob.moc"
diff --git a/plugins/cvs/cvsdiffjob.h b/plugins/cvs/cvsdiffjob.h
index dbe7a7c..4920d3f 100644
--- a/plugins/cvs/cvsdiffjob.h
+++ b/plugins/cvs/cvsdiffjob.h
@@ -27,8 +27,12 @@ public:
// Begin: KDevelop::VcsJob
virtual QVariant fetchResults();
- virtual KDevelop::VcsJob::JobStatus status() const;
// End: KDevelop::VcsJob
+
+private:
+ // Begin: KDevelop::DVcsJob
+ virtual void slotProcessError(QProcess::ProcessError error);
+ // End: KDevelop::DVcsJob
};
#endif
diff --git a/vcs/dvcs/dvcsjob.h b/vcs/dvcs/dvcsjob.h
index 775fe0a..efd874a 100644
--- a/vcs/dvcs/dvcsjob.h
+++ b/vcs/dvcs/dvcsjob.h
@@ -205,8 +205,10 @@ public Q_SLOTS:
Q_SIGNALS:
void readyForParsing(KDevelop::DVcsJob *job);
+protected Q_SLOTS:
+ virtual void slotProcessError( QProcess::ProcessError );
+
private Q_SLOTS:
- void slotProcessError( QProcess::ProcessError );
void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
void slotReceivedStdout();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic