Skip to content

Commit e923bea

Browse files
committed
Closes #4087 adds cherry-pick multiselect to Graph
1 parent 9f02d20 commit e923bea

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

contributions.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,20 @@
14761476
"menus": {
14771477
"webview/context": [
14781478
{
1479-
"when": "webviewItem =~ /gitlens:commit\\b(?!.*?\\b\\+current\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1479+
"when": "webviewItem =~ /gitlens:commit\\b(?!.*?\\b\\+(current|rebase)\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1480+
"group": "1_gitlens_actions",
1481+
"order": 1
1482+
}
1483+
]
1484+
}
1485+
},
1486+
"gitlens.graph.cherryPick.multi": {
1487+
"label": "Cherry Pick Commits...",
1488+
"enablement": "!operationInProgress",
1489+
"menus": {
1490+
"webview/context": [
1491+
{
1492+
"when": "webviewItems =~ /gitlens:commit\\b(?!.*?\\b\\+(current|rebase)\\b)/ && listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
14801493
"group": "1_gitlens_actions",
14811494
"order": 1
14821495
}

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6386,6 +6386,11 @@
63866386
"title": "Cherry Pick Commit...",
63876387
"enablement": "!operationInProgress"
63886388
},
6389+
{
6390+
"command": "gitlens.graph.cherryPick.multi",
6391+
"title": "Cherry Pick Commits...",
6392+
"enablement": "!operationInProgress"
6393+
},
63896394
{
63906395
"command": "gitlens.graph.columnAuthorOff",
63916396
"title": "Hide Author Column",
@@ -10392,6 +10397,10 @@
1039210397
"command": "gitlens.graph.cherryPick",
1039310398
"when": "false"
1039410399
},
10400+
{
10401+
"command": "gitlens.graph.cherryPick.multi",
10402+
"when": "false"
10403+
},
1039510404
{
1039610405
"command": "gitlens.graph.columnAuthorOff",
1039710406
"when": "false"
@@ -18603,7 +18612,7 @@
1860318612
},
1860418613
{
1860518614
"command": "gitlens.graph.cherryPick",
18606-
"when": "webviewItem =~ /gitlens:commit\\b(?!.*?\\b\\+current\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
18615+
"when": "webviewItem =~ /gitlens:commit\\b(?!.*?\\b\\+(current|rebase)\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1860718616
"group": "1_gitlens_actions@1"
1860818617
},
1860918618
{
@@ -18881,6 +18890,11 @@
1888118890
"when": "webviewItemGroup =~ /gitlens:refGroup\\b(?!.*?\\b\\+current\\b)/",
1888218891
"group": "8_gitlens_actions@12"
1888318892
},
18893+
{
18894+
"command": "gitlens.graph.cherryPick.multi",
18895+
"when": "webviewItems =~ /gitlens:commit\\b(?!.*?\\b\\+(current|rebase)\\b)/ && listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
18896+
"group": "1_gitlens_actions@1"
18897+
},
1888418898
{
1888518899
"command": "gitlens.graph.openCommitOnRemote.multi",
1888618900
"when": "webviewItems =~ /gitlens:commit\\b/ && listMultiSelection && gitlens:repos:withRemotes",

src/constants.commands.generated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type ContributedCommands =
2727
| 'gitlens.graph.addAuthor'
2828
| 'gitlens.graph.associateIssueWithBranch'
2929
| 'gitlens.graph.cherryPick'
30+
| 'gitlens.graph.cherryPick.multi'
3031
| 'gitlens.graph.columnAuthorOff'
3132
| 'gitlens.graph.columnAuthorOn'
3233
| 'gitlens.graph.columnChangesOff'

src/webviews/plus/graph/graphWebview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
532532
this.host.registerWebviewCommand('gitlens.graph.hideTag', this.hideRef),
533533

534534
this.host.registerWebviewCommand('gitlens.graph.cherryPick', this.cherryPick),
535+
this.host.registerWebviewCommand('gitlens.graph.cherryPick.multi', this.cherryPick),
535536
this.host.registerWebviewCommand<GraphItemContext>('gitlens.graph.copyRemoteCommitUrl', item =>
536537
this.openCommitOnRemote(item, true),
537538
),
@@ -3211,10 +3212,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
32113212

32123213
@log()
32133214
private cherryPick(item?: GraphItemContext) {
3214-
const ref = this.getGraphItemRef(item, 'revision');
3215-
if (ref == null) return Promise.resolve();
3215+
const { selection } = this.getGraphItemRefs(item, 'revision');
3216+
if (selection == null) return Promise.resolve();
32163217

3217-
return RepoActions.cherryPick(ref.repoPath, ref);
3218+
return RepoActions.cherryPick(selection[0].repoPath, selection);
32183219
}
32193220

32203221
@log()

0 commit comments

Comments
 (0)