1
1
import type { Range , Uri } from 'vscode' ;
2
2
import type { AutolinkReference , DynamicAutolinkReference } from '../../autolinks/models/autolinks' ;
3
+ import type { RepositoryDescriptor } from '../../plus/integrations/integration' ;
3
4
import type { Brand , Unbrand } from '../../system/brand' ;
4
5
import type { Repository } from '../models/repository' ;
5
6
import type { GkProviderId } from '../models/repositoryIdentities' ;
@@ -10,7 +11,7 @@ import { RemoteProvider } from './remoteProvider';
10
11
const fileRegex = / ^ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ?) \/ s r c ( .+ ) $ / i;
11
12
const rangeRegex = / ^ l i n e s - ( \d + ) (?: : ( \d + ) ) ? $ / ;
12
13
13
- export class BitbucketRemote extends RemoteProvider {
14
+ export class BitbucketRemote extends RemoteProvider < RepositoryDescriptor > {
14
15
constructor ( domain : string , path : string , protocol ?: string , name ?: string , custom : boolean = false ) {
15
16
super ( domain , path , protocol , name , custom ) ;
16
17
}
@@ -142,8 +143,18 @@ export class BitbucketRemote extends RemoteProvider {
142
143
return this . encodeUrl ( `${ this . baseUrl } /commits/${ sha } ` ) ;
143
144
}
144
145
145
- protected override getUrlForComparison ( base : string , compare : string , _notation : '..' | '...' ) : string {
146
- return this . encodeUrl ( `${ this . baseUrl } /branches/compare/${ base } %0D${ compare } ` ) . replace ( '%250D' , '%0D' ) ;
146
+ protected override getUrlForComparison ( base : string , head : string , _notation : '..' | '...' ) : string {
147
+ return this . encodeUrl ( `${ this . baseUrl } /branches/compare/${ base } %0D${ head } ` ) . replace ( '%250D' , '%0D' ) ;
148
+ }
149
+
150
+ protected override getUrlForCreatePullRequest (
151
+ base : { branch ?: string ; remote : { path : string ; url : string } } ,
152
+ head : { branch : string ; remote : { path : string ; url : string } } ,
153
+ _options ?: { title ?: string ; description ?: string } ,
154
+ ) : string | undefined {
155
+ const { owner, name } = this . repoDesc ;
156
+ const query = new URLSearchParams ( { source : head . branch , dest : `${ owner } /${ name } ::${ base . branch ?? '' } ` } ) ;
157
+ return `${ this . encodeUrl ( `${ this . baseUrl } /pull-requests/new` ) } ?${ query . toString ( ) } ` ;
147
158
}
148
159
149
160
protected getUrlForFile ( fileName : string , branch ?: string , sha ?: string , range ?: Range ) : string {
0 commit comments