Skip to content

Commit 3818370

Browse files
committed
Adds explain stash to commit graph
1 parent 0e42e58 commit 3818370

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

contributions.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
}
4949
]
5050
}
51-
},
52-
"commandPalette": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
5351
},
5452
"gitlens.ai.generateChangelog": {
5553
"label": "Generate Changelog (Preview)...",
@@ -1998,6 +1996,18 @@
19981996
]
19991997
}
20001998
},
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+
},
20012011
"gitlens.graph.fetch": {
20022012
"label": "Fetch",
20032013
"icon": "$(repo-fetch)",

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6799,6 +6799,10 @@
67996799
"command": "gitlens.graph.explainCommit",
68006800
"title": "Explain Commit"
68016801
},
6802+
{
6803+
"command": "gitlens.graph.explainStash",
6804+
"title": "Explain Stash"
6805+
},
68026806
{
68036807
"command": "gitlens.graph.fetch",
68046808
"title": "Fetch",
@@ -10944,6 +10948,10 @@
1094410948
"command": "gitlens.graph.explainCommit",
1094510949
"when": "false"
1094610950
},
10951+
{
10952+
"command": "gitlens.graph.explainStash",
10953+
"when": "false"
10954+
},
1094710955
{
1094810956
"command": "gitlens.graph.fetch",
1094910957
"when": "false"
@@ -20264,6 +20272,11 @@
2026420272
"when": "webviewItem == gitlens:stash && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders",
2026520273
"group": "1_gitlens_actions@3"
2026620274
},
20275+
{
20276+
"command": "gitlens.graph.explainStash",
20277+
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
20278+
"group": "1_gitlens_actions_3@1"
20279+
},
2026720280
{
2026820281
"command": "gitlens.graph.switchToTag",
2026920282
"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)