Adds paging support to repo/file history quick picks (wip)

This commit is contained in:
Eric Amodio
2017-03-11 15:58:21 -05:00
parent a2a3f1a81e
commit 7aefd178c2
11 changed files with 100 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
'use strict';
import Git, { GitBlameFormat, GitCommit, IGitAuthor, IGitBlame, IGitCommitLine, IGitEnricher } from './../git';
import { Git, GitBlameFormat, GitCommit, IGitAuthor, IGitBlame, IGitCommitLine, IGitEnricher } from './../git';
import * as moment from 'moment';
import * as path from 'path';

View File

@@ -1,5 +1,6 @@
'use strict';
import Git, { GitFileStatus, GitLogCommit, GitLogType, IGitAuthor, IGitEnricher, IGitLog } from './../git';
import { Git, GitFileStatus, GitLogCommit, GitLogType, IGitAuthor, IGitEnricher, IGitLog } from './../git';
// import { Logger } from '../../logger';
import * as moment from 'moment';
import * as path from 'path';
@@ -151,7 +152,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
return entries;
}
enrich(data: string, type: GitLogType, fileNameOrRepoPath: string, isRepoPath: boolean = false): IGitLog {
enrich(data: string, type: GitLogType, fileNameOrRepoPath: string, maxCount: number | undefined, isRepoPath: boolean = false): IGitLog {
const entries = this._parseEntries(data, isRepoPath);
if (!entries) return undefined;
@@ -199,6 +200,9 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
commits.set(entry.sha, commit);
}
// else {
// Logger.log(`merge commit? ${entry.sha}`);
// }
if (recentCommit) {
recentCommit.previousSha = commit.sha;
@@ -230,7 +234,9 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
repoPath: repoPath,
authors: sortedAuthors,
// commits: sortedCommits,
commits: commits
commits: commits,
maxCount: maxCount,
truncated: maxCount && entries.length >= maxCount
} as IGitLog;
}
}

View File

@@ -40,7 +40,7 @@ export const GitBlameFormat = {
porcelain: '--porcelain' as GitBlameFormat
};
export default class Git {
export class Git {
static normalizePath(fileName: string, repoPath?: string) {
return fileName.replace(/\\/g, '/');

View File

@@ -1,6 +1,6 @@
'use strict';
import { Uri } from 'vscode';
import Git from './git';
import { Git } from './git';
import * as path from 'path';
export interface IGitEnricher<T> {
@@ -171,6 +171,9 @@ export interface IGitLog {
repoPath: string;
authors: Map<string, IGitAuthor>;
commits: Map<string, GitLogCommit>;
maxCount: number | undefined;
truncated: boolean;
}
export declare type GitFileStatus = '?' | 'A' | 'C' | 'D' | 'M' | 'R' | 'U';