Skip to content

Commit d4c0b97

Browse files
committed
Use pr source branch as title in branch list
1 parent 8851780 commit d4c0b97

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

app/src/lib/branches/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export class CombinedBranch {
3131
}
3232

3333
get displayName(): string {
34-
return this.remoteBranch?.displayName || this.vbranch?.name || 'unknown';
34+
return (
35+
this.pr?.sourceBranch || this.remoteBranch?.displayName || this.vbranch?.name || 'unknown'
36+
);
3537
}
3638

3739
get authors(): Author[] {
@@ -101,7 +103,7 @@ export class CombinedBranch {
101103
if (this.vbranch) identifiers.push(this.vbranch.name);
102104
if (this.pr) {
103105
identifiers.push(this.pr.title);
104-
identifiers.push(this.pr.targetBranch);
106+
identifiers.push(this.pr.sourceBranch);
105107
this.pr.author?.email && identifiers.push(this.pr.author.email);
106108
this.pr.author?.name && identifiers.push(this.pr.author.name);
107109
}

app/src/lib/components/PullRequestPreview.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
await remotesService.addRemote(project.id, remoteName, remoteUrl);
6868
await baseBranchService.fetchFromRemotes();
6969
await branchController.createvBranchFromBranch(
70-
`refs/remotes/${remoteName}/${pullrequest.targetBranch}`
70+
`refs/remotes/${remoteName}/${pullrequest.sourceBranch}`
7171
);
7272
await virtualBranchService.reload();
7373
const vbranch = await virtualBranchService.getByUpstreamSha(pullrequest.sha);
@@ -132,11 +132,11 @@
132132
</span>
133133
wants to merge into
134134
<span class="code-string">
135-
{pullrequest.sourceBranch}
135+
{pullrequest.targetBranch}
136136
</span>
137137
from
138138
<span class="code-string">
139-
{pullrequest.targetBranch}
139+
{pullrequest.sourceBranch}
140140
</span>
141141
</div>
142142
{#if pullrequest.body}

app/src/lib/github/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export interface PullRequest {
1515
author: Author | null;
1616
labels: Label[];
1717
draft: boolean;
18-
targetBranch: string;
1918
sourceBranch: string;
19+
targetBranch: string;
2020
sha: string;
2121
createdAt: Date;
2222
modifiedAt: Date;
@@ -102,8 +102,8 @@ export function ghResponseToInstance(
102102
draft: pr.draft || false,
103103
createdAt: new Date(pr.created_at),
104104
modifiedAt: new Date(pr.created_at),
105-
targetBranch: pr.head.ref,
106-
sourceBranch: pr.base.ref,
105+
sourceBranch: pr.head.ref,
106+
targetBranch: pr.base.ref,
107107
sha: pr.head.sha,
108108
mergedAt: pr.merged_at ? new Date(pr.merged_at) : undefined,
109109
closedAt: pr.closed_at ? new Date(pr.closed_at) : undefined,

app/src/lib/navigation/BranchItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
function getBranchLink(b: CombinedBranch): string | undefined {
1212
if (b.vbranch?.active) return `/${projectId}/board/`;
1313
if (b.vbranch) return `/${projectId}/stashed/${b.vbranch.id}`;
14-
if (b.remoteBranch) return `/${projectId}/remote/${branch?.displayName}`;
14+
if (b.remoteBranch) return `/${projectId}/remote/${branch?.remoteBranch?.displayName}`;
1515
if (b.pr) return `/${projectId}/pull/${b.pr.number}`;
1616
}
1717

app/src/lib/pr/PullRequestCard.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
isFetchingChecks = true;
8787
8888
try {
89-
checksStatus = await githubService.checks($pr$?.targetBranch);
89+
checksStatus = await githubService.checks($pr$?.sourceBranch);
9090
} catch (e: any) {
9191
console.error(e);
9292
checksError = e.message;

0 commit comments

Comments
 (0)