Skip to content

Commit c911e7a

Browse files
committed
(wip) gitlab
1 parent 6821da7 commit c911e7a

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/git/remotes/gitlab.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,31 @@ export class GitLabRemote extends RemoteProvider<GitLabRepositoryDescriptor> {
372372
return this.encodeUrl(`${this.baseUrl}/-/commit/${sha}`);
373373
}
374374

375-
protected override getUrlForComparison(base: string, compare: string, notation: '..' | '...'): string {
376-
return this.encodeUrl(`${this.baseUrl}/-/compare/${base}${notation}${compare}`);
375+
protected override getUrlForComparison(base: string, head: string, notation: '..' | '...'): string {
376+
return this.encodeUrl(`${this.baseUrl}/-/compare/${base}${notation}${head}`);
377+
}
378+
379+
protected override getUrlForCreatePullRequest(
380+
base: { branch?: string; remote: { path: string; url: string } },
381+
head: { branch: string; remote: { path: string; url: string } },
382+
options?: { title?: string; description?: string },
383+
): string | undefined {
384+
const query = new URLSearchParams({
385+
utf8: '✓',
386+
'merge_request["source_branch"]': head.branch,
387+
'merge_request["target_branch"]': base.branch ?? '',
388+
// TODO: figure this out
389+
// 'merge_request["source_project_id"]': this.path,
390+
// 'merge_request["target_project_id"]': this.path,
391+
});
392+
if (options?.title) {
393+
query.set('merge_request[title]', options.title);
394+
}
395+
if (options?.description) {
396+
query.set('merge_request[description]', options.description);
397+
}
398+
399+
return `${this.encodeUrl(`${this.baseUrl}/-/merge_requests/new`)}?${query.toString()}`;
377400
}
378401

379402
protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {

0 commit comments

Comments
 (0)