|
@ -65,6 +65,7 @@ export class Repository extends Disposable { |
|
|
readonly normalizedPath: string; |
|
|
readonly normalizedPath: string; |
|
|
readonly storage: Map<string, any> = new Map(); |
|
|
readonly storage: Map<string, any> = new Map(); |
|
|
|
|
|
|
|
|
|
|
|
private _branch: Promise<GitBranch | undefined> | undefined; |
|
|
private readonly _disposable: Disposable; |
|
|
private readonly _disposable: Disposable; |
|
|
private _fireChangeDebounced: ((e: RepositoryChangeEvent) => void) | undefined = undefined; |
|
|
private _fireChangeDebounced: ((e: RepositoryChangeEvent) => void) | undefined = undefined; |
|
|
private _fireFileSystemChangeDebounced: ((e: RepositoryFileSystemChangeEvent) => void) | undefined = undefined; |
|
|
private _fireFileSystemChangeDebounced: ((e: RepositoryFileSystemChangeEvent) => void) | undefined = undefined; |
|
@ -72,7 +73,7 @@ export class Repository extends Disposable { |
|
|
private _fsWatcherDisposable: Disposable | undefined; |
|
|
private _fsWatcherDisposable: Disposable | undefined; |
|
|
private _pendingChanges: { repo?: RepositoryChangeEvent, fs?: RepositoryFileSystemChangeEvent } = { }; |
|
|
private _pendingChanges: { repo?: RepositoryChangeEvent, fs?: RepositoryFileSystemChangeEvent } = { }; |
|
|
private _providerMap: RemoteProviderMap | undefined; |
|
|
private _providerMap: RemoteProviderMap | undefined; |
|
|
private _remotes: GitRemote[] | undefined; |
|
|
|
|
|
|
|
|
private _remotes: Promise<GitRemote[]> | undefined; |
|
|
private _suspended: boolean; |
|
|
private _suspended: boolean; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
@ -148,6 +149,8 @@ export class Repository extends Disposable { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this._branch = undefined; |
|
|
|
|
|
|
|
|
if (uri !== undefined && uri.path.endsWith('refs/remotes')) { |
|
|
if (uri !== undefined && uri.path.endsWith('refs/remotes')) { |
|
|
this._remotes = undefined; |
|
|
this._remotes = undefined; |
|
|
this.fireChange(RepositoryChange.Remotes); |
|
|
this.fireChange(RepositoryChange.Remotes); |
|
@ -227,8 +230,11 @@ export class Repository extends Disposable { |
|
|
return this.folder === workspace.getWorkspaceFolder(uri); |
|
|
return this.folder === workspace.getWorkspaceFolder(uri); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async getBranch(): Promise<GitBranch | undefined> { |
|
|
|
|
|
return this.git.getBranch(this.path); |
|
|
|
|
|
|
|
|
getBranch(): Promise<GitBranch | undefined> { |
|
|
|
|
|
if (this._branch === undefined) { |
|
|
|
|
|
this._branch = this.git.getBranch(this.path); |
|
|
|
|
|
} |
|
|
|
|
|
return this._branch; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async getBranches(): Promise<GitBranch[]> { |
|
|
async getBranches(): Promise<GitBranch[]> { |
|
@ -239,14 +245,14 @@ export class Repository extends Disposable { |
|
|
return this.git.getChangedFilesCount(this.path, sha); |
|
|
return this.git.getChangedFilesCount(this.path, sha); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async getRemotes(): Promise<GitRemote[]> { |
|
|
|
|
|
|
|
|
getRemotes(): Promise<GitRemote[]> { |
|
|
if (this._remotes === undefined) { |
|
|
if (this._remotes === undefined) { |
|
|
if (this._providerMap === undefined) { |
|
|
if (this._providerMap === undefined) { |
|
|
const remotesCfg = configuration.get<IRemotesConfig[] | null | undefined>(configuration.name('remotes').value, this.folder.uri); |
|
|
const remotesCfg = configuration.get<IRemotesConfig[] | null | undefined>(configuration.name('remotes').value, this.folder.uri); |
|
|
this._providerMap = RemoteProviderFactory.createMap(remotesCfg); |
|
|
this._providerMap = RemoteProviderFactory.createMap(remotesCfg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this._remotes = await this.git.getRemotesCore(this.path, this._providerMap); |
|
|
|
|
|
|
|
|
this._remotes = this.git.getRemotesCore(this.path, this._providerMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return this._remotes; |
|
|
return this._remotes; |
|
@ -260,6 +266,11 @@ export class Repository extends Disposable { |
|
|
return this.git.getStatusForRepo(this.path); |
|
|
return this.git.getStatusForRepo(this.path); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async hasRemote(): Promise<boolean> { |
|
|
|
|
|
const branch = await this.getBranch(); |
|
|
|
|
|
return branch !== undefined && branch.tracking !== undefined; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async hasRemotes(): Promise<boolean> { |
|
|
async hasRemotes(): Promise<boolean> { |
|
|
const remotes = await this.getRemotes(); |
|
|
const remotes = await this.getRemotes(); |
|
|
return remotes !== undefined && remotes.length > 0; |
|
|
return remotes !== undefined && remotes.length > 0; |
|
|