Lots of timeline related changes, below

UI:
Adds Refresh icon to view title
Adds "Load more" entry at the end of the list for paging

API:
Restructures api around cursors
Renames TimelineCursor to generic TimelineOptions for more flexibility
Adds paging object to Timeline for clearer paging usage
Changes cursors to be strings, and explicit before and after cursors
Allows limit to take a cursor, so we can reload current data set
Clarifies id and fallback to timestamp
Adds reset flag to TimelineChangeEvent for providers to reset caching

Git provider:
Orders and returns commit date as the timestamp
Supports limit of a cursor (using rev-list --count)
Stops returning working/index changes when paging
Forcably resets cached data when changes are detected (naive for now)
This commit is contained in:
Eric Amodio
2020-02-24 15:48:26 -05:00
parent d226035b73
commit d46c8a8c3c
11 changed files with 636 additions and 187 deletions

View File

@@ -50,8 +50,13 @@ interface MutableRemote extends Remote {
* Log file options.
*/
export interface LogFileOptions {
/** Max number of log entries to retrieve. If not specified, the default is 32. */
readonly maxEntries?: number;
/** Optional. The maximum number of log entries to retrieve. */
readonly maxEntries?: number | string;
/** Optional. The Git sha (hash) to start retrieving log entries from. */
readonly hash?: string;
/** Optional. Specifies whether to start retrieving log entries in reverse order. */
readonly reverse?: boolean;
readonly sortByAuthorDate?: boolean;
}
function parseVersion(raw: string): string {
@@ -817,8 +822,26 @@ export class Repository {
}
async logFile(uri: Uri, options?: LogFileOptions): Promise<Commit[]> {
const maxEntries = options?.maxEntries ?? 32;
const args = ['log', `-n${maxEntries}`, `--format=${COMMIT_FORMAT}`, '-z', '--', uri.fsPath];
const args = ['log', `--format=${COMMIT_FORMAT}`, '-z'];
if (options?.maxEntries && !options?.reverse) {
args.push(`-n${options.maxEntries}`);
}
if (options?.hash) {
// If we are reversing, we must add a range (with HEAD) because we are using --ancestry-path for better reverse walking
if (options?.reverse) {
args.push('--reverse', '--ancestry-path', `${options.hash}..HEAD`);
} else {
args.push(options.hash);
}
}
if (options?.sortByAuthorDate) {
args.push('--author-date-order');
}
args.push('--', uri.fsPath);
const result = await this.run(args);
if (result.exitCode) {