Skip to content

Commit

Permalink
Updates getPullRequestBranchDeepLink to require PR input
Browse files Browse the repository at this point in the history
  • Loading branch information
axosoft-ramint committed Jan 29, 2025
1 parent 5c072ea commit 353086f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/plus/launchpad/launchpadProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,10 @@ export class LaunchpadProvider implements Disposable {

return getPullRequestBranchDeepLink(
this.container,
item.underlyingPullRequest,
branchName,
item.repoIdentity.remote.url,
action,
item.underlyingPullRequest,
);
}

Expand Down Expand Up @@ -1061,10 +1061,10 @@ function ensureRemoteUrl(url: string) {

export function getPullRequestBranchDeepLink(
container: Container,
pr: PullRequest,
headRefBranchName: string,
remoteUrl: string,
action?: DeepLinkActionType,
pr?: PullRequest,
): Uri {
const schemeOverride = configuration.get('deepLinks.schemeOverride');
const scheme = typeof schemeOverride === 'string' ? schemeOverride : env.uriScheme;
Expand All @@ -1075,11 +1075,10 @@ export function getPullRequestBranchDeepLink(
if (action) {
searchParams.set('action', action);
}
if (pr) {
searchParams.set('prId', pr.id);
searchParams.set('prTitle', pr.title);
}
if (pr?.refs) {

searchParams.set('prId', pr.id);
searchParams.set('prTitle', pr.title);
if (pr.refs) {
searchParams.set('prBaseRef', pr.refs.base.sha);
searchParams.set('prHeadRef', pr.refs.head.sha);
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/viewCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,10 +913,10 @@ export class ViewCommands implements Disposable {
if (remoteUrl != null) {
const deepLink = getPullRequestBranchDeepLink(
this.container,
pr,
node.branch.getNameWithoutRemote(),
remoteUrl,
DeepLinkActionType.SwitchToPullRequestWorktree,
pr,
);

return this.container.deepLinks.processDeepLinkUri(deepLink, false, node.repo);
Expand All @@ -942,10 +942,10 @@ export class ViewCommands implements Disposable {

const deepLink = getPullRequestBranchDeepLink(
this.container,
pr,
pr.refs.head.branch,
repoIdentity.remote.url,
DeepLinkActionType.SwitchToPullRequestWorktree,
pr,
);

const prRepo = await getOrOpenPullRequestRepository(this.container, pr, {
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/plus/graph/graphWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3886,10 +3886,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
if (remoteUrl != null) {
const deepLink = getPullRequestBranchDeepLink(
this.container,
pr,
branch.getNameWithoutRemote(),
remoteUrl,
DeepLinkActionType.SwitchToPullRequestWorktree,
pr,
);

return this.container.deepLinks.processDeepLinkUri(deepLink, false, repo);
Expand Down

0 comments on commit 353086f

Please sign in to comment.