mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-22 17:26:10 -05:00
Adds support for git commands on scheme=git
Rewrites blame annotation controller and provider - fixes whitespace issues, reduces overhead, and provides better performance Rewrites status bar blame support - reduces overhead and provides better performance Adds showFileHistory command to status bar Renames showHistory to showFileHistory Fixes log to use iso 8601 for dates
This commit is contained in:
@@ -35,10 +35,10 @@ export class GitBlameParserEnricher implements IGitEnricher<IGitBlame> {
|
||||
}
|
||||
|
||||
private _parseEntries(data: string): IBlameEntry[] {
|
||||
if (!data) return null;
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n');
|
||||
if (!lines.length) return null;
|
||||
if (!lines.length) return undefined;
|
||||
|
||||
const entries: IBlameEntry[] = [];
|
||||
|
||||
@@ -107,7 +107,7 @@ export class GitBlameParserEnricher implements IGitEnricher<IGitBlame> {
|
||||
entry.fileName = lineParts.slice(1).join(' ');
|
||||
|
||||
entries.push(entry);
|
||||
entry = null;
|
||||
entry = undefined;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -120,7 +120,7 @@ export class GitBlameParserEnricher implements IGitEnricher<IGitBlame> {
|
||||
|
||||
enrich(data: string, fileName: string): IGitBlame {
|
||||
const entries = this._parseEntries(data);
|
||||
if (!entries) return null;
|
||||
if (!entries) return undefined;
|
||||
|
||||
const authors: Map<string, IGitAuthor> = new Map();
|
||||
const commits: Map<string, GitCommit> = new Map();
|
||||
|
||||
@@ -19,10 +19,10 @@ interface ILogEntry {
|
||||
|
||||
export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
private _parseEntries(data: string): ILogEntry[] {
|
||||
if (!data) return null;
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n');
|
||||
if (!lines.length) return null;
|
||||
if (!lines.length) return undefined;
|
||||
|
||||
const entries: ILogEntry[] = [];
|
||||
|
||||
@@ -49,7 +49,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
break;
|
||||
|
||||
case 'author-date':
|
||||
entry.authorDate = lineParts.slice(1).join(' ').trim();
|
||||
entry.authorDate = `${lineParts[1]}T${lineParts[2]}${lineParts[3]}`;
|
||||
break;
|
||||
|
||||
// case 'committer':
|
||||
@@ -76,7 +76,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
}
|
||||
|
||||
entries.push(entry);
|
||||
entry = null;
|
||||
entry = undefined;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -89,7 +89,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
|
||||
enrich(data: string, fileName: string): IGitLog {
|
||||
const entries = this._parseEntries(data);
|
||||
if (!entries) return null;
|
||||
if (!entries) return undefined;
|
||||
|
||||
const authors: Map<string, IGitAuthor> = new Map();
|
||||
const commits: Map<string, GitCommit> = new Map();
|
||||
|
||||
@@ -83,13 +83,13 @@ export default class Git {
|
||||
static log(fileName: string, repoPath?: string) {
|
||||
const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath);
|
||||
|
||||
return gitCommand(root, 'log', `--follow`, `--name-only`, `--no-merges`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %s%nfilename ?`, file);
|
||||
return gitCommand(root, 'log', `--follow`, `--name-only`, `--no-merges`, `--date=iso8601-strict`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %s%nfilename ?`, file);
|
||||
}
|
||||
|
||||
static logRange(fileName: string, start: number, end: number, repoPath?: string) {
|
||||
const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath);
|
||||
|
||||
return gitCommand(root, 'log', `--name-only`, `--no-merges`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %s%nfilename ?`, `-L ${start},${end}:${file}`);
|
||||
return gitCommand(root, 'log', `--name-only`, `--no-merges`, `--date=iso8601-strict`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %s%nfilename ?`, `-L ${start},${end}:${file}`);
|
||||
}
|
||||
|
||||
static getVersionedFile(fileName: string, repoPath: string, sha: string) {
|
||||
@@ -102,7 +102,7 @@ export default class Git {
|
||||
return;
|
||||
}
|
||||
|
||||
//Logger.log(`getVersionedFile(${fileName}, ${sha}); destination=${destination}`);
|
||||
Logger.log(`getVersionedFile(${fileName}, ${repoPath}, ${sha}); destination=${destination}`);
|
||||
fs.appendFile(destination, data, err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
import { spawnPromise } from 'spawn-rx';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user