forked from microsoft/vscode-pull-request-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote.ts
More file actions
46 lines (40 loc) · 1.21 KB
/
Copy pathremote.ts
File metadata and controls
46 lines (40 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Protocol } from './protocol';
export class Remote {
public get host(): string {
return this.gitProtocol.host;
}
public get owner(): string {
return this.gitProtocol.owner;
}
public get repositoryName(): string {
return this.gitProtocol.repositoryName;
}
public get normalizedHost(): string {
const normalizedUri = this.gitProtocol.normalizeUri();
return `${normalizedUri.scheme}://${normalizedUri.authority}`;
}
constructor(
public readonly remoteName: string,
public readonly url: string,
public readonly gitProtocol: Protocol,
) { }
equals(remote: Remote): boolean {
if (this.remoteName !== remote.remoteName) {
return false;
}
if (this.host !== remote.host) {
return false;
}
if (this.owner !== remote.owner) {
return false;
}
if (this.repositoryName !== remote.repositoryName) {
return false;
}
return true;
}
}