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

Git/SVN: Ignore whitespace in annotation/blame (introduce setting).

Defaulting to true.

Task-number: QTCREATORBUG-502
parent 59ecb9cf
......@@ -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>
......
......@@ -62,6 +62,7 @@ SubversionSettings SettingsPageWidget::settings() const
if (rc.user.isEmpty())
rc.useAuthentication = false;
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
rc.spaceIgnorantAnnotation = m_ui.spaceIgnorantAnnotationCheckBox->isChecked();
return rc;
}
......@@ -73,6 +74,7 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s)
m_ui.userGroupBox->setChecked(s.useAuthentication);
m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
m_ui.spaceIgnorantAnnotationCheckBox->setChecked(s.spaceIgnorantAnnotation);
}
QString SettingsPageWidget::searchKeywords() const
......@@ -81,7 +83,8 @@ QString SettingsPageWidget::searchKeywords() const
QTextStream(&rc) << m_ui.commandLabel->text()
<< ' ' << m_ui.usernameLabel->text()
<< ' ' << m_ui.passwordLabel->text()
<< ' ' << m_ui.userGroupBox->title();
<< ' ' << m_ui.userGroupBox->title()
<< ' ' << m_ui.spaceIgnorantAnnotationCheckBox->text();
rc.remove(QLatin1Char('&'));
return rc;
}
......
......@@ -99,6 +99,13 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="spaceIgnorantAnnotationCheckBox">
<property name="text">
<string>Ignore whitespace changes in annotation</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -717,6 +717,8 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file)
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file);
QStringList args(QLatin1String("annotate"));
if (m_settings.spaceIgnorantAnnotation)
args << QLatin1String("-x") << QLatin1String("-uw");
args.push_back(QLatin1String("-v"));
args.append(QDir::toNativeSeparators(file));
......
......@@ -42,6 +42,7 @@ static const char *userNameOptionC = "--username";
static const char *passwordOptionC = "--password";
static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *timeOutKeyC = "TimeOut";
static const char *spaceIgnorantAnnotationKeyC = "SpaceIgnorantAnnotation";
enum { defaultTimeOutS = 30 };
......@@ -61,7 +62,8 @@ SubversionSettings::SubversionSettings() :
svnCommand(defaultCommand()),
useAuthentication(false),
timeOutS(defaultTimeOutS),
promptToSubmit(true)
promptToSubmit(true),
spaceIgnorantAnnotation(true)
{
}
......@@ -74,6 +76,7 @@ void SubversionSettings::fromSettings(QSettings *settings)
password = settings->value(QLatin1String(passwordKeyC), QString()).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
spaceIgnorantAnnotation = settings->value(QLatin1String(spaceIgnorantAnnotationKeyC), true).toBool();
settings->endGroup();
}
......@@ -86,6 +89,7 @@ void SubversionSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(passwordKeyC), password);
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
settings->setValue(QLatin1String(spaceIgnorantAnnotationKeyC), spaceIgnorantAnnotation);
settings->endGroup();
}
......@@ -96,7 +100,8 @@ bool SubversionSettings::equals(const SubversionSettings &s) const
&& user == s.user
&& password == s.password
&& timeOutS == s.timeOutS
&& promptToSubmit == s.promptToSubmit;
&& promptToSubmit == s.promptToSubmit
&& spaceIgnorantAnnotation == s.spaceIgnorantAnnotation;
}
QStringList SubversionSettings::addOptions(const QStringList &args) const
......
......@@ -64,6 +64,7 @@ struct SubversionSettings
QString password;
int timeOutS;
bool promptToSubmit;
bool spaceIgnorantAnnotation;
};
inline bool operator==(const SubversionSettings &p1, const SubversionSettings &p2)
......
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