mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Adds Open Branches in Remote command to the Branches custom view item Adds Open Repository in Remote command to the Repository Status custom view item
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
'use strict';
|
|
import { Range } from 'vscode';
|
|
import { RemoteProvider } from './provider';
|
|
|
|
export class VisualStudioService extends RemoteProvider {
|
|
|
|
constructor(public domain: string, public path: string) {
|
|
super(domain, path);
|
|
}
|
|
|
|
get name() {
|
|
return 'Visual Studio Team Services';
|
|
}
|
|
|
|
protected getUrlForBranches(): string {
|
|
return `${this.baseUrl}/branches`;
|
|
}
|
|
|
|
protected getUrlForBranch(branch: string): string {
|
|
return `${this.baseUrl}/?version=GB${branch}&_a=history`;
|
|
}
|
|
|
|
protected getUrlForCommit(sha: string): string {
|
|
return `${this.baseUrl}/commit/${sha}`;
|
|
}
|
|
|
|
protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
|
|
let line = '';
|
|
if (range) {
|
|
if (range.start.line === range.end.line) {
|
|
line = `&line=${range.start.line}`;
|
|
}
|
|
else {
|
|
line = `&line=${range.start.line}&lineEnd=${range.end.line}`;
|
|
}
|
|
}
|
|
|
|
if (sha) return `${this.baseUrl}/commit/${sha}/?_a=contents&path=%2F${fileName}${line}`;
|
|
if (branch) return `${this.baseUrl}/?path=%2F${fileName}&version=GB${branch}&_a=contents${line}`;
|
|
return `${this.baseUrl}?path=%2F${fileName}${line}`;
|
|
}
|
|
} |