Commit 478a2e86 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Support Log for selected commit in git editors

Change-Id: I5081471b3be65de1948d9bfdd52fd812df5e6a7a
Reviewed-by: default avatarTobias Hunger <>
parent 690a545f
......@@ -892,16 +892,22 @@ void GitClient::status(const QString &workingDirectory)
void GitClient::log(const QString &workingDirectory, const QString &fileName,
bool enableAnnotationContextMenu, const QStringList &args)
const QString msgArg = fileName.isEmpty() ? workingDirectory : fileName;
QString msgArg;
if (!fileName.isEmpty())
msgArg = fileName;
else if (!args.isEmpty())
msgArg = args.first();
msgArg = workingDirectory;
const QString title = tr("Git Log \"%1\"").arg(msgArg);
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
VcsBaseEditorWidget *editor = findExistingVCSEditor("logFileName", sourceFile);
VcsBaseEditorWidget *editor = findExistingVCSEditor("logTitle", msgArg);
if (!editor) {
auto *argWidget = new GitLogArgumentsWidget(settings());
connect(argWidget, &VcsBaseEditorParameterWidget::commandExecutionRequested,
[=]() { this->log(workingDirectory, fileName, enableAnnotationContextMenu, args); });
editor = createVcsEditor(editorId, title, sourceFile, CodecLogOutput, "logFileName", sourceFile,
editor = createVcsEditor(editorId, title, sourceFile, CodecLogOutput, "logTitle", msgArg,
......@@ -243,6 +243,12 @@ void GitEditorWidget::revertChange()
sourceWorkingDirectory(), m_currentChange);
void GitEditorWidget::logChange()
sourceWorkingDirectory(), QString(), false, QStringList(m_currentChange));
void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
QTemporaryFile patchFile;
......@@ -349,6 +355,7 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
menu->addAction(tr("Cherr&y-Pick Change %1").arg(change), this, SLOT(cherryPickChange()));
menu->addAction(tr("Re&vert Change %1").arg(change), this, SLOT(revertChange()));
menu->addAction(tr("C&heckout Change %1").arg(change), this, SLOT(checkoutChange()));
menu->addAction(tr("&Log for Change %1").arg(change), this, SLOT(logChange()));
QMenu *resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu);
connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered,
this, [this]() { resetChange("hard"); });
......@@ -58,6 +58,7 @@ private slots:
void checkoutChange();
void cherryPickChange();
void revertChange();
void logChange();
void applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert);
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