diff --git a/images/dark/icon-sync.svg b/images/dark/icon-sync.svg
new file mode 100644
index 0000000..f01f6cb
--- /dev/null
+++ b/images/dark/icon-sync.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/images/light/icon-sync.svg b/images/light/icon-sync.svg
new file mode 100644
index 0000000..b4a8f27
--- /dev/null
+++ b/images/light/icon-sync.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/src/views/branchHistoryNode.ts b/src/views/branchHistoryNode.ts
index 082ee29..6e54423 100644
--- a/src/views/branchHistoryNode.ts
+++ b/src/views/branchHistoryNode.ts
@@ -3,22 +3,27 @@ import { Iterables } from '../system';
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { GlyphChars } from '../constants';
-import { ExplorerNode, ResourceType } from './explorerNode';
+import { ExplorerNode, ResourceType, ShowAllCommitsNode } from './explorerNode';
import { GitBranch, GitService, GitUri } from '../gitService';
export class BranchHistoryNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:branch-history';
+ maxCount: number | undefined = undefined;
+
constructor(public readonly branch: GitBranch, uri: GitUri, private readonly template: string, protected readonly context: ExtensionContext, protected readonly git: GitService) {
super(uri);
}
async getChildren(): Promise {
- const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, 0);
+ const log = await this.git.getLogForRepo(this.uri.repoPath!, this.branch.name, this.maxCount);
if (log === undefined) return [];
- return [...Iterables.map(log.commits.values(), c => new CommitNode(c, this.template, this.context, this.git))];
+ const children = Iterables.map(log.commits.values(), c => new CommitNode(c, this.template, this.context, this.git));
+ if (!log.truncated) return [...children];
+
+ return [...children, new ShowAllCommitsNode(this, this.context)];
}
async getTreeItem(): Promise {
diff --git a/src/views/explorerNode.ts b/src/views/explorerNode.ts
index abad231..a89c02e 100644
--- a/src/views/explorerNode.ts
+++ b/src/views/explorerNode.ts
@@ -1,6 +1,8 @@
'use strict';
-import { Command, Event, TreeItem, TreeItemCollapsibleState } from 'vscode';
+import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
+import { GlyphChars } from '../constants';
import { GitUri } from '../gitService';
+import { RefreshNodeCommandArgs } from './gitExplorer';
export declare type ResourceType =
'gitlens:branches' |
@@ -10,6 +12,7 @@ export declare type ResourceType =
'gitlens:file-history' |
'gitlens:history' |
'gitlens:message' |
+ 'gitlens:pager' |
'gitlens:remote' |
'gitlens:remotes' |
'gitlens:repository' |
@@ -31,10 +34,6 @@ export abstract class ExplorerNode {
getCommand(): Command | undefined {
return undefined;
}
-
- onDidChangeTreeData?: Event;
-
- refresh?(): void;
}
export class MessageNode extends ExplorerNode {
@@ -54,4 +53,46 @@ export class MessageNode extends ExplorerNode {
item.contextValue = this.resourceType;
return item;
}
+}
+
+export class PagerNode extends ExplorerNode {
+
+ readonly resourceType: ResourceType = 'gitlens:pager';
+ args: RefreshNodeCommandArgs = {};
+
+ constructor(private message: string, private node: ExplorerNode, protected readonly context: ExtensionContext) {
+ super(new GitUri());
+ }
+
+ getChildren(): ExplorerNode[] | Promise {
+ return [];
+ }
+
+ getTreeItem(): TreeItem | Promise {
+ const item = new TreeItem(this.message, TreeItemCollapsibleState.None);
+ item.contextValue = this.resourceType;
+ item.command = this.getCommand();
+ item.iconPath = {
+ dark: this.context.asAbsolutePath('images/dark/icon-sync.svg'),
+ light: this.context.asAbsolutePath('images/light/icon-sync.svg')
+ };
+ return item;
+ }
+
+ getCommand(): Command | undefined {
+ return {
+ title: 'Refresh',
+ command: 'gitlens.gitExplorer.refreshNode',
+ arguments: [this.node, this.args]
+ } as Command;
+ }
+}
+
+export class ShowAllCommitsNode extends PagerNode {
+
+ args: RefreshNodeCommandArgs = { maxCount: 0 };
+
+ constructor(node: ExplorerNode, context: ExtensionContext) {
+ super(`Show All Commits ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`, node, context);
+ }
}
\ No newline at end of file
diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts
index 4a2b31a..89ec27b 100644
--- a/src/views/gitExplorer.ts
+++ b/src/views/gitExplorer.ts
@@ -5,7 +5,7 @@ import { Commands, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, open
import { UriComparer } from '../comparers';
import { ExtensionKey, IConfig } from '../configuration';
import { CommandContext, setCommandContext } from '../constants';
-import { CommitFileNode, CommitNode, ExplorerNode, HistoryNode, MessageNode, RepositoryNode, StashNode } from './explorerNodes';
+import { BranchHistoryNode, CommitFileNode, CommitNode, ExplorerNode, HistoryNode, MessageNode, RepositoryNode, StashNode } from './explorerNodes';
import { GitService, GitUri, RepoChangedReasons } from '../gitService';
export * from './explorerNodes';
@@ -23,6 +23,10 @@ export interface OpenFileRevisionCommandArgs {
showOptions?: TextDocumentShowOptions;
}
+export interface RefreshNodeCommandArgs {
+ maxCount?: number;
+}
+
export class GitExplorer implements TreeDataProvider {
private _config: IConfig;
@@ -38,6 +42,7 @@ export class GitExplorer implements TreeDataProvider {
commands.registerCommand('gitlens.gitExplorer.switchToHistoryView', () => this.switchTo(GitExplorerView.History), this);
commands.registerCommand('gitlens.gitExplorer.switchToRepositoryView', () => this.switchTo(GitExplorerView.Repository), this);
commands.registerCommand('gitlens.gitExplorer.refresh', this.refresh, this);
+ commands.registerCommand('gitlens.gitExplorer.refreshNode', this.refreshNode, this);
commands.registerCommand('gitlens.gitExplorer.openChanges', this.openChanges, this);
commands.registerCommand('gitlens.gitExplorer.openChangesWithWorking', this.openChangesWithWorking, this);
commands.registerCommand('gitlens.gitExplorer.openFile', this.openFile, this);
@@ -133,6 +138,14 @@ export class GitExplorer implements TreeDataProvider {
this._onDidChangeTreeData.fire(node);
}
+ refreshNode(node: ExplorerNode, args: RefreshNodeCommandArgs) {
+ if (node instanceof BranchHistoryNode) {
+ node.maxCount = args.maxCount;
+ }
+
+ this.refresh(node);
+ }
+
switchTo(view: GitExplorerView) {
if (this._view === view) return;
diff --git a/src/views/stashNode.ts b/src/views/stashNode.ts
index 1172027..b788bc0 100644
--- a/src/views/stashNode.ts
+++ b/src/views/stashNode.ts
@@ -1,5 +1,5 @@
'use strict';
-import { Event, EventEmitter, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
+import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { CommitFormatter, GitService, GitStashCommit, GitUri, ICommitFormatOptions } from '../gitService';
import { StashFileNode } from './stashFileNode';
@@ -8,11 +8,6 @@ export class StashNode extends ExplorerNode {
readonly resourceType: ResourceType = 'gitlens:stash';
- private _onDidChangeTreeData = new EventEmitter();
- public get onDidChangeTreeData(): Event {
- return this._onDidChangeTreeData.event;
- }
-
constructor(public readonly commit: GitStashCommit, protected readonly context: ExtensionContext, protected readonly git: GitService) {
super(new GitUri(commit.uri, commit));
}
@@ -29,8 +24,4 @@ export class StashNode extends ExplorerNode {
item.contextValue = this.resourceType;
return item;
}
-
- refresh() {
- this._onDidChangeTreeData.fire();
- }
}
\ No newline at end of file