Commit c56b56be authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

VCS: Minor fixes

- git status: Recognize text in case -u was passed
- Mercurial: Always run in C locale
parent a0b11de0
...@@ -1147,8 +1147,9 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, ...@@ -1147,8 +1147,9 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
} }
return StatusFailed; return StatusFailed;
} }
// Unchanged? // Unchanged (output text depending on whether -u was passed)
if (outputText.contains("nothing to commit")) if (outputText.contains("nothing to commit")
|| outputText.contains("nothing added to commit but untracked files present"))
return StatusUnchanged; return StatusUnchanged;
return StatusChanged; return StatusChanged;
} }
......
...@@ -121,6 +121,7 @@ bool MercurialClient::executeHgSynchronously(const QString &workingDir, ...@@ -121,6 +121,7 @@ bool MercurialClient::executeHgSynchronously(const QString &workingDir,
QProcess hgProcess; QProcess hgProcess;
if (!workingDir.isEmpty()) if (!workingDir.isEmpty())
hgProcess.setWorkingDirectory(workingDir); hgProcess.setWorkingDirectory(workingDir);
MercurialJobRunner::setProcessEnvironment(hgProcess);
const MercurialSettings &settings = MercurialPlugin::instance()->settings(); const MercurialSettings &settings = MercurialPlugin::instance()->settings();
const QString binary = settings.binary(); const QString binary = settings.binary();
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QDebug> #include <QtCore/QDebug>
...@@ -161,6 +162,16 @@ QString MercurialJobRunner::msgTimeout(int timeoutSeconds) ...@@ -161,6 +162,16 @@ QString MercurialJobRunner::msgTimeout(int timeoutSeconds)
return tr("Timed out after %1s waiting for mercurial process to finish.").arg(timeoutSeconds); return tr("Timed out after %1s waiting for mercurial process to finish.").arg(timeoutSeconds);
} }
// Set environment for a hg process to run in locale "C". Note that there appears
// to be a bug in hg that causes special characters to be garbled when running
// in a different language, which seems to be independent from the encoding.
void MercurialJobRunner::setProcessEnvironment(QProcess &p)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QLatin1String("LANG"), QString(QLatin1Char('C')));
p.setProcessEnvironment(env);
}
void MercurialJobRunner::task(const QSharedPointer<HgTask> &job) void MercurialJobRunner::task(const QSharedPointer<HgTask> &job)
{ {
HgTask *taskData = job.data(); HgTask *taskData = job.data();
...@@ -193,7 +204,7 @@ void MercurialJobRunner::task(const QSharedPointer<HgTask> &job) ...@@ -193,7 +204,7 @@ void MercurialJobRunner::task(const QSharedPointer<HgTask> &job)
QProcess hgProcess; QProcess hgProcess;
hgProcess.setWorkingDirectory(taskData->repositoryRoot()); hgProcess.setWorkingDirectory(taskData->repositoryRoot());
MercurialJobRunner::setProcessEnvironment(hgProcess);
hgProcess.start(binary, args); hgProcess.start(binary, args);
......
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtCore/QString> #include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QProcess;
QT_END_NAMESPACE
namespace VCSBase { namespace VCSBase {
class VCSBaseEditor; class VCSBaseEditor;
} }
...@@ -95,6 +99,9 @@ public: ...@@ -95,6 +99,9 @@ public:
static QString msgStartFailed(const QString &binary, const QString &why); static QString msgStartFailed(const QString &binary, const QString &why);
static QString msgTimeout(int timeoutSeconds); static QString msgTimeout(int timeoutSeconds);
// Set environment for a hg process to run in locale "C"
static void setProcessEnvironment(QProcess &p);
protected: protected:
void run(); void run();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment