Change:
Testing I expected the action to appear on an unpublished branch, not the action. I am aware they both do the same. <img width="647" alt="Screenshot 2024-01-24 at 11 37 40" src=""

Discussion:
"command": "git.publish", "title": "%command.publish%", "category": "Git", <ins> "icon": "$(cloud-upload)", </ins> "enablement": "!operationInProgress" }, {

{ "command": "git.pushRef", "group": "navigation", <del> "when": "scmProvider == git" </del> <ins> "when": "scmProvider == git && scmHistoryItemGroupHasUpstream" }, { "command": "git.publish", "group": "navigation", "when": "scmProvider == git && !scmHistoryItemGroupHasUpstream" </ins> } ], "scm/outgoingChanges/context": [ { "command": "git.pushRef", "group": "1_modification@1", <del> "when": "scmProvider == git" </del> <ins> "when": "scmProvider == git && scmHistoryItemGroupHasUpstream" }, { "command": "git.publish", "group": "1_modification@1", "when": "scmProvider == git && !scmHistoryItemGroupHasUpstream" </ins> } ], "scm/outgoingChanges/allChanges/context": [

import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; <del> import { ISCMHistoryProviderMenus, SCMHistoryItemTreeElement } from 'vs/workbench/contrib/scm/common/history'; </del> <ins> import { ISCMHistoryProviderMenus, SCMHistoryItemGroupTreeElement, SCMHistoryItemTreeElement } from 'vs/workbench/contrib/scm/common/history'; </ins> import { ISCMMenus, ISCMProvider, ISCMRepository, ISCMRepositoryMenus, ISCMResource, ISCMResourceGroup, ISCMService } from 'vs/workbench/contrib/scm/common/scm'; function actionEquals(a: IAction, b: IAction): boolean {

private readonly historyItemMenus = new Map<SCMHistoryItemTreeElement, IMenu>(); private readonly disposables = new DisposableStore(); <del> private _incomingHistoryItemGroupMenu: IMenu; get incomingHistoryItemGroupMenu(): IMenu { return this._incomingHistoryItemGroupMenu; } private _incomingHistoryItemGroupContextMenu: IMenu; get incomingHistoryItemGroupContextMenu(): IMenu { return this._incomingHistoryItemGroupContextMenu; } private _outgoingHistoryItemGroupMenu: IMenu; get outgoingHistoryItemGroupMenu(): IMenu { return this._outgoingHistoryItemGroupMenu; } private _outgoingHistoryItemGroupContextMenu: IMenu; get outgoingHistoryItemGroupContextMenu(): IMenu { return this._outgoingHistoryItemGroupContextMenu; } </del> constructor( @IContextKeyService private readonly contextKeyService: IContextKeyService, <del> @IMenuService private readonly menuService: IMenuService) { this._incomingHistoryItemGroupMenu = this.menuService.createMenu(MenuId.SCMIncomingChanges, this.contextKeyService); this.disposables.add(this._incomingHistoryItemGroupMenu); </del> <ins> @IMenuService private readonly menuService: IMenuService) { } </ins> <del> this._incomingHistoryItemGroupContextMenu = this.menuService.createMenu(MenuId.SCMIncomingChangesContext, this.contextKeyService); this.disposables.add(this._incomingHistoryItemGroupContextMenu); this._outgoingHistoryItemGroupMenu = this.menuService.createMenu(MenuId.SCMOutgoingChanges, this.contextKeyService); this.disposables.add(this._outgoingHistoryItemGroupMenu); </del> <ins> getHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu { return this.getOrCreateHistoryItemMenu(historyItem); } </ins> <del> this._outgoingHistoryItemGroupContextMenu = this.menuService.createMenu(MenuId.SCMOutgoingChangesContext, this.contextKeyService); this.disposables.add(this._outgoingHistoryItemGroupContextMenu); </del> <ins> getHistoryItemGroupMenu(historyItemGroup: SCMHistoryItemGroupTreeElement): IMenu { return historyItemGroup.direction === 'incoming' ? this.menuService.createMenu(MenuId.SCMIncomingChanges, this.contextKeyService) : this.getOutgoingHistoryItemGroupMenu(MenuId.SCMOutgoingChanges, historyItemGroup); </ins> } <del> getHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu { return this.getOrCreateHistoryItemMenu(historyItem); </del> <ins> getHistoryItemGroupContextMenu(historyItemGroup: SCMHistoryItemGroupTreeElement): IMenu { return historyItemGroup.direction === 'incoming' ? this.menuService.createMenu(MenuId.SCMIncomingChangesContext, this.contextKeyService) : this.getOutgoingHistoryItemGroupMenu(MenuId.SCMOutgoingChangesContext, historyItemGroup); </ins> } private getOrCreateHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu {

return result; } <ins> private getOutgoingHistoryItemGroupMenu(menuId: MenuId, historyItemGroup: SCMHistoryItemGroupTreeElement): IMenu { const contextKeyService = this.contextKeyService.createOverlay([ ['scmHistoryItemGroupHasUpstream', !!historyItemGroup.repository.provider.historyProvider?.currentHistoryItemGroup?.base], ]); return this.menuService.createMenu(menuId, contextKeyService); } </ins> dispose(): void { this.disposables.dispose(); }

const historyProviderMenu = repositoryMenus.historyProviderMenu; if (historyProviderMenu) { <del> const menuId = historyItemGroup.direction === 'incoming' ? MenuId.SCMIncomingChanges : MenuId.SCMOutgoingChanges; const menu = historyItemGroup.direction === 'incoming' ? historyProviderMenu.incomingHistoryItemGroupMenu : historyProviderMenu.outgoingHistoryItemGroupMenu; </del> <ins> const menu = historyProviderMenu.getHistoryItemGroupMenu(historyItemGroup); const resetMenuId = historyItemGroup.direction === 'incoming' ? MenuId.SCMIncomingChanges : MenuId.SCMOutgoingChanges; </ins> templateData.elementDisposables.add(connectPrimaryMenu(menu, (primary, secondary) => { <del> templateData.toolBar.setActions(primary, secondary, [menuId]); </del> <ins> templateData.toolBar.setActions(primary, secondary, [resetMenuId]); </ins> })); templateData.toolBar.context = historyItemGroup;

} } else if (isSCMHistoryItemGroupTreeElement(element)) { const menus = this.scmViewService.menus.getRepositoryMenus(element.repository.provider); <del> const menu = element.direction === 'incoming' ? menus.historyProviderMenu?.incomingHistoryItemGroupContextMenu : menus.historyProviderMenu?.outgoingHistoryItemGroupContextMenu; </del> <ins> const menu = menus.historyProviderMenu?.getHistoryItemGroupContextMenu(element); </ins> if (menu) { actionRunner = new HistoryItemGroupActionRunner();

import { ISCMRepository } from 'vs/workbench/contrib/scm/common/scm'; export interface ISCMHistoryProviderMenus { <del> readonly incomingHistoryItemGroupMenu: IMenu; readonly incomingHistoryItemGroupContextMenu: IMenu; readonly outgoingHistoryItemGroupMenu: IMenu; readonly outgoingHistoryItemGroupContextMenu: IMenu; </del> <ins> getHistoryItemGroupMenu(historyItemGroup: SCMHistoryItemGroupTreeElement): IMenu; getHistoryItemGroupContextMenu(historyItemGroup: SCMHistoryItemGroupTreeElement): IMenu; </ins> getHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu; }