Git: Add tags from log window

Fixes: QTCREATORBUG-22202
Change-Id: Id6cbaf036d25fe5e9e8fcf2fe4d131649746e128
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2019-03-28 21:57:37 +01:00
committed by André Hartmann
parent 9dd05ec341
commit 0161729c23
5 changed files with 52 additions and 9 deletions

View File

@@ -26,6 +26,7 @@
#include "giteditor.h"
#include "annotationhighlighter.h"
#include "branchadddialog.h"
#include "gitplugin.h"
#include "gitclient.h"
#include "gitsettings.h"
@@ -305,6 +306,25 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
menu->addAction(tr("&Log for Change %1").arg(change), this, [this] {
GitPlugin::client()->log(sourceWorkingDirectory(), QString(), false, {m_currentChange});
});
menu->addAction(tr("Add &Tag for Change %1...").arg(change), this, [this] {
QString output;
QString errorMessage;
GitPlugin::client()->synchronousTagCmd(sourceWorkingDirectory(), QStringList(),
&output, &errorMessage);
const QStringList tags = output.split('\n');
BranchAddDialog dialog(tags, BranchAddDialog::Type::AddTag, nullptr);
if (dialog.exec() == QDialog::Rejected)
return;
GitPlugin::client()->synchronousTagCmd(sourceWorkingDirectory(),
{dialog.branchName(), m_currentChange},
&output, &errorMessage);
VcsOutputWindow::append(output);
if (!errorMessage.isEmpty())
VcsOutputWindow::append(errorMessage, VcsOutputWindow::MessageStyle::Error);
});
auto resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu);
resetMenu->addAction(tr("&Hard"), this, [this] { resetChange("hard"); });