Adds remote tracking branch to custom view

Adds setting to show remote tracking branch in custom view
This commit is contained in:
Eric Amodio
2017-09-04 01:36:38 -04:00
parent a5af318269
commit 5a42ce4ed4
6 changed files with 26 additions and 18 deletions

View File

@@ -4,13 +4,13 @@ import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { GlyphChars } from '../constants';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitBranch, GitRemote, GitService, GitUri } from '../gitService';
import { GitBranch, GitService, GitUri } from '../gitService';
export class BranchHistoryNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:branch-history';
constructor(public readonly branch: GitBranch, private readonly remote: GitRemote | undefined, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
constructor(public readonly branch: GitBranch, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
super(uri);
}
@@ -22,10 +22,11 @@ export class BranchHistoryNode extends ExplorerNode {
}
async getTreeItem(): Promise<TreeItem> {
const name = this.remote !== undefined
? this.branch.name.substring(this.remote.name.length + 1)
: this.branch.name;
const item = new TreeItem(`${name}${this.branch!.current ? ` ${GlyphChars.Space} ${GlyphChars.Check}` : ''}`, TreeItemCollapsibleState.Collapsed);
let name = this.branch.getName();
if (!this.branch.remote && this.branch.tracking !== undefined && this.git.config.gitExplorer.showTrackingBranch) {
name += ` ${GlyphChars.Space}${GlyphChars.ArrowLeftRight}${GlyphChars.Space} ${this.branch.tracking}`;
}
const item = new TreeItem(`${this.branch!.current ? `${GlyphChars.Check} ${GlyphChars.Space}` : ''}${name}`, TreeItemCollapsibleState.Collapsed);
item.contextValue = this.resourceType;
item.iconPath = {