Skip to content

Commit f7ac992

Browse files
committed
Adds explain stash to commit graph
1 parent 09d6ee8 commit f7ac992

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
@@ -1996,6 +1996,18 @@
19961996
]
19971997
}
19981998
},
1999+
"gitlens.graph.explainStash": {
2000+
"label": "Explain Stash",
2001+
"menus": {
2002+
"webview/context": [
2003+
{
2004+
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
2005+
"group": "1_gitlens_actions_3",
2006+
"order": 1
2007+
}
2008+
]
2009+
}
2010+
},
19992011
"gitlens.graph.fetch": {
20002012
"label": "Fetch",
20012013
"icon": "$(repo-fetch)",

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6812,6 +6812,10 @@
68126812
"command": "gitlens.graph.explainCommit",
68136813
"title": "Explain Commit"
68146814
},
6815+
{
6816+
"command": "gitlens.graph.explainStash",
6817+
"title": "Explain Stash"
6818+
},
68156819
{
68166820
"command": "gitlens.graph.fetch",
68176821
"title": "Fetch",
@@ -10957,6 +10961,10 @@
1095710961
"command": "gitlens.graph.explainCommit",
1095810962
"when": "false"
1095910963
},
10964+
{
10965+
"command": "gitlens.graph.explainStash",
10966+
"when": "false"
10967+
},
1096010968
{
1096110969
"command": "gitlens.graph.fetch",
1096210970
"when": "false"
@@ -20277,6 +20285,11 @@
2027720285
"when": "webviewItem == gitlens:stash && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders",
2027820286
"group": "1_gitlens_actions@3"
2027920287
},
20288+
{
20289+
"command": "gitlens.graph.explainStash",
20290+
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
20291+
"group": "1_gitlens_actions_3@1"
20292+
},
2028020293
{
2028120294
"command": "gitlens.graph.switchToTag",
2028220295
"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)