瀏覽代碼

Adds compare button to compare view

main
Eric Amodio 6 年之前
父節點
當前提交
126b838563
共有 2 個文件被更改,包括 25 次插入0 次删除
  1. +18
    -0
      package.json
  2. +7
    -0
      src/views/nodes/compareNode.ts

+ 18
- 0
package.json 查看文件

@ -2369,6 +2369,15 @@
"category": "GitLens"
},
{
"command": "gitlens.views.compare.selectForCompare",
"title": "Compare Branch or Tag with...",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-compare-refs.svg",
"light": "images/light/icon-compare-refs.svg"
}
},
{
"command": "gitlens.views.compare.clear",
"title": "Clear Results",
"category": "GitLens",
@ -2990,6 +2999,10 @@
"when": "false"
},
{
"command": "gitlens.views.compare.selectForCompare",
"when": "gitlens:enabled && gitlens.views.compare.enabled"
},
{
"command": "gitlens.views.compare.clear",
"when": "false"
},
@ -3399,6 +3412,11 @@
"group": "1_gitlens"
},
{
"command": "gitlens.views.compare.selectForCompare",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "navigation@1"
},
{
"command": "gitlens.views.compare.clear",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "navigation@2"

+ 7
- 0
src/views/nodes/compareNode.ts 查看文件

@ -148,6 +148,7 @@ export class CompareNode extends ViewNode {
}
if (repoPath === undefined) return;
let autoCompare = false;
if (ref === undefined) {
const pick = await new BranchesAndTagsQuickPick(repoPath).show(
`Select branch or tag for compare${GlyphChars.Ellipsis}`
@ -155,6 +156,8 @@ export class CompareNode extends ViewNode {
if (pick === undefined || pick instanceof CommandQuickPickItem) return;
ref = pick.name;
autoCompare = true;
}
this._selectedRef = { label: this.getRefName(ref), repoPath: repoPath, ref: ref };
@ -163,6 +166,10 @@ export class CompareNode extends ViewNode {
await this.view.show();
void (await this.triggerChange());
if (autoCompare) {
void (await this.compareWithSelected());
}
}
private getRefName(ref: string | NamedRef) {

Loading…
取消
儲存