diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index c9ac43f8960..80d185a8360 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -1787,6 +1787,28 @@ export class Repository implements Disposable { return `${this.HEAD.behind}↓ ${this.HEAD.ahead}↑`; } + get syncTooltip(): string { + if (!this.HEAD + || !this.HEAD.name + || !this.HEAD.commit + || !this.HEAD.upstream + || !(this.HEAD.ahead || this.HEAD.behind) + ) { + return localize('sync changes', "Synchronize Changes"); + } + + const remoteName = this.HEAD && this.HEAD.remote || this.HEAD.upstream.remote; + const remote = this.remotes.find(r => r.name === remoteName); + + if ((remote && remote.isReadOnly) || !this.HEAD.ahead) { + return localize('pull n', "Pull {0} commits from {1}/{2}", this.HEAD.behind, this.HEAD.upstream.remote, this.HEAD.upstream.name); + } else if (!this.HEAD.behind) { + return localize('push n', "Push {0} commits to {1}/{2}", this.HEAD.ahead, this.HEAD.upstream.remote, this.HEAD.upstream.name); + } else { + return localize('pull push n', "Pull {0} and push {1} commits between {2}/{3}", this.HEAD.behind, this.HEAD.ahead, this.HEAD.upstream.remote, this.HEAD.upstream.name); + } + } + private updateInputBoxPlaceholder(): void { const branchName = this.headShortName; diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index 8a108ae1b45..fd556024f83 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -28,7 +28,7 @@ class CheckoutStatusBar { return { command: 'git.checkout', - tooltip: `${this.repository.headLabel}`, + tooltip: localize('checkout', "Checkout branch/tag..."), title, arguments: [this.repository.sourceControl] }; @@ -150,7 +150,7 @@ class SyncStatusBar { const rebaseWhenSync = config.get('rebaseWhenSync'); command = rebaseWhenSync ? 'git.syncRebase' : 'git.sync'; - tooltip = localize('sync changes', "Synchronize Changes"); + tooltip = this.repository.syncTooltip; } else { icon = '$(cloud-upload)'; command = 'git.publish';