Browse Source

Adds show more to file & line histories

main
Eric Amodio 5 years ago
parent
commit
36b6b9680e
2 changed files with 22 additions and 6 deletions
  1. +11
    -3
      src/views/nodes/fileHistoryNode.ts
  2. +11
    -3
      src/views/nodes/lineHistoryNode.ts

+ 11
- 3
src/views/nodes/fileHistoryNode.ts View File

@ -14,11 +14,14 @@ import { Logger } from '../../logger';
import { debug, Iterables } from '../../system'; import { debug, Iterables } from '../../system';
import { View } from '../viewBase'; import { View } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode'; import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { MessageNode } from './common';
import { MessageNode, ShowMoreNode } from './common';
import { insertDateMarkers } from './helpers'; 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) { constructor(uri: GitUri, view: View, parent: ViewNode) {
super(uri, view, parent); 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, { const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, {
maxCount: this.maxCount !== undefined ? this.maxCount : undefined,
ref: this.uri.sha ref: this.uri.sha
}); });
if (log !== undefined) { if (log !== undefined) {
@ -83,6 +87,10 @@ export class FileHistoryNode extends SubscribeableViewNode {
this 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.')]; if (children.length === 0) return [new MessageNode(this.view, this, 'No file history could be found.')];

+ 11
- 3
src/views/nodes/lineHistoryNode.ts View File

@ -13,11 +13,14 @@ import { Logger } from '../../logger';
import { debug, Iterables } from '../../system'; import { debug, Iterables } from '../../system';
import { View } from '../viewBase'; import { View } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode'; import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { MessageNode } from './common';
import { MessageNode, ShowMoreNode } from './common';
import { insertDateMarkers } from './helpers'; 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( constructor(
uri: GitUri, uri: GitUri,
view: View, view: View,
@ -92,6 +95,7 @@ export class LineHistoryNode extends SubscribeableViewNode {
} }
const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, { const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, {
maxCount: this.maxCount !== undefined ? this.maxCount : undefined,
ref: this.uri.sha, ref: this.uri.sha,
range: selection range: selection
}); });
@ -105,6 +109,10 @@ export class LineHistoryNode extends SubscribeableViewNode {
this 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.')]; if (children.length === 0) return [new MessageNode(this.view, this, 'No line history could be found.')];

Loading…
Cancel
Save