From 36b6b9680e45f191bb7c330394ebbb01ea5f8fc7 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 2 May 2019 00:05:43 -0400 Subject: [PATCH] Adds show more to file & line histories --- src/views/nodes/fileHistoryNode.ts | 14 +++++++++++--- src/views/nodes/lineHistoryNode.ts | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/views/nodes/fileHistoryNode.ts b/src/views/nodes/fileHistoryNode.ts index 07de670..ffeaa20 100644 --- a/src/views/nodes/fileHistoryNode.ts +++ b/src/views/nodes/fileHistoryNode.ts @@ -14,11 +14,14 @@ import { Logger } from '../../logger'; import { debug, Iterables } from '../../system'; import { View } from '../viewBase'; import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode'; -import { MessageNode } from './common'; +import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { PageableViewNode, ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; + +export class FileHistoryNode extends SubscribeableViewNode implements PageableViewNode { + readonly supportsPaging: boolean = true; + maxCount: number | undefined; -export class FileHistoryNode extends SubscribeableViewNode { constructor(uri: GitUri, view: View, parent: ViewNode) { super(uri, view, parent); } @@ -71,6 +74,7 @@ export class FileHistoryNode extends SubscribeableViewNode { } const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, { + maxCount: this.maxCount !== undefined ? this.maxCount : undefined, ref: this.uri.sha }); if (log !== undefined) { @@ -83,6 +87,10 @@ export class FileHistoryNode extends SubscribeableViewNode { this ) ); + + if (log.truncated) { + children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1])); + } } if (children.length === 0) return [new MessageNode(this.view, this, 'No file history could be found.')]; diff --git a/src/views/nodes/lineHistoryNode.ts b/src/views/nodes/lineHistoryNode.ts index da5a3c7..58a1b63 100644 --- a/src/views/nodes/lineHistoryNode.ts +++ b/src/views/nodes/lineHistoryNode.ts @@ -13,11 +13,14 @@ import { Logger } from '../../logger'; import { debug, Iterables } from '../../system'; import { View } from '../viewBase'; import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode'; -import { MessageNode } from './common'; +import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { PageableViewNode, ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; + +export class LineHistoryNode extends SubscribeableViewNode implements PageableViewNode { + readonly supportsPaging: boolean = true; + maxCount: number | undefined; -export class LineHistoryNode extends SubscribeableViewNode { constructor( uri: GitUri, view: View, @@ -92,6 +95,7 @@ export class LineHistoryNode extends SubscribeableViewNode { } const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, { + maxCount: this.maxCount !== undefined ? this.maxCount : undefined, ref: this.uri.sha, range: selection }); @@ -105,6 +109,10 @@ export class LineHistoryNode extends SubscribeableViewNode { this ) ); + + if (log.truncated) { + children.push(new ShowMoreNode(this.view, this, 'Commits', children[children.length - 1])); + } } if (children.length === 0) return [new MessageNode(this.view, this, 'No line history could be found.')];