Commit f7fe435f authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Compare with master / Compare with... in menu

parent 54865897
......@@ -804,18 +804,25 @@ void GitWidget::buildMenu()
BranchCheckoutDialog bd(m_mainWin->window(), m_pluginView, m_project->baseDir());
bd.openDialog();
});
m_gitMenu->addAction(i18n("Compare Branches"), this, [this] {
BranchesDialog bd(m_mainWin->window(), m_pluginView, m_project->baseDir());
bd.openDialog(GitUtils::RefType::Head);
QString frombr = bd.branch();
bd.openDialog(GitUtils::RefType::Head);
QString tobr = bd.branch();
m_gitMenu->addAction(i18n("Compare Branch"))->setMenu(compareBranchesMenu());
m_gitMenu->addAction(i18n("Stash"))->setMenu(stashMenu());
}
branchCompareFiles(frombr, tobr);
QMenu *GitWidget::compareBranchesMenu()
{
QMenu *menu = new QMenu(this);
menu->addAction(i18n("Compare with master"), this, [this] {
branchCompareFiles(QStringLiteral("master"), QString());
});
menu->addAction(i18n("Compare with ..."), this, [this] {
BranchesDialog bd(m_mainWin->window(), m_pluginView, m_project->baseDir());
bd.openDialog(GitUtils::RefType::Head);
QString branch = bd.branch();
m_gitMenu->addAction(i18n("Stash"))->setMenu(stashMenu());
branchCompareFiles(branch, QString());
});
return menu;
}
void GitWidget::createStashDialog(StashMode m, const QString &gitPath)
......
......@@ -91,6 +91,8 @@ private:
void applyDiff(const QString &fileName, bool staged, bool hunk, KTextEditor::View *v);
void numStatForStatus(QVector<GitUtils::StatusItem> &list, bool modified);
void branchCompareFiles(const QString &from, const QString &to);
QMenu *compareBranchesMenu();
QMenu *stashMenu();
void hideEmptyTreeNodes();
......
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