diff --git a/README.md b/README.md index 28fe8ec..64ebd88 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ The _Commits_ view lists all of the commits on the current branch, and additiona - **Ahead** — lists the commits that the current branch has (i.e. ahead) but are missing in the selected reference - **# files changed** — lists all of the files changed between the compared references - the current branch status — shows the upstream status of the current branch - - **<current branch> hasn't yet been published** — shown when the current branch has not been published to a remote + - **Publish <current branch> to remote** — shown when the current branch has not been published to a remote - **Up to date with <remote>** — shown when the current branch is up to date with the upstream remote - **Changes to push to <remote>** — lists of all the files changed in the unpublished commits when the current branch has (unpublished) commits that waiting to be pushed to the upstream remote - **Changes to pull from <remote>** — lists all of the commits waiting to be pulled when the current branch has commits that are waiting to be pulled from the upstream remote @@ -700,7 +700,7 @@ GitLens is highly customizable and provides many configuration settings to allow | `gitlens.currentLine.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) for the current line blame annotations. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats | | `gitlens.currentLine.enabled` | Specifies whether to provide a blame annotation for the current line, by default. Use the _Toggle Line Blame Annotations_ command (`gitlens.toggleLineBlame`) to toggle the annotations on and off for the current window | | `gitlens.currentLine.format` | Specifies the format of the current line blame annotation. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.currentLine.dateFormat` setting | -| `gitlens.currentLine.pullRequests.enabled` | Specifies whether to provide information about the Pull Request (if any) that introduced the commit in the current line blame annotation. Requires a connection to a supported remote service (e.g. GitHub) | +| `gitlens.currentLine.pullRequests.enabled` | Specifies whether to provide information about the Pull Request (if any) that introduced the commit in the current line blame annotation. Requires a connection to a supported remote service (e.g. GitHub) | | `gitlens.currentLine.scrollable` | Specifies whether the current line blame annotation can be scrolled into view when it is outside the viewport | ## Git Code Lens Settings [#](#git-code-lens-settings- 'Git Code Lens Settings') diff --git a/src/views/nodes/branchTrackingStatusNode.ts b/src/views/nodes/branchTrackingStatusNode.ts index 258b716..459a247 100644 --- a/src/views/nodes/branchTrackingStatusNode.ts +++ b/src/views/nodes/branchTrackingStatusNode.ts @@ -5,7 +5,7 @@ import { BranchTrackingStatusFilesNode } from './branchTrackingStatusFilesNode'; import { CommitNode } from './commitNode'; import { LoadMoreNode } from './common'; import { Container } from '../../container'; -import { GitBranch, GitLog, GitRevision, GitTrackingState } from '../../git/git'; +import { GitBranch, GitLog, GitRemote, GitRevision, GitTrackingState } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { insertDateMarkers } from './helpers'; import { RepositoriesView } from '../repositoriesView'; @@ -120,6 +120,9 @@ export class BranchTrackingStatusNode extends ViewNode implement lastFetched = (await repo?.getLastFetched()) ?? 0; } + const providers = GitRemote.getHighlanderProviders(await Container.git.getRemotes(this.branch.repoPath)); + const providerName = providers?.length ? providers[0].name : undefined; + let label; let description; let collapsibleState; @@ -128,11 +131,14 @@ export class BranchTrackingStatusNode extends ViewNode implement let tooltip; switch (this.upstreamType) { case 'ahead': - label = `Changes to push to ${GitBranch.getRemote(this.status.upstream!)}`; - description = Strings.pluralize('commit', this.status.state.ahead); - tooltip = `${this.branch.name} is ${Strings.pluralize('commit', this.status.state.ahead)} ahead of ${ - this.status.upstream + label = `Changes to push to ${GitBranch.getRemote(this.status.upstream!)}${ + providerName ? ` on ${providerName}` : '' }`; + description = Strings.pluralize('commit', this.status.state.ahead); + tooltip = `Branch ${this.branch.name} is ${Strings.pluralize( + 'commit', + this.status.state.ahead, + )} ahead of ${this.status.upstream}`; // collapsibleState = !this.isReposView // ? TreeItemCollapsibleState.Expanded @@ -146,11 +152,14 @@ export class BranchTrackingStatusNode extends ViewNode implement break; case 'behind': - label = `Changes to pull from ${GitBranch.getRemote(this.status.upstream!)}`; - description = Strings.pluralize('commit', this.status.state.behind); - tooltip = `${this.branch.name} is ${Strings.pluralize('commit', this.status.state.behind)} behind ${ - this.status.upstream + label = `Changes to pull from ${GitBranch.getRemote(this.status.upstream!)}${ + providerName ? ` on ${providerName}` : '' }`; + description = Strings.pluralize('commit', this.status.state.behind); + tooltip = `Branch ${this.branch.name} is ${Strings.pluralize( + 'commit', + this.status.state.behind, + )} behind ${this.status.upstream}`; collapsibleState = TreeItemCollapsibleState.Collapsed; contextValue = this.root @@ -161,9 +170,11 @@ export class BranchTrackingStatusNode extends ViewNode implement break; case 'same': - label = `Up to date with ${GitBranch.getRemote(this.status.upstream!)}`; + label = `Up to date with ${GitBranch.getRemote(this.status.upstream!)}${ + providerName ? ` on ${providerName}` : '' + }`; description = `Last fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`; - tooltip = `${this.branch.name} is up to date with ${this.status.upstream}`; + tooltip = `Branch ${this.branch.name} is up to date with ${this.status.upstream}`; collapsibleState = TreeItemCollapsibleState.None; contextValue = this.root ? ContextValues.StatusSameAsUpstream : undefined; @@ -171,15 +182,16 @@ export class BranchTrackingStatusNode extends ViewNode implement break; - case 'none': - label = `${this.branch.name} hasn't yet been published`; - tooltip = label; + case 'none': { + label = `Publish ${this.branch.name} to ${providerName ?? 'remote'}`; + tooltip = `Branch ${this.branch.name} hasn't yet been published to ${providerName ?? 'remote'}`; collapsibleState = TreeItemCollapsibleState.None; contextValue = this.root ? ContextValues.StatusNoUpstream : undefined; icon = new ThemeIcon('cloud-upload', new ThemeColor('gitlens.viewChangesToPushIconColor')); break; + } } const item = new TreeItem(label, collapsibleState);