diff --git a/package.json b/package.json index dc58f90..44c3d69 100644 --- a/package.json +++ b/package.json @@ -3495,11 +3495,31 @@ { "command": "gitlens.views.pull", "when": "viewItem == gitlens:repository && gitlens:hasRemotes", - "group": "1_gitlens@2" + "group": "1_gitlens@1" }, { "command": "gitlens.views.push", "when": "viewItem == gitlens:repository && gitlens:hasRemotes", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.views.pull", + "when": "viewItem == gitlens:status:upstream:behind && gitlens:hasRemotes", + "group": "inline@1" + }, + { + "command": "gitlens.views.push", + "when": "viewItem == gitlens:status:upstream:ahead && gitlens:hasRemotes", + "group": "inline@1" + }, + { + "command": "gitlens.views.pull", + "when": "viewItem == gitlens:status:upstream:behind && gitlens:hasRemotes", + "group": "1_gitlens@2" + }, + { + "command": "gitlens.views.push", + "when": "viewItem == gitlens:status:upstream:ahead && gitlens:hasRemotes", "group": "1_gitlens@3" }, { diff --git a/src/views/nodes/statusUpstreamNode.ts b/src/views/nodes/statusUpstreamNode.ts index afcc6d5..ddd3f04 100644 --- a/src/views/nodes/statusUpstreamNode.ts +++ b/src/views/nodes/statusUpstreamNode.ts @@ -7,6 +7,7 @@ import { RepositoriesView } from '../repositoriesView'; import { CommitNode } from './commitNode'; import { ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; +import { RepositoryNode } from './repositoryNode'; import { PageableViewNode, ResourceType, ViewNode } from './viewNode'; export class StatusUpstreamNode extends ViewNode implements PageableViewNode { @@ -16,7 +17,7 @@ export class StatusUpstreamNode extends ViewNode implements PageableViewNode { constructor( public readonly status: GitStatus, public readonly direction: 'ahead' | 'behind', - parent: ViewNode, + parent: RepositoryNode, public readonly view: RepositoriesView ) { super(GitUri.fromRepoPath(status.repoPath), parent); @@ -76,7 +77,7 @@ export class StatusUpstreamNode extends ViewNode implements PageableViewNode { const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.StatusUpstream; + item.contextValue = ahead ? ResourceType.StatusAheadOfUpstream : ResourceType.StatusBehindUpstream; item.tooltip = `${label}${ahead ? ' of ' : ''}${this.status.upstream}`; const iconSuffix = ahead ? 'upload' : 'download'; diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index 630d848..ef0a44e 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -40,7 +40,8 @@ export enum ResourceType { Stashes = 'gitlens:stashes', StatusFileCommits = 'gitlens:status:file:commits', StatusFiles = 'gitlens:status:files', - StatusUpstream = 'gitlens:status:upstream', + StatusAheadOfUpstream = 'gitlens:status:upstream:ahead', + StatusBehindUpstream = 'gitlens:status:upstream:behind', Tag = 'gitlens:tag', Tags = 'gitlens:tags' } diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index 62d7340..9241d11 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -113,13 +113,19 @@ export class ViewCommands implements Disposable { return node.fetch(); } - private pull(node: RepositoryNode) { + private pull(node: RepositoryNode | StatusUpstreamNode) { + if (node instanceof StatusUpstreamNode) { + node = node.getParent() as RepositoryNode; + } if (!(node instanceof RepositoryNode)) return; return node.pull(); } - private push(node: RepositoryNode) { + private push(node: RepositoryNode | StatusUpstreamNode) { + if (node instanceof StatusUpstreamNode) { + node = node.getParent() as RepositoryNode; + } if (!(node instanceof RepositoryNode)) return; return node.push();