Skip to content

Commit 87eea6c

Browse files
committed
git: sync action
1 parent c0ef3e4 commit 87eea6c

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

extensions/git/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@
9898
"command": "git.publish",
9999
"title": "Publish",
100100
"category": "Git"
101+
},
102+
{
103+
"command": "git.sync",
104+
"title": "Sync",
105+
"category": "Git"
101106
}
102107
],
103108
"menus": {

extensions/git/src/commands.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class CommandCenter {
9191
commands.registerCommand('git.clean', this.clean, this),
9292
commands.registerCommand('git.cleanAll', this.cleanAll, this),
9393
commands.registerCommand('git.checkout', this.checkout, this),
94+
commands.registerCommand('git.sync', this.sync, this),
9495
commands.registerCommand('git.publish', this.publish, this),
9596
);
9697
}
@@ -204,6 +205,11 @@ class CommandCenter {
204205
await choice.run(this.model);
205206
}
206207

208+
@decorate(catchErrors)
209+
async sync(): Promise<void> {
210+
await this.model.sync();
211+
}
212+
207213
@decorate(catchErrors)
208214
async publish(): Promise<void> {
209215
const branchName = this.model.HEAD && this.model.HEAD.name || '';

extensions/git/src/model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ export class Model {
327327
await this.update();
328328
}
329329

330+
async sync(): Promise<void> {
331+
await this.repository.sync();
332+
await this.update();
333+
}
334+
330335
async push(remote?: string, name?: string, options?: IPushOptions): Promise<void> {
331336
await this.repository.push(remote, name, options);
332337
await this.update();

0 commit comments

Comments
 (0)