forked from qt-creator/qt-creator
Git: Make git show a bit more robust
Change-Id: I5d0dc3bb43753f7b2ac9c308944f327537547d76 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -76,7 +76,7 @@ protected:
|
|||||||
// inside reload() (for synchronous reload)
|
// inside reload() (for synchronous reload)
|
||||||
// or later (for asynchronous reload)
|
// or later (for asynchronous reload)
|
||||||
virtual void reload() = 0;
|
virtual void reload() = 0;
|
||||||
void reloadFinished(bool success);
|
virtual void reloadFinished(bool success);
|
||||||
|
|
||||||
void setDiffFiles(const QList<FileData> &diffFileList,
|
void setDiffFiles(const QList<FileData> &diffFileList,
|
||||||
const QString &baseDirectory = QString());
|
const QString &baseDirectory = QString());
|
||||||
|
@@ -355,6 +355,7 @@ public:
|
|||||||
|
|
||||||
void reload() override;
|
void reload() override;
|
||||||
void processOutput(const QString &output) override;
|
void processOutput(const QString &output) override;
|
||||||
|
void reloadFinished(bool success) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_id;
|
const QString m_id;
|
||||||
@@ -376,16 +377,26 @@ void ShowController::processOutput(const QString &output)
|
|||||||
QTC_ASSERT(m_state != Idle, return);
|
QTC_ASSERT(m_state != Idle, return);
|
||||||
if (m_state == GettingDescription) {
|
if (m_state == GettingDescription) {
|
||||||
setDescription(gitClient()->extendedShowDescription(m_directory, output));
|
setDescription(gitClient()->extendedShowDescription(m_directory, output));
|
||||||
|
} else if (m_state == GettingDiff) {
|
||||||
|
processDiff(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowController::reloadFinished(bool success)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_state != Idle, return);
|
||||||
|
|
||||||
|
if (m_state == GettingDescription && success) {
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("show") << QLatin1String("--format=format:") // omit header, already generated
|
args << QLatin1String("show") << QLatin1String("--format=format:") // omit header, already generated
|
||||||
<< QLatin1String(noColorOption) << QLatin1String(decorateOption) << m_id;
|
<< QLatin1String(noColorOption) << QLatin1String(decorateOption) << m_id;
|
||||||
m_state = GettingDiff;
|
m_state = GettingDiff;
|
||||||
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
||||||
} else if (m_state == GettingDiff) {
|
return;
|
||||||
m_state = Idle;
|
|
||||||
processDiff(output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_state = Idle;
|
||||||
|
BaseController::reloadFinished(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
Reference in New Issue
Block a user