git: sync action

This commit is contained in:
Joao Moreno 2017-01-11 18:59:57 +01:00
parent c0ef3e4880
commit 87eea6cdcc
3 changed files with 16 additions and 0 deletions

View file

@ -98,6 +98,11 @@
"command": "git.publish",
"title": "Publish",
"category": "Git"
},
{
"command": "git.sync",
"title": "Sync",
"category": "Git"
}
],
"menus": {

View file

@ -91,6 +91,7 @@ class CommandCenter {
commands.registerCommand('git.clean', this.clean, this),
commands.registerCommand('git.cleanAll', this.cleanAll, this),
commands.registerCommand('git.checkout', this.checkout, this),
commands.registerCommand('git.sync', this.sync, this),
commands.registerCommand('git.publish', this.publish, this),
);
}
@ -204,6 +205,11 @@ class CommandCenter {
await choice.run(this.model);
}
@decorate(catchErrors)
async sync(): Promise<void> {
await this.model.sync();
}
@decorate(catchErrors)
async publish(): Promise<void> {
const branchName = this.model.HEAD && this.model.HEAD.name || '';

View file

@ -327,6 +327,11 @@ export class Model {
await this.update();
}
async sync(): Promise<void> {
await this.repository.sync();
await this.update();
}
async push(remote?: string, name?: string, options?: IPushOptions): Promise<void> {
await this.repository.push(remote, name, options);
await this.update();