提交 09e22b85 编写于 作者: J Joao Moreno

fixes #27367

上级 a2107d10
......@@ -774,7 +774,7 @@ export class CommandCenter {
return;
}
await this.model.pull(true);
await this.model.pullWithRebase();
}
@command('git.push')
......@@ -812,7 +812,7 @@ export class CommandCenter {
return;
}
this.model.push(pick.label, branchName);
this.model.pushTo(pick.label, branchName);
}
@command('git.sync')
......@@ -860,7 +860,7 @@ export class CommandCenter {
return;
}
await this.model.push(choice, branchName, { setUpstream: true });
await this.model.pushTo(choice, branchName, true);
}
@command('git.showOutput')
......
......@@ -21,10 +21,6 @@ export interface IGit {
version: string;
}
export interface PushOptions {
setUpstream?: boolean;
}
export interface IFileStatus {
x: string;
y: string;
......@@ -762,10 +758,10 @@ export class Repository {
}
}
async push(remote?: string, name?: string, options?: PushOptions): Promise<void> {
async push(remote?: string, name?: string, setUpstream: boolean = false): Promise<void> {
const args = ['push'];
if (options && options.setUpstream) {
if (setUpstream) {
args.push('-u');
}
......
......@@ -6,7 +6,7 @@
'use strict';
import { Uri, Command, EventEmitter, Event, SourceControlResourceState, SourceControlResourceDecorations, Disposable, ProgressLocation, window, workspace } from 'vscode';
import { Git, Repository, Ref, Branch, Remote, PushOptions, Commit, GitErrorCodes } from './git';
import { Git, Repository, Ref, Branch, Remote, Commit, GitErrorCodes } from './git';
import { anyEvent, eventToPromise, filterEvent, EmptyDisposable, combinedDisposable, dispose } from './util';
import { memoize, throttle, debounce } from './decorators';
import * as path from 'path';
......@@ -479,12 +479,23 @@ export class Model implements Disposable {
}
}
async pull(rebase?: boolean): Promise<void> {
await this.run(Operation.Pull, () => this.repository.pull(rebase));
@throttle
async pull(): Promise<void> {
await this.run(Operation.Pull, () => this.repository.pull());
}
@throttle
async pullWithRebase(): Promise<void> {
await this.run(Operation.Pull, () => this.repository.pull(true));
}
@throttle
async push(): Promise<void> {
await this.run(Operation.Push, () => this.repository.push());
}
async push(remote?: string, name?: string, options?: PushOptions): Promise<void> {
await this.run(Operation.Push, () => this.repository.push(remote, name, options));
async pushTo(remote?: string, name?: string, setUpstream: boolean = false): Promise<void> {
await this.run(Operation.Push, () => this.repository.push(remote, name, setUpstream));
}
@throttle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册