11import type { Range , Uri } from 'vscode' ;
22import type { AutolinkReference , DynamicAutolinkReference } from '../../autolinks/models/autolinks' ;
3+ import type { RepositoryDescriptor } from '../../plus/integrations/integration' ;
34import type { Brand , Unbrand } from '../../system/brand' ;
45import type { Repository } from '../models/repository' ;
56import type { GkProviderId } from '../models/repositoryIdentities' ;
@@ -10,7 +11,7 @@ import { RemoteProvider } from './remoteProvider';
1011const fileRegex = / ^ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ?) \/ s r c ( .+ ) $ / i;
1112const rangeRegex = / ^ l i n e s - ( \d + ) (?: : ( \d + ) ) ? $ / ;
1213
13- export class BitbucketRemote extends RemoteProvider {
14+ export class BitbucketRemote extends RemoteProvider < RepositoryDescriptor > {
1415 constructor ( domain : string , path : string , protocol ?: string , name ?: string , custom : boolean = false ) {
1516 super ( domain , path , protocol , name , custom ) ;
1617 }
@@ -142,8 +143,18 @@ export class BitbucketRemote extends RemoteProvider {
142143 return this . encodeUrl ( `${ this . baseUrl } /commits/${ sha } ` ) ;
143144 }
144145
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/${ head } \r${ base } ` ) } #diff` ;
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 . getRepoBaseUrl ( head . remote . path ) } /pull-requests/new` ) } ?${ query . toString ( ) } ` ;
147158 }
148159
149160 protected getUrlForFile ( fileName : string , branch ?: string , sha ?: string , range ?: Range ) : string {
0 commit comments