forked from qt-creator/qt-creator
Git: Support filtering log entries by author
+ quote arguments with potential spaces. Change-Id: Ifd1bfecd7c30d145592432dff76c72024d2b1426 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
a3af941adf
commit
32d3fa755e
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
|
#include <utils/commandline.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
@@ -1137,15 +1138,19 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName,
|
|||||||
if (!arguments.contains(graphOption) && !arguments.contains(patchOption))
|
if (!arguments.contains(graphOption) && !arguments.contains(patchOption))
|
||||||
arguments << normalLogArguments();
|
arguments << normalLogArguments();
|
||||||
|
|
||||||
|
const QString authorValue = editor->authorValue();
|
||||||
|
if (!authorValue.isEmpty())
|
||||||
|
arguments << "--author=" + ProcessArgs::quoteArg(authorValue);
|
||||||
|
|
||||||
const QString grepValue = editor->grepValue();
|
const QString grepValue = editor->grepValue();
|
||||||
if (!grepValue.isEmpty())
|
if (!grepValue.isEmpty())
|
||||||
arguments << "--grep=" + grepValue;
|
arguments << "--grep=" + ProcessArgs::quoteArg(grepValue);
|
||||||
|
|
||||||
const QString pickaxeValue = editor->pickaxeValue();
|
const QString pickaxeValue = editor->pickaxeValue();
|
||||||
if (!pickaxeValue.isEmpty())
|
if (!pickaxeValue.isEmpty())
|
||||||
arguments << "-S" << pickaxeValue;
|
arguments << "-S" << ProcessArgs::quoteArg(pickaxeValue);
|
||||||
|
|
||||||
if ((!grepValue.isEmpty() || !pickaxeValue.isEmpty()) && !editor->caseSensitive())
|
if (!editor->caseSensitive())
|
||||||
arguments << "-i";
|
arguments << "-i";
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
|
|||||||
@@ -88,12 +88,17 @@ public:
|
|||||||
pickaxeLineEdit = addLineEdit(tr("Filter by content"),
|
pickaxeLineEdit = addLineEdit(tr("Filter by content"),
|
||||||
tr("Filter log entries by added or removed string."),
|
tr("Filter log entries by added or removed string."),
|
||||||
editor);
|
editor);
|
||||||
|
authorLineEdit = addLineEdit(tr("Filter by author"),
|
||||||
|
tr("Filter log entries by author."),
|
||||||
|
editor);
|
||||||
addWidget(new QLabel(tr("Filter:")));
|
addWidget(new QLabel(tr("Filter:")));
|
||||||
addSeparator();
|
addSeparator();
|
||||||
addWidget(grepLineEdit);
|
addWidget(grepLineEdit);
|
||||||
addSeparator();
|
addSeparator();
|
||||||
addWidget(pickaxeLineEdit);
|
addWidget(pickaxeLineEdit);
|
||||||
addSeparator();
|
addSeparator();
|
||||||
|
addWidget(authorLineEdit);
|
||||||
|
addSeparator();
|
||||||
caseAction = new QAction(tr("Case Sensitive"), this);
|
caseAction = new QAction(tr("Case Sensitive"), this);
|
||||||
caseAction->setCheckable(true);
|
caseAction->setCheckable(true);
|
||||||
caseAction->setChecked(true);
|
caseAction->setChecked(true);
|
||||||
@@ -105,6 +110,7 @@ public:
|
|||||||
|
|
||||||
Utils::FancyLineEdit *grepLineEdit;
|
Utils::FancyLineEdit *grepLineEdit;
|
||||||
Utils::FancyLineEdit *pickaxeLineEdit;
|
Utils::FancyLineEdit *pickaxeLineEdit;
|
||||||
|
Utils::FancyLineEdit *authorLineEdit;
|
||||||
QAction *caseAction;
|
QAction *caseAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -395,6 +401,13 @@ QString GitEditorWidget::pickaxeValue() const
|
|||||||
return m_logFilterWidget->pickaxeLineEdit->text();
|
return m_logFilterWidget->pickaxeLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GitEditorWidget::authorValue() const
|
||||||
|
{
|
||||||
|
if (!m_logFilterWidget)
|
||||||
|
return QString();
|
||||||
|
return m_logFilterWidget->authorLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
bool GitEditorWidget::caseSensitive() const
|
bool GitEditorWidget::caseSensitive() const
|
||||||
{
|
{
|
||||||
return m_logFilterWidget && m_logFilterWidget->caseAction->isChecked();
|
return m_logFilterWidget && m_logFilterWidget->caseAction->isChecked();
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
void setPickaxeLineEdit(Utils::FancyLineEdit *lineEdit);
|
void setPickaxeLineEdit(Utils::FancyLineEdit *lineEdit);
|
||||||
QString grepValue() const;
|
QString grepValue() const;
|
||||||
QString pickaxeValue() const;
|
QString pickaxeValue() const;
|
||||||
|
QString authorValue() const;
|
||||||
bool caseSensitive() const;
|
bool caseSensitive() const;
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user