mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 09:35:37 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -728,24 +728,48 @@ export class Repository implements Disposable {
|
||||
}
|
||||
|
||||
@throttle
|
||||
async pullWithRebase(): Promise<void> {
|
||||
await this.run(Operation.Pull, () => this.repository.pull(true));
|
||||
async pullWithRebase(head: Branch | undefined): Promise<void> {
|
||||
let remote: string | undefined;
|
||||
let branch: string | undefined;
|
||||
|
||||
if (head && head.name && head.upstream) {
|
||||
remote = head.upstream.remote;
|
||||
branch = `${head.upstream.name}`;
|
||||
}
|
||||
|
||||
await this.run(Operation.Pull, () => this.repository.pull(true, remote, branch));
|
||||
}
|
||||
|
||||
@throttle
|
||||
async pull(rebase?: boolean, remote?: string, name?: string): Promise<void> {
|
||||
await this.run(Operation.Pull, () => this.repository.pull(rebase, remote, name));
|
||||
}
|
||||
async pull(head: Branch | undefined): Promise<void> {
|
||||
let remote: string | undefined;
|
||||
let branch: string | undefined;
|
||||
|
||||
@throttle
|
||||
async push(): Promise<void> {
|
||||
await this.run(Operation.Push, () => this.repository.push());
|
||||
if (head && head.name && head.upstream) {
|
||||
remote = head.upstream.remote;
|
||||
branch = `${head.upstream.name}`;
|
||||
}
|
||||
|
||||
await this.run(Operation.Pull, () => this.repository.pull(false, remote, branch));
|
||||
}
|
||||
|
||||
async pullFrom(rebase?: boolean, remote?: string, branch?: string): Promise<void> {
|
||||
await this.run(Operation.Pull, () => this.repository.pull(rebase, remote, branch));
|
||||
}
|
||||
|
||||
@throttle
|
||||
async push(head: Branch): Promise<void> {
|
||||
let remote: string | undefined;
|
||||
let branch: string | undefined;
|
||||
|
||||
if (head && head.name && head.upstream) {
|
||||
remote = head.upstream.remote;
|
||||
branch = `${head.name}:${head.upstream.name}`;
|
||||
}
|
||||
|
||||
await this.run(Operation.Push, () => this.repository.push(remote, branch));
|
||||
}
|
||||
|
||||
async pushTo(remote?: string, name?: string, setUpstream: boolean = false): Promise<void> {
|
||||
await this.run(Operation.Push, () => this.repository.push(remote, name, setUpstream));
|
||||
}
|
||||
@@ -754,47 +778,53 @@ export class Repository implements Disposable {
|
||||
await this.run(Operation.Push, () => this.repository.push(remote, undefined, false, true));
|
||||
}
|
||||
|
||||
private async _sync(rebase: boolean): Promise<void> {
|
||||
@throttle
|
||||
sync(head: Branch): Promise<void> {
|
||||
return this._sync(head, false);
|
||||
}
|
||||
|
||||
@throttle
|
||||
async syncRebase(head: Branch): Promise<void> {
|
||||
return this._sync(head, true);
|
||||
}
|
||||
|
||||
private async _sync(head: Branch, rebase: boolean): Promise<void> {
|
||||
let remote: string | undefined;
|
||||
let pullBranch: string | undefined;
|
||||
let pushBranch: string | undefined;
|
||||
|
||||
if (head.name && head.upstream) {
|
||||
remote = head.upstream.remote;
|
||||
pullBranch = `${head.upstream.name}`;
|
||||
pushBranch = `${head.name}:${head.upstream.name}`;
|
||||
}
|
||||
|
||||
await this.run(Operation.Sync, async () => {
|
||||
await this.repository.pull(rebase);
|
||||
await this.repository.pull(rebase, remote, pullBranch);
|
||||
|
||||
const shouldPush = this.HEAD && typeof this.HEAD.ahead === 'number' ? this.HEAD.ahead > 0 : true;
|
||||
|
||||
if (shouldPush) {
|
||||
await this.repository.push();
|
||||
await this.repository.push(remote, pushBranch);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@throttle
|
||||
sync(): Promise<void> {
|
||||
return this._sync(false);
|
||||
}
|
||||
|
||||
@throttle
|
||||
async syncRebase(): Promise<void> {
|
||||
return this._sync(true);
|
||||
}
|
||||
|
||||
async show(ref: string, filePath: string): Promise<string> {
|
||||
return await this.run(Operation.Show, async () => {
|
||||
return this.run(Operation.Show, () => {
|
||||
const relativePath = path.relative(this.repository.root, filePath).replace(/\\/g, '/');
|
||||
const configFiles = workspace.getConfiguration('files', Uri.file(filePath));
|
||||
const encoding = configFiles.get<string>('encoding');
|
||||
const defaultEncoding = configFiles.get<string>('encoding');
|
||||
const autoGuessEncoding = configFiles.get<boolean>('autoGuessEncoding');
|
||||
|
||||
// TODO@joao: Resource config api
|
||||
return await this.repository.bufferString(`${ref}:${relativePath}`, encoding);
|
||||
return this.repository.bufferString(`${ref}:${relativePath}`, defaultEncoding, autoGuessEncoding);
|
||||
});
|
||||
}
|
||||
|
||||
async buffer(ref: string, filePath: string): Promise<Buffer> {
|
||||
return await this.run(Operation.Show, async () => {
|
||||
return this.run(Operation.Show, () => {
|
||||
const relativePath = path.relative(this.repository.root, filePath).replace(/\\/g, '/');
|
||||
// const configFiles = workspace.getConfiguration('files', Uri.file(filePath));
|
||||
// const encoding = configFiles.get<string>('encoding');
|
||||
|
||||
// TODO@joao: REsource config api
|
||||
return await this.repository.buffer(`${ref}:${relativePath}`);
|
||||
return this.repository.buffer(`${ref}:${relativePath}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user