forked from qt-creator/qt-creator
Introduce Utils::SynchronousProcess::normalizeNewlines
Replaces \r\n? with \n. Some console applications (e.g. git-push, git-rebase) use \r alone to move the cursor to the line's beginning. This should be replaced by \n rather than just be erased. Change-Id: I8d614d2b471e59decdbfa7f173ffa7fbdb11759b Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
1b13122cd1
commit
208aeb79ed
@@ -187,8 +187,8 @@ QStringList MercurialClient::parentRevisionsSync(const QString &workingDirectory
|
||||
QByteArray outputData;
|
||||
if (!vcsFullySynchronousExec(workingDirectory, args, &outputData))
|
||||
return QStringList();
|
||||
QString output = QString::fromLocal8Bit(outputData);
|
||||
output.remove(QLatin1Char('\r'));
|
||||
const QString output = Utils::SynchronousProcess::normalizeNewlines(
|
||||
QString::fromLocal8Bit(outputData));
|
||||
/* Looks like: \code
|
||||
changeset: 0:031a48610fba
|
||||
user: ...
|
||||
@@ -230,8 +230,7 @@ QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
||||
QByteArray outputData;
|
||||
if (!vcsFullySynchronousExec(workingDirectory, args, &outputData))
|
||||
return revision;
|
||||
description = QString::fromLocal8Bit(outputData);
|
||||
description.remove(QLatin1Char('\r'));
|
||||
description = Utils::SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(outputData));
|
||||
if (description.endsWith(QLatin1Char('\n')))
|
||||
description.truncate(description.size() - 1);
|
||||
return description;
|
||||
|
||||
Reference in New Issue
Block a user