git: improve status bar message
This commit is contained in:
parent
58e1c6dcae
commit
a27961d843
2 changed files with 24 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<string>('rebaseWhenSync');
|
||||
|
||||
command = rebaseWhenSync ? 'git.syncRebase' : 'git.sync';
|
||||
tooltip = localize('sync changes', "Synchronize Changes");
|
||||
tooltip = this.repository.syncTooltip;
|
||||
} else {
|
||||
icon = '$(cloud-upload)';
|
||||
command = 'git.publish';
|
||||
|
|
Loading…
Reference in a new issue