Git: Clarify rebase and merge actions in branch view

While merge should be clear, it's sometimes
hard to understand which branch is rebased
on top of the other.

Let's be explicit and state that in the
context menu.

Change-Id: I9755a9220a0a5930ce96893e2fad06221d449d9c
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2020-12-21 13:13:36 +01:00
committed by André Hartmann
parent 8c92f40db8
commit 7883110e45

View File

@@ -212,7 +212,9 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
return; return;
const QModelIndex index = m_filterModel->mapToSource(filteredIndex); const QModelIndex index = m_filterModel->mapToSource(filteredIndex);
const QString indexName = m_model->fullName(index);
const QModelIndex currentBranch = m_model->currentBranch(); const QModelIndex currentBranch = m_model->currentBranch();
const QString currentName = m_model->fullName(currentBranch);
const bool currentSelected = index.sibling(index.row(), 0) == currentBranch; const bool currentSelected = index.sibling(index.row(), 0) == currentBranch;
const bool isLocal = m_model->isLocal(index); const bool isLocal = m_model->isLocal(index);
const bool isTag = m_model->isTag(index); const bool isTag = m_model->isTag(index);
@@ -261,14 +263,20 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
contextMenu.addMenu(resetMenu); contextMenu.addMenu(resetMenu);
QString mergeTitle; QString mergeTitle;
if (isFastForwardMerge()) { if (isFastForwardMerge()) {
contextMenu.addAction(tr("&Merge (Fast-Forward)"), this, [this] { merge(true); }); contextMenu.addAction(tr("&Merge \"%1\" into \"%2\" (Fast-Forward)")
mergeTitle = tr("Merge (No &Fast-Forward)"); .arg(indexName, currentName),
this, [this] { merge(true); });
mergeTitle = tr("Merge \"%1\" into \"%2\" (No &Fast-Forward)")
.arg(indexName, currentName);
} else { } else {
mergeTitle = tr("&Merge"); mergeTitle = tr("&Merge \"%1\" into \"%2\"")
.arg(indexName, currentName);
} }
contextMenu.addAction(mergeTitle, this, [this] { merge(false); }); contextMenu.addAction(mergeTitle, this, [this] { merge(false); });
contextMenu.addAction(tr("&Rebase"), this, &BranchView::rebase); contextMenu.addAction(tr("&Rebase \"%1\" on \"%2\"")
.arg(currentName, indexName),
this, &BranchView::rebase);
contextMenu.addSeparator(); contextMenu.addSeparator();
contextMenu.addAction(tr("Cherry &Pick"), this, &BranchView::cherryPick); contextMenu.addAction(tr("Cherry &Pick"), this, &BranchView::cherryPick);
} }