mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-23 01:35:37 -05:00
Reworks date parsing, formatting etc for perf
Isolates moment.js
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitCommitLine } from './../git';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
interface BlameEntry {
|
||||
@@ -134,7 +133,7 @@ export class GitBlameParser {
|
||||
}
|
||||
}
|
||||
|
||||
commit = new GitBlameCommit(repoPath!, entry.sha, fileName!, entry.author, moment(`${entry.authorDate} ${entry.authorTimeZone}`, 'X +-HHmm').toDate(), entry.summary!, []);
|
||||
commit = new GitBlameCommit(repoPath!, entry.sha, fileName!, entry.author, new Date(entry.authorDate as any * 1000), entry.summary!, []);
|
||||
|
||||
if (fileName !== entry.fileName) {
|
||||
commit.originalFileName = entry.fileName;
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Strings } from '../../system';
|
||||
import { Range } from 'vscode';
|
||||
import { Git, GitAuthor, GitCommitType, GitLog, GitLogCommit, GitStatusFileStatus, IGitStatusFile } from './../git';
|
||||
// import { Logger } from '../../logger';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
interface LogEntry {
|
||||
@@ -87,7 +86,7 @@ export class GitLogParser {
|
||||
break;
|
||||
|
||||
case 'author-date':
|
||||
entry.authorDate = `${lineParts[1]}T${lineParts[2]}${lineParts[3]}`;
|
||||
entry.authorDate = lineParts[1];
|
||||
break;
|
||||
|
||||
case 'parents':
|
||||
@@ -231,7 +230,7 @@ export class GitLogParser {
|
||||
}
|
||||
}
|
||||
|
||||
commit = new GitLogCommit(type, repoPath!, entry.sha, relativeFileName, entry.author, moment(entry.authorDate).toDate(), entry.summary!, entry.status, entry.fileStatuses, undefined, entry.originalFileName);
|
||||
commit = new GitLogCommit(type, repoPath!, entry.sha, relativeFileName, entry.author, new Date(entry.authorDate! as any * 1000), entry.summary!, entry.status, entry.fileStatuses, undefined, entry.originalFileName);
|
||||
commit.parentShas = entry.parentShas!;
|
||||
|
||||
if (relativeFileName !== entry.fileName) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
import { Git, GitStash, GitStashCommit, GitStatusFileStatus, IGitStatusFile } from './../git';
|
||||
// import { Logger } from '../../logger';
|
||||
import * as moment from 'moment';
|
||||
|
||||
interface StashEntry {
|
||||
sha: string;
|
||||
@@ -42,7 +41,7 @@ export class GitStashParser {
|
||||
|
||||
switch (lineParts[0]) {
|
||||
case 'author-date':
|
||||
entry.date = `${lineParts[1]}T${lineParts[2]}${lineParts[3]}`;
|
||||
entry.date = lineParts[1];
|
||||
break;
|
||||
|
||||
case 'summary':
|
||||
@@ -120,7 +119,7 @@ export class GitStashParser {
|
||||
|
||||
let commit = commits.get(entry.sha);
|
||||
if (commit === undefined) {
|
||||
commit = new GitStashCommit(entry.stashName, repoPath, entry.sha, entry.fileNames, moment(entry.date).toDate(), entry.summary, undefined, entry.fileStatuses) as GitStashCommit;
|
||||
commit = new GitStashCommit(entry.stashName, repoPath, entry.sha, entry.fileNames, new Date(entry.date! as any * 1000), entry.summary, undefined, entry.fileStatuses) as GitStashCommit;
|
||||
commits.set(entry.sha, commit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user