git: improve status bar message

This commit is contained in:
João Moreno
2020-10-21 15:51:55 +02:00
parent 58e1c6dcae
commit a27961d843
2 changed files with 24 additions and 2 deletions

View File

@@ -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;