Ver a proveniência

Replaces strings with enums

main
Eric Amodio há 7 anos
ascendente
cometimento
a4115ffdee
8 ficheiros alterados com 17 adições e 17 eliminações
  1. +2
    -2
      src/commands/diffWithPrevious.ts
  2. +2
    -2
      src/commands/showQuickCommitDetails.ts
  3. +2
    -2
      src/commands/showQuickCommitFileDetails.ts
  4. +3
    -3
      src/git/parsers/logParser.ts
  5. +2
    -2
      src/quickPicks/commitDetails.ts
  6. +2
    -2
      src/quickPicks/commitFileDetails.ts
  7. +2
    -2
      src/quickPicks/common.ts
  8. +2
    -2
      src/views/commitFileNode.ts

+ 2
- 2
src/commands/diffWithPrevious.ts Ver ficheiro

@ -4,7 +4,7 @@ import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, window } fro
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
import { DiffWithCommandArgs } from './diffWith';
import { DiffWithWorkingCommandArgs } from './diffWithWorking';
import { GitCommit, GitService, GitUri } from '../gitService';
import { GitCommit, GitCommitType, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
@ -31,7 +31,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
if (args.commit === undefined || args.commit.type !== 'file' || args.range !== undefined) {
if (args.commit === undefined || args.commit.type !== GitCommitType.File || args.range !== undefined) {
const gitUri = await GitUri.fromUri(uri, this.git);
try {

+ 2
- 2
src/commands/showQuickCommitDetails.ts Ver ficheiro

@ -3,7 +3,7 @@ import { Strings } from '../system';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCachedCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
import { GlyphChars } from '../constants';
import { GitCommit, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
import { GitCommit, GitCommitType, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, CommitDetailsQuickPick, CommitWithFileStatusQuickPickItem } from '../quickPicks';
import { ShowQuickCommitFileDetailsCommandArgs } from './showQuickCommitFileDetails';
@ -81,7 +81,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
}
try {
if (args.commit === undefined || (args.commit.type !== 'branch' && args.commit.type !== 'stash')) {
if (args.commit === undefined || (args.commit.type !== GitCommitType.Branch && args.commit.type !== GitCommitType.Stash)) {
if (args.repoLog !== undefined) {
args.commit = args.repoLog.commits.get(args.sha!);
// If we can't find the commit, kill the repoLog

+ 2
- 2
src/commands/showQuickCommitFileDetails.ts Ver ficheiro

@ -3,7 +3,7 @@ import { Strings } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCachedCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
import { GlyphChars } from '../constants';
import { GitCommit, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
import { GitCommit, GitCommitType, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, CommitFileDetailsQuickPick } from '../quickPicks';
import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails';
@ -79,7 +79,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
}
try {
if (args.commit === undefined || args.commit.type !== 'file') {
if (args.commit === undefined || args.commit.type !== GitCommitType.File) {
if (args.commit !== undefined) {
workingFileName = undefined;
}

+ 3
- 3
src/git/parsers/logParser.ts Ver ficheiro

@ -113,7 +113,7 @@ export class GitLogParser {
break;
case 'filename':
if (type === 'branch') {
if (type === GitCommitType.Branch) {
next = lines.next();
if (next.done) break;
@ -185,7 +185,7 @@ export class GitLogParser {
this._parseFileName(entry);
}
if (first && repoPath === undefined && type === 'file' && fileName !== undefined) {
if (first && repoPath === undefined && type === GitCommitType.File && fileName !== undefined) {
// Try to get the repoPath from the most recent commit
repoPath = Git.normalizePath(fileName.replace(fileName.startsWith('/') ? `/${entry.fileName}` : entry.fileName!, ''));
relativeFileName = Git.normalizePath(path.relative(repoPath, fileName));
@ -250,7 +250,7 @@ export class GitLogParser {
commit.nextSha = commit.sha !== recentCommit.sha ? recentCommit.sha : recentCommit.nextSha;
// Only add a filename if this is a file log
if (type === 'file') {
if (type === GitCommitType.File) {
recentCommit.previousFileName = commit.originalFileName || commit.fileName;
commit.nextFileName = recentCommit.originalFileName || recentCommit.fileName;
}

+ 2
- 2
src/quickPicks/commitDetails.ts Ver ficheiro

@ -4,7 +4,7 @@ import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
import { GlyphChars } from '../constants';
import { getGitStatusOcticon, GitCommit, GitLog, GitLogCommit, GitService, GitStashCommit, GitStatusFile, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitStatusFile, RemoteResource } from '../gitService';
import { getGitStatusOcticon, GitCommit, GitCommitType, GitLog, GitLogCommit, GitService, GitStashCommit, GitStatusFile, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitStatusFile, RemoteResource } from '../gitService';
import { Keyboard, KeyCommand, KeyNoopCommand, Keys } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as path from 'path';
@ -99,7 +99,7 @@ export class CommitDetailsQuickPick {
static async show(git: GitService, commit: GitLogCommit, uri: Uri, goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem, repoLog?: GitLog): Promise<CommitWithFileStatusQuickPickItem | CommandQuickPickItem | undefined> {
const items: (CommitWithFileStatusQuickPickItem | CommandQuickPickItem)[] = commit.fileStatuses.map(fs => new CommitWithFileStatusQuickPickItem(commit, fs));
const stash = commit.type === 'stash';
const stash = commit.type === GitCommitType.Stash;
let index = 0;

+ 2
- 2
src/quickPicks/commitFileDetails.ts Ver ficheiro

@ -4,7 +4,7 @@ import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
import { GlyphChars } from '../constants';
import { GitLog, GitLogCommit, GitService, GitUri, RemoteResource } from '../gitService';
import { GitCommitType, GitLog, GitLogCommit, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyCommand, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as path from 'path';
@ -45,7 +45,7 @@ export class CommitFileDetailsQuickPick {
static async show(git: GitService, commit: GitLogCommit, uri: Uri, goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem, fileLog?: GitLog): Promise<CommandQuickPickItem | undefined> {
const items: CommandQuickPickItem[] = [];
const stash = commit.type === 'stash';
const stash = commit.type === GitCommitType.Stash;
const workingName = (commit.workingFileName && path.basename(commit.workingFileName)) || path.basename(commit.fileName);

+ 2
- 2
src/quickPicks/common.ts Ver ficheiro

@ -4,7 +4,7 @@ import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPick
import { Commands, openEditor } from '../commands';
import { ExtensionKey, IAdvancedConfig } from '../configuration';
import { GlyphChars } from '../constants';
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
import { GitCommit, GitCommitType, GitLogCommit, GitStashCommit } from '../gitService';
import { Keyboard, KeyboardScope, KeyMapping, Keys } from '../keyboard';
// import { Logger } from '../logger';
@ -178,7 +178,7 @@ export class CommitQuickPickItem implements QuickPickItem {
else {
this.label = message;
this.description = `${Strings.pad('$(git-commit)', 1, 1)} ${commit.shortSha}`;
this.detail = `${GlyphChars.Space} ${commit.author}, ${commit.fromNow()}${(commit.type === 'branch') ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
this.detail = `${GlyphChars.Space} ${commit.author}, ${commit.fromNow()}${(commit.type === GitCommitType.Branch) ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
}
}
}

+ 2
- 2
src/views/commitFileNode.ts Ver ficheiro

@ -2,7 +2,7 @@
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
import { ExplorerNode, ResourceType } from './explorerNode';
import { CommitFormatter, getGitStatusIcon, GitBranch, GitCommit, GitService, GitUri, ICommitFormatOptions, IGitStatusFile, IStatusFormatOptions, StatusFileFormatter } from '../gitService';
import { CommitFormatter, getGitStatusIcon, GitBranch, GitCommit, GitCommitType, GitService, GitUri, ICommitFormatOptions, IGitStatusFile, IStatusFormatOptions, StatusFileFormatter } from '../gitService';
import * as path from 'path';
export enum CommitFileNodeDisplayAs {
@ -38,7 +38,7 @@ export class CommitFileNode extends ExplorerNode {
}
async getTreeItem(): Promise<TreeItem> {
if (this.commit.type !== 'file') {
if (this.commit.type !== GitCommitType.File) {
const log = await this.git.getLogForFile(this.repoPath, this.status.fileName, this.commit.sha, { maxCount: 2 });
if (log !== undefined) {
this.commit = log.commits.get(this.commit.sha) || this.commit;

Carregando…
Cancelar
Guardar