mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-13 03:28:35 -05:00
Spits branch and status nodes into separate files
Removes status node for now
This commit is contained in:
29
src/views/branchHistoryNode.ts
Normal file
29
src/views/branchHistoryNode.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||
import { CommitNode } from './commitNode';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||
import { GitBranch, GitService, GitUri } from '../gitService';
|
||||
|
||||
export class BranchHistoryNode extends ExplorerNode {
|
||||
|
||||
readonly resourceType: ResourceType = 'branch-history';
|
||||
|
||||
constructor(public branch: GitBranch, uri: GitUri, context: ExtensionContext, git: GitService) {
|
||||
super(uri, context, git);
|
||||
}
|
||||
|
||||
async getChildren(): Promise<CommitNode[]> {
|
||||
const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name);
|
||||
if (log === undefined) return [];
|
||||
|
||||
return [...Iterables.map(log.commits.values(), c => new CommitNode(c, this.uri, this.context, this.git))];
|
||||
}
|
||||
|
||||
getTreeItem(): TreeItem {
|
||||
const item = new TreeItem(`${this.branch.name}${this.branch.current ? ` ${GlyphChars.Dash} current` : ''}`, TreeItemCollapsibleState.Collapsed);
|
||||
item.contextValue = this.resourceType;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user