Browse Source

Adds compare button to compare view

main
Eric Amodio 6 years ago
parent
commit
126b838563
2 changed files with 25 additions and 0 deletions
  1. +18
    -0
      package.json
  2. +7
    -0
      src/views/nodes/compareNode.ts

+ 18
- 0
package.json View File

@ -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 View File

@ -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…
Cancel
Save