diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-05-03 16:14:40 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-05-04 20:01:23 +0200 |
commit | aa5b049561b3128503f8134a1efe79e520c876c2 (patch) | |
tree | aab6e52d584182489c337b48155cb87e67fa6f5b /src/plugins/git/logchangedialog.cpp | |
parent | 8695fe6d7c8724714cdf4a2a748a56d44da2cce1 (diff) |
Git: Improve LogChangeWidget
* Enable display of local-only commits
* Enable specifying a top commit
Change-Id: I0688ba9ac670f709d2044ae2b7bff081fd86c860
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/git/logchangedialog.cpp')
-rw-r--r-- | src/plugins/git/logchangedialog.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 4509144256..8621bc24d9 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -64,9 +64,9 @@ LogChangeWidget::LogChangeWidget(QWidget *parent) setSelectionBehavior(QAbstractItemView::SelectRows); } -bool LogChangeWidget::init(const QString &repository) +bool LogChangeWidget::init(const QString &repository, const QString &commit, bool includeRemote) { - if (!populateLog(repository) || !m_model->rowCount()) + if (!populateLog(repository, commit, includeRemote) || !m_model->rowCount()) return false; selectionModel()->select(m_model->index(0, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); @@ -89,7 +89,7 @@ int LogChangeWidget::commitIndex() const return -1; } -bool LogChangeWidget::populateLog(const QString &repository) +bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote) { if (const int rowCount = m_model->rowCount()) m_model->removeRows(0, rowCount); @@ -98,6 +98,9 @@ bool LogChangeWidget::populateLog(const QString &repository) GitClient *client = GitPlugin::instance()->gitClient(); QStringList arguments; arguments << QLatin1String("--max-count=40") << QLatin1String("--format=%h:%s %d"); + arguments << (commit.isEmpty() ? QLatin1String("HEAD") : commit); + if (!includeRemote) + arguments << QLatin1String("--not") << QLatin1String("--remotes"); QString output; if (!client->synchronousLog(repository, arguments, &output)) return false; @@ -165,9 +168,9 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) : resize(600, 400); } -bool LogChangeDialog::runDialog(const QString &repository) +bool LogChangeDialog::runDialog(const QString &repository, const QString &commit, bool includeRemote) { - if (!widget->init(repository)) + if (!widget->init(repository, commit, includeRemote)) return QDialog::Rejected; return QDialog::exec() == QDialog::Accepted; |