提交 4d748ddd 编写于 作者: J Joao Moreno

Merge branch 'nathnovi/8053/dont_fetch_when_no_remote' of...

Merge branch 'nathnovi/8053/dont_fetch_when_no_remote' of https://github.com/natenovielli/vscode into natenovielli-nathnovi/8053/dont_fetch_when_no_remote
......@@ -347,24 +347,29 @@ export class AutoFetcher implements git.IAutoFetcher, lifecycle.IDisposable
}
private loop(): void {
this._state = git.AutoFetcherState.Fetching;
this.currentRequest = this.gitService.fetch().then(() => {
this.timeout = AutoFetcher.MIN_TIMEOUT;
}, (err) => {
if (errors.isPromiseCanceledError(err)) {
return winjs.Promise.wrapError(err);
} else if (err.gitErrorCode === git.GitErrorCodes.AuthenticationFailed) {
return winjs.Promise.wrapError(err);
} else {
this.timeout = Math.min(Math.round(this.timeout * 1.2), AutoFetcher.MAX_TIMEOUT); // backoff
}
});
var model = this.gitService ? this.gitService.getModel() : null;
var remotes = model ? model.getRemotes() : null;
if(remotes && remotes.length !== 0){
this._state = git.AutoFetcherState.Fetching;
this.currentRequest = this.gitService.fetch().then(() => {
this.timeout = AutoFetcher.MIN_TIMEOUT;
}, (err) => {
if (errors.isPromiseCanceledError(err)) {
return winjs.Promise.wrapError(err);
} else if (err.gitErrorCode === git.GitErrorCodes.AuthenticationFailed) {
return winjs.Promise.wrapError(err);
} else {
this.timeout = Math.min(Math.round(this.timeout * 1.2), AutoFetcher.MAX_TIMEOUT); // backoff
}
});
this.currentRequest.then(() => {
this._state = git.AutoFetcherState.Active;
this.currentRequest = winjs.TPromise.timeout(this.timeout);
return this.currentRequest;
}).then(() => this.loop(), (err) => this.deactivate());
this.currentRequest.then(() => {
this._state = git.AutoFetcherState.Active;
this.currentRequest = winjs.TPromise.timeout(this.timeout);
return this.currentRequest;
}).then(() => this.loop(), (err) => this.deactivate());
}
}
public dispose(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册