Use pr source branch as title in branch list

This commit is contained in:
Mattias Granlund 2024-06-30 16:30:36 +02:00
parent 8851780851
commit d4c0b97f7d
5 changed files with 12 additions and 10 deletions

View File

@ -31,7 +31,9 @@ export class CombinedBranch {
}
get displayName(): string {
return this.remoteBranch?.displayName || this.vbranch?.name || 'unknown';
return (
this.pr?.sourceBranch || this.remoteBranch?.displayName || this.vbranch?.name || 'unknown'
);
}
get authors(): Author[] {
@ -101,7 +103,7 @@ export class CombinedBranch {
if (this.vbranch) identifiers.push(this.vbranch.name);
if (this.pr) {
identifiers.push(this.pr.title);
identifiers.push(this.pr.targetBranch);
identifiers.push(this.pr.sourceBranch);
this.pr.author?.email && identifiers.push(this.pr.author.email);
this.pr.author?.name && identifiers.push(this.pr.author.name);
}

View File

@ -67,7 +67,7 @@
await remotesService.addRemote(project.id, remoteName, remoteUrl);
await baseBranchService.fetchFromRemotes();
await branchController.createvBranchFromBranch(
`refs/remotes/${remoteName}/${pullrequest.targetBranch}`
`refs/remotes/${remoteName}/${pullrequest.sourceBranch}`
);
await virtualBranchService.reload();
const vbranch = await virtualBranchService.getByUpstreamSha(pullrequest.sha);
@ -132,11 +132,11 @@
</span>
wants to merge into
<span class="code-string">
{pullrequest.sourceBranch}
{pullrequest.targetBranch}
</span>
from
<span class="code-string">
{pullrequest.targetBranch}
{pullrequest.sourceBranch}
</span>
</div>
{#if pullrequest.body}

View File

@ -15,8 +15,8 @@ export interface PullRequest {
author: Author | null;
labels: Label[];
draft: boolean;
targetBranch: string;
sourceBranch: string;
targetBranch: string;
sha: string;
createdAt: Date;
modifiedAt: Date;
@ -102,8 +102,8 @@ export function ghResponseToInstance(
draft: pr.draft || false,
createdAt: new Date(pr.created_at),
modifiedAt: new Date(pr.created_at),
targetBranch: pr.head.ref,
sourceBranch: pr.base.ref,
sourceBranch: pr.head.ref,
targetBranch: pr.base.ref,
sha: pr.head.sha,
mergedAt: pr.merged_at ? new Date(pr.merged_at) : undefined,
closedAt: pr.closed_at ? new Date(pr.closed_at) : undefined,

View File

@ -11,7 +11,7 @@
function getBranchLink(b: CombinedBranch): string | undefined {
if (b.vbranch?.active) return `/${projectId}/board/`;
if (b.vbranch) return `/${projectId}/stashed/${b.vbranch.id}`;
if (b.remoteBranch) return `/${projectId}/remote/${branch?.displayName}`;
if (b.remoteBranch) return `/${projectId}/remote/${branch?.remoteBranch?.displayName}`;
if (b.pr) return `/${projectId}/pull/${b.pr.number}`;
}

View File

@ -86,7 +86,7 @@
isFetchingChecks = true;
try {
checksStatus = await githubService.checks($pr$?.targetBranch);
checksStatus = await githubService.checks($pr$?.sourceBranch);
} catch (e: any) {
console.error(e);
checksError = e.message;