Skip to content

Commit a1f3b40

Browse files
committed
Swaps compare for open in worktree
Refs #3615
1 parent af5f8d9 commit a1f3b40

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7393,7 +7393,7 @@
73937393
"command": "gitlens.views.openInWorktree",
73947394
"title": "Open in Worktree",
73957395
"category": "GitLens",
7396-
"icon": "$(window)"
7396+
"icon": "$(empty-window)"
73977397
},
73987398
{
73997399
"command": "gitlens.views.openWorktree",
@@ -14606,36 +14606,36 @@
1460614606
"when": "viewItem =~ /gitlens:(pullrequest\\b(?=.*?\\b\\+refs\\b)|launchpad:item\\b(?=.*?\\b\\+pr\\b))/ && config.multiDiffEditor.experimental.enabled",
1460714607
"group": "inline@2"
1460814608
},
14609-
{
14610-
"command": "gitlens.views.openPullRequestComparison",
14611-
"when": "viewItem =~ /gitlens:(pullrequest\\b(?=.*?\\b\\+refs\\b)|launchpad:item\\b(?=.*?\\b\\+pr\\b))/",
14612-
"group": "inline@3"
14613-
},
1461414609
{
1461514610
"command": "gitlens.openPullRequestOnRemote",
1461614611
"when": "viewItem =~ /gitlens:(pullrequest\\b|launchpad:item\\b(?=.*?\\b\\+pr\\b))/",
14617-
"group": "inline@99",
14612+
"group": "inline@98",
1461814613
"alt": "gitlens.copyRemotePullRequestUrl"
1461914614
},
1462014615
{
14621-
"command": "gitlens.views.openPullRequestChanges",
14622-
"when": "!listMultiSelection && viewItem =~ /gitlens:(pullrequest\\b(?=.*?\\b\\+refs\\b)|launchpad:item\\b(?=.*?\\b\\+pr\\b))/ && config.multiDiffEditor.experimental.enabled",
14623-
"group": "1_gitlens_actions@1"
14616+
"command": "gitlens.views.openInWorktree",
14617+
"when": "!listMultiSelection && viewItem =~ /gitlens:(pullrequest\\b|launchpad:item\\b(?=.*?\\b\\+pr\\b))/",
14618+
"group": "inline@99"
1462414619
},
1462514620
{
1462614621
"command": "gitlens.views.openPullRequest",
1462714622
"when": "!listMultiSelection && gitlens:action:openPullRequest > 1 && viewItem =~ /gitlens:pullrequest\\b/",
14628-
"group": "1_gitlens_actions@98"
14623+
"group": "1_gitlens_actions@1"
1462914624
},
1463014625
{
14631-
"command": "gitlens.openPullRequestOnRemote",
14626+
"command": "gitlens.views.openInWorktree",
1463214627
"when": "!listMultiSelection && viewItem =~ /gitlens:(pullrequest\\b|launchpad:item\\b(?=.*?\\b\\+pr\\b))/",
14633-
"group": "1_gitlens_actions@99"
14628+
"group": "1_gitlens_actions@2"
1463414629
},
1463514630
{
14636-
"command": "gitlens.views.openInWorktree",
14631+
"command": "gitlens.views.openPullRequestChanges",
14632+
"when": "!listMultiSelection && viewItem =~ /gitlens:(pullrequest\\b(?=.*?\\b\\+refs\\b)|launchpad:item\\b(?=.*?\\b\\+pr\\b))/ && config.multiDiffEditor.experimental.enabled",
14633+
"group": "2_gitlens_quickopen@1"
14634+
},
14635+
{
14636+
"command": "gitlens.openPullRequestOnRemote",
1463714637
"when": "!listMultiSelection && viewItem =~ /gitlens:(pullrequest\\b|launchpad:item\\b(?=.*?\\b\\+pr\\b))/",
14638-
"group": "1_gitlens_actions@100"
14638+
"group": "2_gitlens_quickopen@2"
1463914639
},
1464014640
{
1464114641
"command": "gitlens.showInCommitGraph",

src/plus/launchpad/launchpadProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ export class LaunchpadProvider implements Disposable {
518518
async openInGraph(item: LaunchpadItem) {
519519
const deepLinkUrl = this.getItemBranchDeepLink(item);
520520
if (deepLinkUrl == null) return;
521+
521522
await this.container.deepLinks.processDeepLinkUri(deepLinkUrl, false);
522523
}
523524

@@ -526,8 +527,9 @@ export class LaunchpadProvider implements Disposable {
526527
}
527528

528529
private getItemBranchDeepLink(item: LaunchpadItem, action?: DeepLinkActionType): Uri | undefined {
529-
if (item.type !== 'pullrequest' || item.headRef == null || item.repoIdentity?.remote?.url == null)
530+
if (item.type !== 'pullrequest' || item.headRef == null || item.repoIdentity?.remote?.url == null) {
530531
return undefined;
532+
}
531533

532534
const branchName =
533535
action == null && item.openRepository?.localBranch?.current

src/views/viewCommands.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,15 @@ export class ViewCommands {
792792
skipWorktreeConfirmations: true,
793793
},
794794
});
795-
} else if (node.is('pullrequest') || node.is('launchpad-item')) {
795+
}
796+
797+
if (node.is('pullrequest') || node.is('launchpad-item')) {
796798
const pr = node.pullRequest;
797799
if (pr?.refs?.head == null) return Promise.resolve();
800+
798801
const repoIdentity = getRepositoryIdentityForPullRequest(pr);
799802
if (repoIdentity.remote.url == null) return Promise.resolve();
803+
800804
const deepLink = getPullRequestBranchDeepLink(
801805
this.container,
802806
pr.refs.head.branch,

0 commit comments

Comments
 (0)