瀏覽代碼

Adds pull to behind upstream & push to ahead upstream nodes

main
Eric Amodio 6 年之前
父節點
當前提交
37bf8835f4
共有 4 個文件被更改,包括 34 次插入6 次删除
  1. +21
    -1
      package.json
  2. +3
    -2
      src/views/nodes/statusUpstreamNode.ts
  3. +2
    -1
      src/views/nodes/viewNode.ts
  4. +8
    -2
      src/views/viewCommands.ts

+ 21
- 1
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"
},
{

+ 3
- 2
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';

+ 2
- 1
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'
}

+ 8
- 2
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();

Loading…
取消
儲存