forked from qt-creator/qt-creator
Git/SVN: Ignore whitespace in annotation/blame (introduce setting).
Defaulting to true. Task-number: QTCREATORBUG-502
This commit is contained in:
@@ -302,6 +302,9 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName,
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << "blame" << workingDirectory << fileName << lineNumber;
|
||||
QStringList arguments(QLatin1String("blame"));
|
||||
arguments << QLatin1String("--root");
|
||||
if (m_plugin->settings().spaceIgnorantBlame)
|
||||
arguments << QLatin1String("-w");
|
||||
arguments << QLatin1String("--") << fileName;
|
||||
|
||||
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
|
||||
|
||||
@@ -43,6 +43,7 @@ static const char *logCountKeyC = "LogCount";
|
||||
static const char *timeoutKeyC = "TimeOut";
|
||||
static const char *promptToSubmitKeyC = "PromptForSubmit";
|
||||
static const char *omitAnnotationDateKeyC = "OmitAnnotationDate";
|
||||
static const char *spaceIgnorantBlameKeyC = "SpaceIgnorantBlame";
|
||||
|
||||
enum { defaultLogCount = 10 , defaultTimeOut = 30};
|
||||
|
||||
@@ -54,7 +55,8 @@ GitSettings::GitSettings() :
|
||||
logCount(defaultLogCount),
|
||||
timeout(defaultTimeOut),
|
||||
promptToSubmit(true),
|
||||
omitAnnotationDate(false)
|
||||
omitAnnotationDate(false),
|
||||
spaceIgnorantBlame(true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -67,6 +69,7 @@ void GitSettings::fromSettings(QSettings *settings)
|
||||
timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
|
||||
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
|
||||
omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool();
|
||||
spaceIgnorantBlame = settings->value(QLatin1String(spaceIgnorantBlameKeyC), true).toBool();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ void GitSettings::toSettings(QSettings *settings) const
|
||||
settings->setValue(QLatin1String(timeoutKeyC), timeout);
|
||||
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
|
||||
settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate);
|
||||
settings->setValue(QLatin1String(spaceIgnorantBlameKeyC), spaceIgnorantBlame);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
@@ -86,7 +90,7 @@ bool GitSettings::equals(const GitSettings &s) const
|
||||
{
|
||||
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount
|
||||
&& timeout == s.timeout && promptToSubmit == s.promptToSubmit
|
||||
&& omitAnnotationDate == s.omitAnnotationDate;
|
||||
&& omitAnnotationDate == s.omitAnnotationDate && spaceIgnorantBlame == s.spaceIgnorantBlame;
|
||||
}
|
||||
|
||||
QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
|
||||
|
||||
@@ -57,6 +57,7 @@ struct GitSettings
|
||||
int timeout;
|
||||
bool promptToSubmit;
|
||||
bool omitAnnotationDate;
|
||||
bool spaceIgnorantBlame;
|
||||
};
|
||||
|
||||
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
|
||||
|
||||
@@ -58,6 +58,7 @@ GitSettings SettingsPageWidget::settings() const
|
||||
rc.timeout = m_ui.timeoutSpinBox->value();
|
||||
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
|
||||
rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked();
|
||||
rc.spaceIgnorantBlame = m_ui.spaceIgnorantBlameCheckBox->isChecked();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -69,6 +70,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
|
||||
m_ui.timeoutSpinBox->setValue(s.timeout);
|
||||
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
|
||||
m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate);
|
||||
m_ui.spaceIgnorantBlameCheckBox->setChecked(s.spaceIgnorantBlame);
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSystemPath()
|
||||
@@ -83,7 +85,8 @@ QString SettingsPageWidget::searchKeywords() const
|
||||
<< ' ' << m_ui.timeoutLabel->text()
|
||||
<< ' ' << m_ui.promptToSubmitCheckBox->text()
|
||||
<< ' ' << m_ui.omitAnnotationDataCheckBox->text()
|
||||
<< ' ' << m_ui.environmentGroupBox->title();
|
||||
<< ' ' << m_ui.environmentGroupBox->title()
|
||||
<< ' ' << m_ui.spaceIgnorantBlameCheckBox->text();
|
||||
rc.remove(QLatin1Char('&'));
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="logCountLabel">
|
||||
<property name="text">
|
||||
@@ -125,6 +128,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="spaceIgnorantBlameCheckBox">
|
||||
<property name="text">
|
||||
<string>Ignore whitespace changes in annotation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user