mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 02:26:14 +03:00
fix: more conflict clean up
This commit is contained in:
parent
e842b282ae
commit
907bbe838d
@ -48,12 +48,12 @@ export class AzureDevOps implements GitHost {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getAvailablePrTemplates(_path?: string) {
|
||||
async availablePullRequestTemplates(_path?: string) {
|
||||
// See: https://learn.microsoft.com/en-us/azure/devops/repos/git/pull-request-templates?view=azure-devops#default-pull-request-templates
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getPrTemplateContent(_path?: string) {
|
||||
async pullRequestTemplateContent(_path?: string) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -52,12 +52,12 @@ export class BitBucket implements GitHost {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getAvailablePrTemplates(_path?: string) {
|
||||
async availablePullRequestTemplates(_path?: string) {
|
||||
// See: https://confluence.atlassian.com/bitbucketserver/create-a-pull-request-808488431.html#Createapullrequest-templatePullrequestdescriptiontemplates
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getPrTemplateContent(_path?: string) {
|
||||
async pullRequestTemplateContent(_path?: string) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { GitHubBranch } from './githubBranch';
|
||||
import { GitHubChecksMonitor } from './githubChecksMonitor';
|
||||
import { GitHubListingService } from './githubListingService';
|
||||
import { GitHubPrService } from './githubPrService';
|
||||
import { GitHubIssueService } from '$lib/gitHost/github/issueService';
|
||||
import { Octokit } from '@octokit/rest';
|
||||
import type { ProjectMetrics } from '$lib/metrics/projectMetrics';
|
||||
import type { RepoInfo } from '$lib/url/gitUrl';
|
||||
@ -50,6 +51,13 @@ export class GitHub implements GitHost {
|
||||
return new GitHubPrService(this.octokit, this.repo);
|
||||
}
|
||||
|
||||
issueService() {
|
||||
if (!this.octokit) {
|
||||
return;
|
||||
}
|
||||
return new GitHubIssueService(this.octokit, this.repo);
|
||||
}
|
||||
|
||||
checksMonitor(sourceBranch: string) {
|
||||
if (!this.octokit) {
|
||||
return;
|
||||
|
@ -7,8 +7,13 @@ import { sleep } from '$lib/utils/sleep';
|
||||
import posthog from 'posthog-js';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { GitHostPrService } from '$lib/gitHost/interface/gitHostPrService';
|
||||
import type { DetailedPullRequest, MergeMethod, PullRequest } from '$lib/gitHost/interface/types';
|
||||
import type { RepoInfo } from '$lib/url/gitUrl';
|
||||
import type {
|
||||
CreatePullRequestArgs,
|
||||
DetailedPullRequest,
|
||||
MergeMethod,
|
||||
PullRequest
|
||||
} from '../interface/types';
|
||||
import type { Octokit } from '@octokit/rest';
|
||||
|
||||
export class GitHubPrService implements GitHostPrService {
|
||||
@ -19,13 +24,13 @@ export class GitHubPrService implements GitHostPrService {
|
||||
private repo: RepoInfo
|
||||
) {}
|
||||
|
||||
async createPr(
|
||||
title: string,
|
||||
body: string,
|
||||
draft: boolean,
|
||||
baseBranchName: string,
|
||||
upstreamName: string
|
||||
): Promise<PullRequest> {
|
||||
async createPr({
|
||||
title,
|
||||
body,
|
||||
draft,
|
||||
baseBranchName,
|
||||
upstreamName
|
||||
}: CreatePullRequestArgs): Promise<PullRequest> {
|
||||
this.loading.set(true);
|
||||
const request = async () => {
|
||||
const resp = await this.octokit.rest.pulls.create({
|
||||
@ -37,6 +42,7 @@ export class GitHubPrService implements GitHostPrService {
|
||||
body,
|
||||
draft
|
||||
});
|
||||
|
||||
return ghResponseToInstance(resp.data);
|
||||
};
|
||||
|
||||
|
@ -53,12 +53,12 @@ export class GitLab implements GitHost {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getAvailablePrTemplates(_path?: string) {
|
||||
async availablePullRequestTemplates(_path?: string) {
|
||||
// See: https://docs.gitlab.com/ee/user/project/description_templates.html
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async getPrTemplateContent(_path?: string) {
|
||||
async pullRequestTemplateContent(_path?: string) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ export const [getGitHostPrService, createGitHostPrServiceStore] = buildContextSt
|
||||
export interface GitHostPrService {
|
||||
loading: Writable<boolean>;
|
||||
get(prNumber: number): Promise<DetailedPullRequest>;
|
||||
createPr(
|
||||
title: string,
|
||||
body: string,
|
||||
draft: boolean,
|
||||
baseBranchName: string,
|
||||
upstreamName: string
|
||||
): Promise<PullRequest>;
|
||||
createPr({
|
||||
title,
|
||||
body,
|
||||
draft,
|
||||
baseBranchName,
|
||||
upstreamName
|
||||
}: CreatePullRequestArgs): Promise<PullRequest>;
|
||||
getAvailablePrTemplates(path?: string): Promise<string[] | undefined>;
|
||||
getPrTemplateContent(path?: string): Promise<string | undefined>;
|
||||
merge(method: MergeMethod, prNumber: number): Promise<void>;
|
||||
|
@ -77,8 +77,10 @@ export type GitHostArguments = {
|
||||
forkStr?: string;
|
||||
};
|
||||
|
||||
export type CreatePullRequestArguments = {
|
||||
export type CreatePullRequestArgs = {
|
||||
title: string;
|
||||
body: string;
|
||||
draft: boolean;
|
||||
baseBranchName: string;
|
||||
upstreamName: string;
|
||||
};
|
||||
|
@ -115,21 +115,22 @@
|
||||
// Refresh base branch if git fetch event is detected.
|
||||
const mode = $derived(modeService.mode);
|
||||
const head = $derived(modeService.head);
|
||||
|
||||
// We end up with a `state_unsafe_mutation` when switching projects if we
|
||||
// don't use $effect.pre here.
|
||||
// TODO: can we eliminate the need to debounce?
|
||||
const fetch = $derived(fetchSignal.event);
|
||||
const debouncedBaseBranchResfresh = debounce(() => baseBranchService.refresh(), 500);
|
||||
$effect(() => {
|
||||
$effect.pre(() => {
|
||||
if ($fetch || $head) debouncedBaseBranchResfresh();
|
||||
});
|
||||
|
||||
// TODO: can we eliminate the need to debounce?
|
||||
const debouncedRemoteBranchRefresh = debounce(() => remoteBranchService.refresh(), 500);
|
||||
$effect(() => {
|
||||
$effect.pre(() => {
|
||||
if ($baseBranch || $head || $fetch) debouncedRemoteBranchRefresh();
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
$effect.pre(() => {
|
||||
const gitHost =
|
||||
repoInfo && baseBranchName
|
||||
? gitHostFactory.build(repoInfo, baseBranchName, forkInfo)
|
||||
|
Loading…
Reference in New Issue
Block a user