mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 17:25:28 -05:00
Removes I from interface naming of "things"
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { GitCommit } from '../models/commit';
|
||||
import { IGitDiffLine } from '../models/diff';
|
||||
import { GitDiffLine } from '../models/diff';
|
||||
import * as moment from 'moment';
|
||||
|
||||
export interface ICommitFormatOptions {
|
||||
@@ -142,7 +142,7 @@ export class CommitFormatter {
|
||||
return `\`${commit.shortSha}\` __${commit.author}__, ${moment(commit.date).fromNow()} _(${moment(commit.date).format(dateFormat)})_${message}`;
|
||||
}
|
||||
|
||||
static toHoverDiff(commit: GitCommit, previous: IGitDiffLine | undefined, current: IGitDiffLine | undefined): string | undefined {
|
||||
static toHoverDiff(commit: GitCommit, previous: GitDiffLine | undefined, current: GitDiffLine | undefined): string | undefined {
|
||||
if (previous === undefined && current === undefined) return undefined;
|
||||
|
||||
const codeDiff = this._getCodeDiff(previous, current);
|
||||
@@ -151,7 +151,7 @@ export class CommitFormatter {
|
||||
: `\`Changes\` \u2014 \`${commit.previousShortSha}\` \u2194 \`${commit.shortSha}\`\n${codeDiff}`;
|
||||
}
|
||||
|
||||
private static _getCodeDiff(previous: IGitDiffLine | undefined, current: IGitDiffLine | undefined): string {
|
||||
private static _getCodeDiff(previous: GitDiffLine | undefined, current: GitDiffLine | undefined): string {
|
||||
return `\`\`\`
|
||||
- ${previous === undefined ? '' : previous.line.trim()}
|
||||
+ ${current === undefined ? '' : current.line.trim()}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
'use strict';
|
||||
import { GitCommit, IGitAuthor, IGitCommitLine } from './commit';
|
||||
import { GitAuthor, GitCommit, GitCommitLine } from './commit';
|
||||
|
||||
export interface IGitBlame {
|
||||
export interface GitBlame {
|
||||
repoPath: string;
|
||||
authors: Map<string, IGitAuthor>;
|
||||
authors: Map<string, GitAuthor>;
|
||||
commits: Map<string, GitCommit>;
|
||||
lines: IGitCommitLine[];
|
||||
lines: GitCommitLine[];
|
||||
}
|
||||
|
||||
export interface IGitBlameLine {
|
||||
author: IGitAuthor;
|
||||
export interface GitBlameLine {
|
||||
author: GitAuthor;
|
||||
commit: GitCommit;
|
||||
line: IGitCommitLine;
|
||||
line: GitCommitLine;
|
||||
}
|
||||
|
||||
export interface IGitBlameLines extends IGitBlame {
|
||||
allLines: IGitCommitLine[];
|
||||
export interface GitBlameLines extends GitBlame {
|
||||
allLines: GitCommitLine[];
|
||||
}
|
||||
|
||||
export interface IGitBlameCommitLines {
|
||||
author: IGitAuthor;
|
||||
export interface GitBlameCommitLines {
|
||||
author: GitAuthor;
|
||||
commit: GitCommit;
|
||||
lines: IGitCommitLine[];
|
||||
lines: GitCommitLine[];
|
||||
}
|
||||
@@ -3,30 +3,12 @@ import { Uri } from 'vscode';
|
||||
import { Git } from '../git';
|
||||
import * as path from 'path';
|
||||
|
||||
export interface IGitAuthor {
|
||||
export interface GitAuthor {
|
||||
name: string;
|
||||
lineCount: number;
|
||||
}
|
||||
|
||||
export interface IGitCommit {
|
||||
type: GitCommitType;
|
||||
repoPath: string;
|
||||
sha: string;
|
||||
fileName: string;
|
||||
author?: string;
|
||||
date: Date;
|
||||
message: string;
|
||||
lines: IGitCommitLine[];
|
||||
originalFileName?: string;
|
||||
previousSha?: string;
|
||||
previousFileName?: string;
|
||||
|
||||
readonly isUncommitted: boolean;
|
||||
previousUri: Uri;
|
||||
uri: Uri;
|
||||
}
|
||||
|
||||
export interface IGitCommitLine {
|
||||
export interface GitCommitLine {
|
||||
sha: string;
|
||||
previousSha?: string;
|
||||
line: number;
|
||||
@@ -36,10 +18,10 @@ export interface IGitCommitLine {
|
||||
|
||||
export type GitCommitType = 'blame' | 'branch' | 'file' | 'stash';
|
||||
|
||||
export class GitCommit implements IGitCommit {
|
||||
export class GitCommit {
|
||||
|
||||
type: GitCommitType;
|
||||
lines: IGitCommitLine[];
|
||||
lines: GitCommitLine[];
|
||||
originalFileName?: string;
|
||||
previousSha?: string;
|
||||
previousFileName?: string;
|
||||
@@ -54,7 +36,7 @@ export class GitCommit implements IGitCommit {
|
||||
public author: string,
|
||||
public date: Date,
|
||||
public message: string,
|
||||
lines?: IGitCommitLine[],
|
||||
lines?: GitCommitLine[],
|
||||
originalFileName?: string,
|
||||
previousSha?: string,
|
||||
previousFileName?: string
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
export interface IGitDiffLine {
|
||||
export interface GitDiffLine {
|
||||
line: string;
|
||||
state: 'added' | 'removed' | 'unchanged';
|
||||
}
|
||||
|
||||
export interface IGitDiffChunk {
|
||||
current: (IGitDiffLine | undefined)[];
|
||||
export interface GitDiffChunk {
|
||||
current: (GitDiffLine | undefined)[];
|
||||
currentStart: number;
|
||||
currentEnd: number;
|
||||
|
||||
previous: (IGitDiffLine | undefined)[];
|
||||
previous: (GitDiffLine | undefined)[];
|
||||
previousStart: number;
|
||||
previousEnd: number;
|
||||
|
||||
chunk?: string;
|
||||
}
|
||||
|
||||
export interface IGitDiff {
|
||||
chunks: IGitDiffChunk[];
|
||||
export interface GitDiff {
|
||||
chunks: GitDiffChunk[];
|
||||
|
||||
diff?: string;
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
import { Range } from 'vscode';
|
||||
import { IGitAuthor } from './commit';
|
||||
import { GitAuthor } from './commit';
|
||||
import { GitLogCommit } from './logCommit';
|
||||
|
||||
export interface IGitLog {
|
||||
export interface GitLog {
|
||||
repoPath: string;
|
||||
authors: Map<string, IGitAuthor>;
|
||||
authors: Map<string, GitAuthor>;
|
||||
commits: Map<string, GitLogCommit>;
|
||||
|
||||
sha: string | undefined;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { Uri } from 'vscode';
|
||||
import { GitCommit, GitCommitType, IGitCommitLine } from './commit';
|
||||
import { GitCommit, GitCommitLine, GitCommitType } from './commit';
|
||||
import { GitStatusFileStatus, IGitStatusFile } from './status';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -23,7 +23,7 @@ export class GitLogCommit extends GitCommit {
|
||||
message: string,
|
||||
status?: GitStatusFileStatus,
|
||||
fileStatuses?: IGitStatusFile[],
|
||||
lines?: IGitCommitLine[],
|
||||
lines?: GitCommitLine[],
|
||||
originalFileName?: string,
|
||||
previousSha?: string,
|
||||
previousFileName?: string
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { GitStashCommit } from './stashCommit';
|
||||
|
||||
export interface IGitStash {
|
||||
export interface GitStash {
|
||||
repoPath: string;
|
||||
commits: Map<string, GitStashCommit>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
import { IGitCommitLine } from './commit';
|
||||
import { GitCommitLine } from './commit';
|
||||
import { GitLogCommit } from './logCommit';
|
||||
import { GitStatusFileStatus, IGitStatusFile } from './status';
|
||||
|
||||
@@ -14,7 +14,7 @@ export class GitStashCommit extends GitLogCommit {
|
||||
message: string,
|
||||
status?: GitStatusFileStatus,
|
||||
fileStatuses?: IGitStatusFile[],
|
||||
lines?: IGitCommitLine[],
|
||||
lines?: GitCommitLine[],
|
||||
originalFileName?: string,
|
||||
previousSha?: string,
|
||||
previousFileName?: string
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Uri } from 'vscode';
|
||||
import * as path from 'path';
|
||||
|
||||
export interface IGitStatus {
|
||||
export interface GitStatus {
|
||||
|
||||
branch: string;
|
||||
repoPath: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
import { Git, GitCommit, IGitAuthor, IGitBlame, IGitCommitLine } from './../git';
|
||||
import { Git, GitAuthor, GitBlame, GitCommit, GitCommitLine } from './../git';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
interface IBlameEntry {
|
||||
interface BlameEntry {
|
||||
sha: string;
|
||||
|
||||
line: number;
|
||||
@@ -30,15 +30,15 @@ interface IBlameEntry {
|
||||
|
||||
export class GitBlameParser {
|
||||
|
||||
private static _parseEntries(data: string): IBlameEntry[] | undefined {
|
||||
private static _parseEntries(data: string): BlameEntry[] | undefined {
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n');
|
||||
if (!lines.length) return undefined;
|
||||
|
||||
const entries: IBlameEntry[] = [];
|
||||
const entries: BlameEntry[] = [];
|
||||
|
||||
let entry: IBlameEntry | undefined = undefined;
|
||||
let entry: BlameEntry | undefined = undefined;
|
||||
let position = -1;
|
||||
while (++position < lines.length) {
|
||||
const lineParts = lines[position].split(' ');
|
||||
@@ -50,7 +50,7 @@ export class GitBlameParser {
|
||||
originalLine: parseInt(lineParts[1], 10) - 1,
|
||||
line: parseInt(lineParts[2], 10) - 1,
|
||||
lineCount: parseInt(lineParts[3], 10)
|
||||
} as IBlameEntry;
|
||||
} as BlameEntry;
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -114,13 +114,13 @@ export class GitBlameParser {
|
||||
return entries;
|
||||
}
|
||||
|
||||
static parse(data: string, repoPath: string | undefined, fileName: string): IGitBlame | undefined {
|
||||
static parse(data: string, repoPath: string | undefined, fileName: string): GitBlame | undefined {
|
||||
const entries = this._parseEntries(data);
|
||||
if (!entries) return undefined;
|
||||
|
||||
const authors: Map<string, IGitAuthor> = new Map();
|
||||
const authors: Map<string, GitAuthor> = new Map();
|
||||
const commits: Map<string, GitCommit> = new Map();
|
||||
const lines: IGitCommitLine[] = [];
|
||||
const lines: GitCommitLine[] = [];
|
||||
|
||||
let relativeFileName = repoPath && fileName;
|
||||
|
||||
@@ -161,7 +161,7 @@ export class GitBlameParser {
|
||||
}
|
||||
|
||||
for (let j = 0, len = entry.lineCount; j < len; j++) {
|
||||
const line: IGitCommitLine = {
|
||||
const line: GitCommitLine = {
|
||||
sha: entry.sha,
|
||||
line: entry.line + j,
|
||||
originalLine: entry.originalLine + j
|
||||
@@ -185,7 +185,7 @@ export class GitBlameParser {
|
||||
author.lineCount += c.lines.length;
|
||||
});
|
||||
|
||||
const sortedAuthors: Map<string, IGitAuthor> = new Map();
|
||||
const sortedAuthors: Map<string, GitAuthor> = new Map();
|
||||
// const values =
|
||||
Array.from(authors.values())
|
||||
.sort((a, b) => b.lineCount - a.lineCount)
|
||||
@@ -202,6 +202,6 @@ export class GitBlameParser {
|
||||
// commits: sortedCommits,
|
||||
commits: commits,
|
||||
lines: lines
|
||||
} as IGitBlame;
|
||||
} as GitBlame;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
'use strict';
|
||||
import { IGitDiff, IGitDiffChunk, IGitDiffLine } from './../git';
|
||||
import { GitDiff, GitDiffChunk, GitDiffLine } from './../git';
|
||||
|
||||
const unifiedDiffRegex = /^@@ -([\d]+),([\d]+) [+]([\d]+),([\d]+) @@([\s\S]*?)(?=^@@)/gm;
|
||||
|
||||
export class GitDiffParser {
|
||||
|
||||
static parse(data: string, debug: boolean = false): IGitDiff | undefined {
|
||||
static parse(data: string, debug: boolean = false): GitDiff | undefined {
|
||||
if (!data) return undefined;
|
||||
|
||||
const chunks: IGitDiffChunk[] = [];
|
||||
const chunks: GitDiffChunk[] = [];
|
||||
|
||||
let match: RegExpExecArray | null = null;
|
||||
do {
|
||||
@@ -21,8 +21,8 @@ export class GitDiffParser {
|
||||
const chunk = match[5];
|
||||
const lines = chunk.split('\n').slice(1);
|
||||
|
||||
const current: (IGitDiffLine | undefined)[] = [];
|
||||
const previous: (IGitDiffLine | undefined)[] = [];
|
||||
const current: (GitDiffLine | undefined)[] = [];
|
||||
const previous: (GitDiffLine | undefined)[] = [];
|
||||
for (const l of lines) {
|
||||
switch (l[0]) {
|
||||
case '+':
|
||||
@@ -64,7 +64,7 @@ export class GitDiffParser {
|
||||
const diff = {
|
||||
diff: debug ? data : undefined,
|
||||
chunks: chunks
|
||||
} as IGitDiff;
|
||||
} as GitDiff;
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
import { Range } from 'vscode';
|
||||
import { Git, GitCommitType, GitLogCommit, GitStatusFileStatus, IGitAuthor, IGitLog, IGitStatusFile } from './../git';
|
||||
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 ILogEntry {
|
||||
interface LogEntry {
|
||||
sha: string;
|
||||
|
||||
author: string;
|
||||
@@ -29,15 +29,15 @@ const diffRegex = /diff --git a\/(.*) b\/(.*)/;
|
||||
|
||||
export class GitLogParser {
|
||||
|
||||
private static _parseEntries(data: string, type: GitCommitType, maxCount: number | undefined, reverse: boolean): ILogEntry[] | undefined {
|
||||
private static _parseEntries(data: string, type: GitCommitType, maxCount: number | undefined, reverse: boolean): LogEntry[] | undefined {
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n');
|
||||
if (!lines.length) return undefined;
|
||||
|
||||
const entries: ILogEntry[] = [];
|
||||
const entries: LogEntry[] = [];
|
||||
|
||||
let entry: ILogEntry | undefined = undefined;
|
||||
let entry: LogEntry | undefined = undefined;
|
||||
let position = -1;
|
||||
while (++position < lines.length) {
|
||||
// Since log --reverse doesn't properly honor a max count -- enforce it here
|
||||
@@ -53,7 +53,7 @@ export class GitLogParser {
|
||||
|
||||
entry = {
|
||||
sha: lineParts[0]
|
||||
} as ILogEntry;
|
||||
} as LogEntry;
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -166,11 +166,11 @@ export class GitLogParser {
|
||||
return entries;
|
||||
}
|
||||
|
||||
static parse(data: string, type: GitCommitType, repoPath: string | undefined, fileName: string | undefined, sha: string | undefined, maxCount: number | undefined, reverse: boolean, range: Range | undefined): IGitLog | undefined {
|
||||
static parse(data: string, type: GitCommitType, repoPath: string | undefined, fileName: string | undefined, sha: string | undefined, maxCount: number | undefined, reverse: boolean, range: Range | undefined): GitLog | undefined {
|
||||
const entries = this._parseEntries(data, type, maxCount, reverse);
|
||||
if (!entries) return undefined;
|
||||
|
||||
const authors: Map<string, IGitAuthor> = new Map();
|
||||
const authors: Map<string, GitAuthor> = new Map();
|
||||
const commits: Map<string, GitLogCommit> = new Map();
|
||||
|
||||
let relativeFileName: string;
|
||||
@@ -245,7 +245,7 @@ export class GitLogParser {
|
||||
author.lineCount += c.lines.length;
|
||||
});
|
||||
|
||||
const sortedAuthors: Map<string, IGitAuthor> = new Map();
|
||||
const sortedAuthors: Map<string, GitAuthor> = new Map();
|
||||
// const values =
|
||||
Array.from(authors.values())
|
||||
.sort((a, b) => b.lineCount - a.lineCount)
|
||||
@@ -265,7 +265,7 @@ export class GitLogParser {
|
||||
maxCount: maxCount,
|
||||
range: range,
|
||||
truncated: !!(maxCount && entries.length >= maxCount)
|
||||
} as IGitLog;
|
||||
} as GitLog;
|
||||
}
|
||||
|
||||
private static _parseFileName(entry: { fileName?: string, originalFileName?: string }) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
import { Git, GitStashCommit, GitStatusFileStatus, IGitStash, IGitStatusFile } from './../git';
|
||||
import { Git, GitStash, GitStashCommit, GitStatusFileStatus, IGitStatusFile } from './../git';
|
||||
// import { Logger } from '../../logger';
|
||||
import * as moment from 'moment';
|
||||
|
||||
interface IStashEntry {
|
||||
interface StashEntry {
|
||||
sha: string;
|
||||
date?: string;
|
||||
fileNames: string;
|
||||
@@ -14,15 +14,15 @@ interface IStashEntry {
|
||||
|
||||
export class GitStashParser {
|
||||
|
||||
private static _parseEntries(data: string): IStashEntry[] | undefined {
|
||||
private static _parseEntries(data: string): StashEntry[] | undefined {
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n');
|
||||
if (!lines.length) return undefined;
|
||||
|
||||
const entries: IStashEntry[] = [];
|
||||
const entries: StashEntry[] = [];
|
||||
|
||||
let entry: IStashEntry | undefined = undefined;
|
||||
let entry: StashEntry | undefined = undefined;
|
||||
let position = -1;
|
||||
while (++position < lines.length) {
|
||||
let lineParts = lines[position].split(' ');
|
||||
@@ -35,7 +35,7 @@ export class GitStashParser {
|
||||
|
||||
entry = {
|
||||
sha: lineParts[0]
|
||||
} as IStashEntry;
|
||||
} as StashEntry;
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export class GitStashParser {
|
||||
return entries;
|
||||
}
|
||||
|
||||
static parse(data: string, repoPath: string): IGitStash | undefined {
|
||||
static parse(data: string, repoPath: string): GitStash | undefined {
|
||||
const entries = this._parseEntries(data);
|
||||
if (entries === undefined) return undefined;
|
||||
|
||||
@@ -128,7 +128,7 @@ export class GitStashParser {
|
||||
return {
|
||||
repoPath: repoPath,
|
||||
commits: commits
|
||||
} as IGitStash;
|
||||
} as GitStash;
|
||||
}
|
||||
|
||||
private static _parseFileName(entry: { fileName?: string, originalFileName?: string }) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Git, GitStatusFile, GitStatusFileStatus, IGitStatus } from './../git';
|
||||
import { Git, GitStatus, GitStatusFile, GitStatusFileStatus } from './../git';
|
||||
|
||||
interface IFileStatusEntry {
|
||||
interface FileStatusEntry {
|
||||
staged: boolean;
|
||||
status: GitStatusFileStatus;
|
||||
fileName: string;
|
||||
@@ -13,7 +13,7 @@ const behindStatusV1Regex = /(?:behind ([0-9]+))/;
|
||||
|
||||
export class GitStatusParser {
|
||||
|
||||
static parse(data: string, repoPath: string, porcelainVersion: number): IGitStatus | undefined {
|
||||
static parse(data: string, repoPath: string, porcelainVersion: number): GitStatus | undefined {
|
||||
if (!data) return undefined;
|
||||
|
||||
const lines = data.split('\n').filter(_ => !!_);
|
||||
@@ -40,7 +40,7 @@ export class GitStatusParser {
|
||||
return status;
|
||||
}
|
||||
|
||||
private static _parseV1(lines: string[], repoPath: string, status: IGitStatus) {
|
||||
private static _parseV1(lines: string[], repoPath: string, status: GitStatus) {
|
||||
let position = -1;
|
||||
while (++position < lines.length) {
|
||||
const line = lines[position];
|
||||
@@ -59,7 +59,7 @@ export class GitStatusParser {
|
||||
}
|
||||
}
|
||||
else {
|
||||
let entry: IFileStatusEntry;
|
||||
let entry: FileStatusEntry;
|
||||
const rawStatus = line.substring(0, 2);
|
||||
const fileName = line.substring(3);
|
||||
if (rawStatus[0] === 'R') {
|
||||
@@ -74,7 +74,7 @@ export class GitStatusParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static _parseV2(lines: string[], repoPath: string, status: IGitStatus) {
|
||||
private static _parseV2(lines: string[], repoPath: string, status: GitStatus) {
|
||||
let position = -1;
|
||||
while (++position < lines.length) {
|
||||
const line = lines[position];
|
||||
@@ -99,7 +99,7 @@ export class GitStatusParser {
|
||||
}
|
||||
else {
|
||||
const lineParts = line.split(' ');
|
||||
let entry: IFileStatusEntry | undefined = undefined;
|
||||
let entry: FileStatusEntry | undefined = undefined;
|
||||
switch (lineParts[0][0]) {
|
||||
case '1': // normal
|
||||
entry = this._parseFileEntry(lineParts[1], lineParts.slice(8).join(' '));
|
||||
@@ -123,7 +123,7 @@ export class GitStatusParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static _parseFileEntry(rawStatus: string, fileName: string, originalFileName?: string): IFileStatusEntry {
|
||||
private static _parseFileEntry(rawStatus: string, fileName: string, originalFileName?: string): FileStatusEntry {
|
||||
const indexStatus = rawStatus[0] !== '.' ? rawStatus[0].trim() : undefined;
|
||||
const workTreeStatus = rawStatus[1] !== '.' ? rawStatus[1].trim() : undefined;
|
||||
|
||||
@@ -132,6 +132,6 @@ export class GitStatusParser {
|
||||
fileName: fileName,
|
||||
originalFileName: originalFileName,
|
||||
staged: !!indexStatus
|
||||
} as IFileStatusEntry;
|
||||
} as FileStatusEntry;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user