Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants.commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const enum Commands {
ViewsCopy = 'gitlens.views.copy',
ViewsCopyAsMarkdown = 'gitlens.views.copyAsMarkdown',
ViewsCopyUrl = 'gitlens.views.copyUrl',
ViewsOpenAllChangedFileDiffs = 'gitlens.views.openChangedFileDiffs',
ViewsOpenDirectoryDiff = 'gitlens.views.openDirectoryDiff',
ViewsOpenDirectoryDiffWithWorking = 'gitlens.views.openDirectoryDiffWithWorking',
ViewsOpenUrl = 'gitlens.views.openUrl',
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/apps/plus/home/components/active-work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
html`<action-item
label="Open Pull Request Changes"
icon="request-changes"
href=${createCommandLink('gitlens.home.openPullRequestComparison', branchRefs)}
href=${createCommandLink('gitlens.home.openPullRequestChanges', branchRefs)}
></action-item>`,
);
actions.push(
Expand Down
4 changes: 2 additions & 2 deletions src/webviews/apps/plus/home/components/branch-section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const branchCardStyles = css`
right: 0.4rem;
bottom: 0.4rem;
padding: 0.2rem 0.4rem;
background-color: var(--gl-card-background);
background-color: var(--gl-card-hover-background);
}

.branch-item:not(:focus-within):not(:hover) .branch-item__actions {
Expand Down Expand Up @@ -351,7 +351,7 @@ export class GlBranchCard extends LitElement {
html`<action-item
label="Open Pull Request Changes"
icon="request-changes"
href=${this.createCommandLink('gitlens.home.openPullRequestComparison')}
href=${this.createCommandLink('gitlens.home.openPullRequestChanges')}
></action-item>`,
);
actions.push(
Expand Down
18 changes: 18 additions & 0 deletions src/webviews/home/homeWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { ContextKeys } from '../../constants.context';
import type { HomeTelemetryContext } from '../../constants.telemetry';
import type { Container } from '../../container';
import { executeGitCommand } from '../../git/actions';
import { openComparisonChanges } from '../../git/actions/commit';
import * as RepoActions from '../../git/actions/repository';
import type { BranchContributorOverview } from '../../git/gitProvider';
import type { GitBranch } from '../../git/models/branch';
Expand Down Expand Up @@ -266,6 +267,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
() => this.container.subscription.validate({ force: true }),
this,
),
registerCommand('gitlens.home.openPullRequestChanges', this.pullRequestChanges, this),
registerCommand('gitlens.home.openPullRequestComparison', this.pullRequestCompare, this),
registerCommand('gitlens.home.openPullRequestOnRemote', this.pullRequestViewOnRemote, this),
registerCommand('gitlens.home.createPullRequest', this.pullRequestCreate, this),
Expand Down Expand Up @@ -780,6 +782,22 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
);
}

private async pullRequestChanges(refs: BranchRef) {
const pr = await this.findPullRequest(refs);
if (pr?.refs?.base == null || pr.refs.head == null) return;

const comparisonRefs = getComparisonRefsForPullRequest(refs.repoPath, pr.refs);
return openComparisonChanges(
this.container,
{
repoPath: comparisonRefs.repoPath,
lhs: comparisonRefs.base.ref,
rhs: comparisonRefs.head.ref,
},
{ title: `Changes in Pull Request #${pr.id}` },
);
}

private async pullRequestViewOnRemote(refs: BranchRef, clipboard?: boolean) {
const pr = await this.findPullRequest(refs);
if (pr == null) return;
Expand Down
Loading