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

fixes #27367

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