Skip to content

Commit 3507ebe

Browse files
d13sergeibbb
authored andcommitted
Adds explain stash to commit graph
1 parent f3efa26 commit 3507ebe

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

contributions.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,18 @@
20002000
]
20012001
}
20022002
},
2003+
"gitlens.graph.explainStash": {
2004+
"label": "Explain Stash",
2005+
"menus": {
2006+
"webview/context": [
2007+
{
2008+
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
2009+
"group": "1_gitlens_actions_3",
2010+
"order": 1
2011+
}
2012+
]
2013+
}
2014+
},
20032015
"gitlens.graph.fetch": {
20042016
"label": "Fetch",
20052017
"icon": "$(repo-fetch)",

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,6 +6831,10 @@
68316831
"command": "gitlens.graph.explainCommit",
68326832
"title": "Explain Commit"
68336833
},
6834+
{
6835+
"command": "gitlens.graph.explainStash",
6836+
"title": "Explain Stash"
6837+
},
68346838
{
68356839
"command": "gitlens.graph.fetch",
68366840
"title": "Fetch",
@@ -10980,6 +10984,10 @@
1098010984
"command": "gitlens.graph.explainCommit",
1098110985
"when": "false"
1098210986
},
10987+
{
10988+
"command": "gitlens.graph.explainStash",
10989+
"when": "false"
10990+
},
1098310991
{
1098410992
"command": "gitlens.graph.fetch",
1098510993
"when": "false"
@@ -20300,6 +20308,11 @@
2030020308
"when": "webviewItem == gitlens:stash && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders",
2030120309
"group": "1_gitlens_actions@3"
2030220310
},
20311+
{
20312+
"command": "gitlens.graph.explainStash",
20313+
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
20314+
"group": "1_gitlens_actions_3@1"
20315+
},
2030320316
{
2030420317
"command": "gitlens.graph.switchToTag",
2030520318
"when": "webviewItem =~ /gitlens:tag\\b/ && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders",

src/constants.commands.generated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export type ContributedCommands =
7272
| 'gitlens.graph.deleteBranch'
7373
| 'gitlens.graph.deleteTag'
7474
| 'gitlens.graph.explainCommit'
75+
| 'gitlens.graph.explainStash'
7576
| 'gitlens.graph.fetch'
7677
| 'gitlens.graph.hideLocalBranch'
7778
| 'gitlens.graph.hideRefGroup'

src/webviews/plus/graph/graphWebview.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
687687
),
688688
this.host.registerWebviewCommand('gitlens.graph.ai.generateCommitMessage', this.generateCommitMessage),
689689
this.host.registerWebviewCommand('gitlens.graph.explainCommit', this.explainCommit),
690+
this.host.registerWebviewCommand('gitlens.graph.explainStash', this.explainStash),
690691

691692
this.host.registerWebviewCommand('gitlens.graph.compareSelectedCommits.multi', this.compareSelectedCommits),
692693
this.host.registerWebviewCommand('gitlens.graph.abortPausedOperation', this.abortPausedOperation),
@@ -3815,6 +3816,18 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
38153816
});
38163817
}
38173818

3819+
@log()
3820+
private explainStash(item?: GraphItemContext) {
3821+
const ref = this.getGraphItemRef(item, 'stash');
3822+
if (ref == null) return Promise.resolve();
3823+
3824+
return executeCommand('gitlens.ai.explainStash', {
3825+
repoPath: ref.repoPath,
3826+
ref: ref.ref,
3827+
source: { source: 'graph', type: 'stash' },
3828+
});
3829+
}
3830+
38183831
@log()
38193832
private async openFiles(item?: GraphItemContext) {
38203833
const commit = await this.getCommitFromGraphItemRef(item);

0 commit comments

Comments
 (0)