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, ...@@ -302,6 +302,9 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName,
if (Git::Constants::debug) if (Git::Constants::debug)
qDebug() << "blame" << workingDirectory << fileName << lineNumber; qDebug() << "blame" << workingDirectory << fileName << lineNumber;
QStringList arguments(QLatin1String("blame")); QStringList arguments(QLatin1String("blame"));
arguments << QLatin1String("--root");
if (m_plugin->settings().spaceIgnorantBlame)
arguments << QLatin1String("-w");
arguments << QLatin1String("--") << fileName; arguments << QLatin1String("--") << fileName;
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND); const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
......
...@@ -43,6 +43,7 @@ static const char *logCountKeyC = "LogCount"; ...@@ -43,6 +43,7 @@ static const char *logCountKeyC = "LogCount";
static const char *timeoutKeyC = "TimeOut"; static const char *timeoutKeyC = "TimeOut";
static const char *promptToSubmitKeyC = "PromptForSubmit"; static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *omitAnnotationDateKeyC = "OmitAnnotationDate"; static const char *omitAnnotationDateKeyC = "OmitAnnotationDate";
static const char *spaceIgnorantBlameKeyC = "SpaceIgnorantBlame";
enum { defaultLogCount = 10 , defaultTimeOut = 30}; enum { defaultLogCount = 10 , defaultTimeOut = 30};
...@@ -54,7 +55,8 @@ GitSettings::GitSettings() : ...@@ -54,7 +55,8 @@ GitSettings::GitSettings() :
logCount(defaultLogCount), logCount(defaultLogCount),
timeout(defaultTimeOut), timeout(defaultTimeOut),
promptToSubmit(true), promptToSubmit(true),
omitAnnotationDate(false) omitAnnotationDate(false),
spaceIgnorantBlame(true)
{ {
} }
...@@ -67,6 +69,7 @@ void GitSettings::fromSettings(QSettings *settings) ...@@ -67,6 +69,7 @@ void GitSettings::fromSettings(QSettings *settings)
timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt(); timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool(); promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool(); omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool();
spaceIgnorantBlame = settings->value(QLatin1String(spaceIgnorantBlameKeyC), true).toBool();
settings->endGroup(); settings->endGroup();
} }
...@@ -79,6 +82,7 @@ void GitSettings::toSettings(QSettings *settings) const ...@@ -79,6 +82,7 @@ void GitSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(timeoutKeyC), timeout); settings->setValue(QLatin1String(timeoutKeyC), timeout);
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit); settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate); settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate);
settings->setValue(QLatin1String(spaceIgnorantBlameKeyC), spaceIgnorantBlame);
settings->endGroup(); settings->endGroup();
} }
...@@ -86,7 +90,7 @@ bool GitSettings::equals(const GitSettings &s) const ...@@ -86,7 +90,7 @@ bool GitSettings::equals(const GitSettings &s) const
{ {
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount
&& timeout == s.timeout && promptToSubmit == s.promptToSubmit && timeout == s.timeout && promptToSubmit == s.promptToSubmit
&& omitAnnotationDate == s.omitAnnotationDate; && omitAnnotationDate == s.omitAnnotationDate && spaceIgnorantBlame == s.spaceIgnorantBlame;
} }
QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
......
...@@ -57,6 +57,7 @@ struct GitSettings ...@@ -57,6 +57,7 @@ struct GitSettings
int timeout; int timeout;
bool promptToSubmit; bool promptToSubmit;
bool omitAnnotationDate; bool omitAnnotationDate;
bool spaceIgnorantBlame;
}; };
inline bool operator==(const GitSettings &p1, const GitSettings &p2) inline bool operator==(const GitSettings &p1, const GitSettings &p2)
......
...@@ -58,6 +58,7 @@ GitSettings SettingsPageWidget::settings() const ...@@ -58,6 +58,7 @@ GitSettings SettingsPageWidget::settings() const
rc.timeout = m_ui.timeoutSpinBox->value(); rc.timeout = m_ui.timeoutSpinBox->value();
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked(); rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked(); rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked();
rc.spaceIgnorantBlame = m_ui.spaceIgnorantBlameCheckBox->isChecked();
return rc; return rc;
} }
...@@ -69,6 +70,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s) ...@@ -69,6 +70,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
m_ui.timeoutSpinBox->setValue(s.timeout); m_ui.timeoutSpinBox->setValue(s.timeout);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit); m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate); m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate);
m_ui.spaceIgnorantBlameCheckBox->setChecked(s.spaceIgnorantBlame);
} }
void SettingsPageWidget::setSystemPath() void SettingsPageWidget::setSystemPath()
...@@ -83,7 +85,8 @@ QString SettingsPageWidget::searchKeywords() const ...@@ -83,7 +85,8 @@ QString SettingsPageWidget::searchKeywords() const
<< ' ' << m_ui.timeoutLabel->text() << ' ' << m_ui.timeoutLabel->text()
<< ' ' << m_ui.promptToSubmitCheckBox->text() << ' ' << m_ui.promptToSubmitCheckBox->text()
<< ' ' << m_ui.omitAnnotationDataCheckBox->text() << ' ' << m_ui.omitAnnotationDataCheckBox->text()
<< ' ' << m_ui.environmentGroupBox->title(); << ' ' << m_ui.environmentGroupBox->title()
<< ' ' << m_ui.spaceIgnorantBlameCheckBox->text();
rc.remove(QLatin1Char('&')); rc.remove(QLatin1Char('&'));
return rc; return rc;
} }
......
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
<string>Miscellaneous</string> <string>Miscellaneous</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="logCountLabel"> <widget class="QLabel" name="logCountLabel">
<property name="text"> <property name="text">
...@@ -125,6 +128,13 @@ ...@@ -125,6 +128,13 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
......
...@@ -62,6 +62,7 @@ SubversionSettings SettingsPageWidget::settings() const ...@@ -62,6 +62,7 @@ SubversionSettings SettingsPageWidget::settings() const
if (rc.user.isEmpty()) if (rc.user.isEmpty())
rc.useAuthentication = false; rc.useAuthentication = false;
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked(); rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
rc.spaceIgnorantAnnotation = m_ui.spaceIgnorantAnnotationCheckBox->isChecked();
return rc; return rc;
} }
...@@ -73,6 +74,7 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s) ...@@ -73,6 +74,7 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s)
m_ui.userGroupBox->setChecked(s.useAuthentication); m_ui.userGroupBox->setChecked(s.useAuthentication);
m_ui.timeOutSpinBox->setValue(s.timeOutS); m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit); m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
m_ui.spaceIgnorantAnnotationCheckBox->setChecked(s.spaceIgnorantAnnotation);
} }
QString SettingsPageWidget::searchKeywords() const QString SettingsPageWidget::searchKeywords() const
...@@ -81,7 +83,8 @@ QString SettingsPageWidget::searchKeywords() const ...@@ -81,7 +83,8 @@ QString SettingsPageWidget::searchKeywords() const
QTextStream(&rc) << m_ui.commandLabel->text() QTextStream(&rc) << m_ui.commandLabel->text()
<< ' ' << m_ui.usernameLabel->text() << ' ' << m_ui.usernameLabel->text()
<< ' ' << m_ui.passwordLabel->text() << ' ' << m_ui.passwordLabel->text()
<< ' ' << m_ui.userGroupBox->title(); << ' ' << m_ui.userGroupBox->title()
<< ' ' << m_ui.spaceIgnorantAnnotationCheckBox->text();
rc.remove(QLatin1Char('&')); rc.remove(QLatin1Char('&'));
return rc; return rc;
} }
......
...@@ -99,6 +99,13 @@ ...@@ -99,6 +99,13 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
......
...@@ -717,6 +717,8 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file) ...@@ -717,6 +717,8 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file)
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file);
QStringList args(QLatin1String("annotate")); QStringList args(QLatin1String("annotate"));
if (m_settings.spaceIgnorantAnnotation)
args << QLatin1String("-x") << QLatin1String("-uw");
args.push_back(QLatin1String("-v")); args.push_back(QLatin1String("-v"));
args.append(QDir::toNativeSeparators(file)); args.append(QDir::toNativeSeparators(file));
......
...@@ -42,6 +42,7 @@ static const char *userNameOptionC = "--username"; ...@@ -42,6 +42,7 @@ static const char *userNameOptionC = "--username";
static const char *passwordOptionC = "--password"; static const char *passwordOptionC = "--password";
static const char *promptToSubmitKeyC = "PromptForSubmit"; static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *timeOutKeyC = "TimeOut"; static const char *timeOutKeyC = "TimeOut";
static const char *spaceIgnorantAnnotationKeyC = "SpaceIgnorantAnnotation";
enum { defaultTimeOutS = 30 }; enum { defaultTimeOutS = 30 };
...@@ -61,7 +62,8 @@ SubversionSettings::SubversionSettings() : ...@@ -61,7 +62,8 @@ SubversionSettings::SubversionSettings() :
svnCommand(defaultCommand()), svnCommand(defaultCommand()),
useAuthentication(false), useAuthentication(false),
timeOutS(defaultTimeOutS), timeOutS(defaultTimeOutS),
promptToSubmit(true) promptToSubmit(true),
spaceIgnorantAnnotation(true)
{ {
} }
...@@ -74,6 +76,7 @@ void SubversionSettings::fromSettings(QSettings *settings) ...@@ -74,6 +76,7 @@ void SubversionSettings::fromSettings(QSettings *settings)
password = settings->value(QLatin1String(passwordKeyC), QString()).toString(); password = settings->value(QLatin1String(passwordKeyC), QString()).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt(); timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool(); promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
spaceIgnorantAnnotation = settings->value(QLatin1String(spaceIgnorantAnnotationKeyC), true).toBool();
settings->endGroup(); settings->endGroup();
} }
...@@ -86,6 +89,7 @@ void SubversionSettings::toSettings(QSettings *settings) const ...@@ -86,6 +89,7 @@ void SubversionSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(passwordKeyC), password); settings->setValue(QLatin1String(passwordKeyC), password);
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit); settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS); settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
settings->setValue(QLatin1String(spaceIgnorantAnnotationKeyC), spaceIgnorantAnnotation);
settings->endGroup(); settings->endGroup();
} }
...@@ -96,7 +100,8 @@ bool SubversionSettings::equals(const SubversionSettings &s) const ...@@ -96,7 +100,8 @@ bool SubversionSettings::equals(const SubversionSettings &s) const
&& user == s.user && user == s.user
&& password == s.password && password == s.password
&& timeOutS == s.timeOutS && timeOutS == s.timeOutS
&& promptToSubmit == s.promptToSubmit; && promptToSubmit == s.promptToSubmit
&& spaceIgnorantAnnotation == s.spaceIgnorantAnnotation;
} }
QStringList SubversionSettings::addOptions(const QStringList &args) const QStringList SubversionSettings::addOptions(const QStringList &args) const
......
...@@ -64,6 +64,7 @@ struct SubversionSettings ...@@ -64,6 +64,7 @@ struct SubversionSettings
QString password; QString password;
int timeOutS; int timeOutS;
bool promptToSubmit; bool promptToSubmit;
bool spaceIgnorantAnnotation;
}; };
inline bool operator==(const SubversionSettings &p1, const SubversionSettings &p2) 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