Ver código fonte

Renames GitProvider to GitService

main
Eric Amodio 7 anos atrás
pai
commit
332b2c3b91
36 arquivos alterados com 792 adições e 792 exclusões
  1. +2
    -2
      src/blameActiveLineController.ts
  2. +2
    -2
      src/blameAnnotationController.ts
  3. +1
    -1
      src/blameAnnotationFormatter.ts
  4. +2
    -2
      src/blameAnnotationProvider.ts
  5. +2
    -2
      src/blameabilityTracker.ts
  6. +2
    -2
      src/commands/closeUnchangedFiles.ts
  7. +2
    -2
      src/commands/copyMessageToClipboard.ts
  8. +2
    -2
      src/commands/copyShaToClipboard.ts
  9. +2
    -2
      src/commands/diffDirectory.ts
  10. +3
    -3
      src/commands/diffLineWithPrevious.ts
  11. +3
    -3
      src/commands/diffLineWithWorking.ts
  12. +2
    -2
      src/commands/diffWithNext.ts
  13. +2
    -2
      src/commands/diffWithPrevious.ts
  14. +3
    -3
      src/commands/diffWithWorking.ts
  15. +2
    -2
      src/commands/openChangedFiles.ts
  16. +2
    -2
      src/commands/showBlameHistory.ts
  17. +2
    -2
      src/commands/showFileHistory.ts
  18. +2
    -2
      src/commands/showQuickCommitDetails.ts
  19. +2
    -2
      src/commands/showQuickCommitFileDetails.ts
  20. +2
    -2
      src/commands/showQuickFileHistory.ts
  21. +2
    -2
      src/commands/showQuickRepoHistory.ts
  22. +2
    -2
      src/commands/showQuickRepoStatus.ts
  23. +2
    -2
      src/commands/toggleCodeLens.ts
  24. +2
    -2
      src/extension.ts
  25. +3
    -3
      src/git/gitUri.ts
  26. +2
    -2
      src/gitCodeLensProvider.ts
  27. +3
    -3
      src/gitContentProvider.ts
  28. +5
    -5
      src/gitRevisionCodeLensProvider.ts
  29. +17
    -17
      src/gitService.ts
  30. +3
    -3
      src/quickPicks/commitDetails.ts
  31. +3
    -3
      src/quickPicks/commitFileDetails.ts
  32. +1
    -1
      src/quickPicks/fileHistory.ts
  33. +2
    -2
      src/quickPicks/gitQuickPicks.ts
  34. +1
    -1
      src/quickPicks/repoHistory.ts
  35. +1
    -1
      src/quickPicks/repoStatus.ts

+ 2
- 2
src/blameActiveLineController.ts Ver arquivo

@ -7,7 +7,7 @@ import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotati
import { TextEditorComparer } from './comparers';
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
import { DocumentSchemes } from './constants';
import { GitCommit, GitProvider, GitUri, IGitBlame, IGitCommitLine } from './gitProvider';
import { GitCommit, GitService, GitUri, IGitBlame, IGitCommitLine } from './gitService';
import * as moment from 'moment';
const activeLineDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
@ -30,7 +30,7 @@ export class BlameActiveLineController extends Disposable {
private _uri: GitUri;
private _useCaching: boolean;
constructor(context: ExtensionContext, private git: GitProvider, private blameabilityTracker: BlameabilityTracker, private annotationController: BlameAnnotationController) {
constructor(context: ExtensionContext, private git: GitService, private blameabilityTracker: BlameabilityTracker, private annotationController: BlameAnnotationController) {
super(() => this.dispose());
this._updateBlameDebounced = Functions.debounce(this._updateBlame, 50);

+ 2
- 2
src/blameAnnotationController.ts Ver arquivo

@ -5,7 +5,7 @@ import { BlameabilityChangeEvent, BlameabilityTracker } from './blameabilityTrac
import { BlameAnnotationProvider } from './blameAnnotationProvider';
import { TextDocumentComparer, TextEditorComparer } from './comparers';
import { IBlameConfig } from './configuration';
import { GitProvider, GitUri } from './gitProvider';
import { GitService, GitUri } from './gitService';
import { Logger } from './logger';
import { WhitespaceController } from './whitespaceController';
@ -34,7 +34,7 @@ export class BlameAnnotationController extends Disposable {
private _disposable: Disposable;
private _whitespaceController: WhitespaceController | undefined;
constructor(private context: ExtensionContext, private git: GitProvider, private blameabilityTracker: BlameabilityTracker) {
constructor(private context: ExtensionContext, private git: GitService, private blameabilityTracker: BlameabilityTracker) {
super(() => this.dispose());
this._onConfigurationChanged();

+ 1
- 1
src/blameAnnotationFormatter.ts Ver arquivo

@ -1,6 +1,6 @@
'use strict';
import { IBlameConfig } from './configuration';
import { GitCommit, IGitCommitLine } from './gitProvider';
import { GitCommit, IGitCommitLine } from './gitService';
import * as moment from 'moment';
export const defaultAbsoluteDateLength = 10;

+ 2
- 2
src/blameAnnotationProvider.ts Ver arquivo

@ -5,7 +5,7 @@ import { BlameAnnotationFormat, BlameAnnotationFormatter, cssIndent, defaultAuth
import { BlameDecorations } from './blameAnnotationController';
import { TextDocumentComparer } from './comparers';
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
import { GitProvider, GitUri, IGitBlame } from './gitProvider';
import { GitService, GitUri, IGitBlame } from './gitService';
import { WhitespaceController } from './whitespaceController';
export class BlameAnnotationProvider extends Disposable {
@ -16,7 +16,7 @@ export class BlameAnnotationProvider extends Disposable {
private _config: IBlameConfig;
private _disposable: Disposable;
constructor(context: ExtensionContext, private git: GitProvider, private whitespaceController: WhitespaceController | undefined, public editor: TextEditor, private uri: GitUri) {
constructor(context: ExtensionContext, private git: GitService, private whitespaceController: WhitespaceController | undefined, public editor: TextEditor, private uri: GitUri) {
super(() => this.dispose());
this.document = this.editor.document;

+ 2
- 2
src/blameabilityTracker.ts Ver arquivo

@ -2,7 +2,7 @@
import { Disposable, Event, EventEmitter, TextDocument, TextDocumentChangeEvent, TextEditor, window, workspace } from 'vscode';
import { CommandContext, setCommandContext } from './commands';
import { TextDocumentComparer } from './comparers';
import { GitProvider } from './gitProvider';
import { GitService } from './gitService';
export interface BlameabilityChangeEvent {
blameable: boolean;
@ -21,7 +21,7 @@ export class BlameabilityTracker extends Disposable {
private _editor: TextEditor;
private _isBlameable: boolean;
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(() => this.dispose());
const subscriptions: Disposable[] = [];

+ 2
- 2
src/commands/closeUnchangedFiles.ts Ver arquivo

@ -3,13 +3,13 @@ import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorTracker } from '../activeEditorTracker';
import { ActiveEditorCommand, Commands } from './commands';
import { TextEditorComparer, UriComparer } from '../comparers';
import { GitProvider } from '../gitProvider';
import { GitService } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export class CloseUnchangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.CloseUnchangedFiles);
}

+ 2
- 2
src/commands/copyMessageToClipboard.ts Ver arquivo

@ -2,13 +2,13 @@
import { Iterables } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitProvider, GitUri } from '../gitProvider';
import { GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import { copy } from 'copy-paste';
export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.CopyMessageToClipboard);
}

+ 2
- 2
src/commands/copyShaToClipboard.ts Ver arquivo

@ -2,13 +2,13 @@
import { Iterables } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitProvider, GitUri } from '../gitProvider';
import { GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import { copy } from 'copy-paste';
export class CopyShaToClipboardCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.CopyShaToClipboard);
}

+ 2
- 2
src/commands/diffDirectory.ts Ver arquivo

@ -1,12 +1,12 @@
'use strict';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitProvider } from '../gitProvider';
import { GitService } from '../gitService';
import { Logger } from '../logger';
export class DiffDirectoryCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.DiffDirectory);
}

+ 3
- 3
src/commands/diffLineWithPrevious.ts Ver arquivo

@ -2,13 +2,13 @@
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { BuiltInCommands } from '../constants';
import { GitCommit, GitProvider, GitUri } from '../gitProvider';
import { GitCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.DiffLineWithPrevious);
}
@ -23,7 +23,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
const gitUri = await GitUri.fromUri(uri, this.git);
line = line || (editor && editor.selection.active.line) || gitUri.offset;
if (!commit || GitProvider.isUncommitted(commit.sha)) {
if (!commit || GitService.isUncommitted(commit.sha)) {
if (editor && editor.document && editor.document.isDirty) return undefined;
const blameline = line - gitUri.offset;

+ 3
- 3
src/commands/diffLineWithWorking.ts Ver arquivo

@ -1,12 +1,12 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitCommit, GitProvider, GitUri } from '../gitProvider';
import { GitCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.DiffLineWithWorking);
}
@ -21,7 +21,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
const gitUri = await GitUri.fromUri(uri, this.git);
line = line || (editor && editor.selection.active.line) || gitUri.offset;
if (!commit || GitProvider.isUncommitted(commit.sha)) {
if (!commit || GitService.isUncommitted(commit.sha)) {
if (editor && editor.document && editor.document.isDirty) return undefined;
const blameline = line - gitUri.offset;

+ 2
- 2
src/commands/diffWithNext.ts Ver arquivo

@ -3,14 +3,14 @@ import { Iterables } from '../system';
import { commands, Range, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { BuiltInCommands } from '../constants';
import { GitLogCommit, GitProvider, GitUri } from '../gitProvider';
import { GitLogCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
// import * as moment from 'moment';
import * as path from 'path';
export class DiffWithNextCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.DiffWithNext);
}

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

@ -3,14 +3,14 @@ import { Iterables } from '../system';
import { commands, Range, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { BuiltInCommands } from '../constants';
import { GitCommit, GitProvider, GitUri } from '../gitProvider';
import { GitCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import * as moment from 'moment';
import * as path from 'path';
export class DiffWithPreviousCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.DiffWithPrevious);
}

+ 3
- 3
src/commands/diffWithWorking.ts Ver arquivo

@ -3,13 +3,13 @@ import { Iterables } from '../system';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { BuiltInCommands } from '../constants';
import { GitCommit, GitProvider, GitUri } from '../gitProvider';
import { GitCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export class DiffWithWorkingCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.DiffWithWorking);
}
@ -23,7 +23,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
line = line || (editor && editor.selection.active.line) || 0;
if (!commit || GitProvider.isUncommitted(commit.sha)) {
if (!commit || GitService.isUncommitted(commit.sha)) {
const gitUri = await GitUri.fromUri(uri, this.git);
try {

+ 2
- 2
src/commands/openChangedFiles.ts Ver arquivo

@ -1,13 +1,13 @@
'use strict';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands, openEditor } from './commands';
import { GitProvider } from '../gitProvider';
import { GitService } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export class OpenChangedFilesCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.OpenChangedFiles);
}

+ 2
- 2
src/commands/showBlameHistory.ts Ver arquivo

@ -2,12 +2,12 @@
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './commands';
import { BuiltInCommands } from '../constants';
import { GitProvider, GitUri } from '../gitProvider';
import { GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
export class ShowBlameHistoryCommand extends EditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.ShowBlameHistory);
}

+ 2
- 2
src/commands/showFileHistory.ts Ver arquivo

@ -2,12 +2,12 @@
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './commands';
import { BuiltInCommands } from '../constants';
import { GitProvider, GitUri } from '../gitProvider';
import { GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
export class ShowFileHistoryCommand extends EditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.ShowFileHistory);
}

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

@ -1,13 +1,13 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitCommit, GitLogCommit, GitProvider, GitUri, IGitLog } from '../gitProvider';
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, CommitDetailsQuickPick, CommitWithFileStatusQuickPickItem } from '../quickPicks';
export class ShowQuickCommitDetailsCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.ShowQuickCommitDetails);
}

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

@ -1,14 +1,14 @@
'use strict';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitCommit, GitLogCommit, GitProvider, GitUri, IGitLog } from '../gitProvider';
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, CommitFileDetailsQuickPick } from '../quickPicks';
import * as path from 'path';
export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.ShowQuickCommitFileDetails);
}

+ 2
- 2
src/commands/showQuickFileHistory.ts Ver arquivo

@ -1,14 +1,14 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from '../commands';
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
import { GitService, GitUri, IGitLog } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, FileHistoryQuickPick } from '../quickPicks';
import * as path from 'path';
export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.ShowQuickFileHistory);
}

+ 2
- 2
src/commands/showQuickRepoHistory.ts Ver arquivo

@ -1,13 +1,13 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from '../commands';
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
import { GitService, GitUri, IGitLog } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, RepoHistoryQuickPick } from '../quickPicks';
export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.ShowQuickRepoHistory);
}

+ 2
- 2
src/commands/showQuickRepoStatus.ts Ver arquivo

@ -1,13 +1,13 @@
'use strict';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './commands';
import { GitProvider } from '../gitProvider';
import { GitService } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, RepoStatusQuickPick } from '../quickPicks';
export class ShowQuickRepoStatusCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, private repoPath: string) {
constructor(private git: GitService, private repoPath: string) {
super(Commands.ShowQuickRepoStatus);
}

+ 2
- 2
src/commands/toggleCodeLens.ts Ver arquivo

@ -1,11 +1,11 @@
'use strict';
import { TextEditor, TextEditorEdit } from 'vscode';
import { Commands, EditorCommand } from './commands';
import { GitProvider } from '../gitProvider';
import { GitService } from '../gitService';
export class ToggleCodeLensCommand extends EditorCommand {
constructor(private git: GitProvider) {
constructor(private git: GitService) {
super(Commands.ToggleCodeLens);
}

+ 2
- 2
src/extension.ts Ver arquivo

@ -16,7 +16,7 @@ import { Keyboard } from './commands';
import { IAdvancedConfig, IBlameConfig } from './configuration';
import { WorkspaceState } from './constants';
import { GitContentProvider } from './gitContentProvider';
import { Git, GitProvider } from './gitProvider';
import { Git, GitService } from './gitService';
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
import { Logger } from './logger';
@ -70,7 +70,7 @@ export async function activate(context: ExtensionContext) {
context.workspaceState.update(WorkspaceState.RepoPath, repoPath);
const git = new GitProvider(context);
const git = new GitService(context);
context.subscriptions.push(git);
const blameabilityTracker = new BlameabilityTracker(git);

+ 3
- 3
src/git/gitUri.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { Uri } from 'vscode';
import { DocumentSchemes } from '../constants';
import { Git, GitProvider } from '../gitProvider';
import { Git, GitService } from '../gitService';
import * as path from 'path';
export class GitUri extends Uri {
@ -26,7 +26,7 @@ export class GitUri extends Uri {
this.offset = 0;
if (uri.scheme === DocumentSchemes.GitLensGit) {
const data = GitProvider.fromGitContentUri(uri);
const data = GitService.fromGitContentUri(uri);
base._fsPath = path.resolve(data.repoPath, data.originalFileName || data.fileName);
this.offset = (data.decoration && data.decoration.split('\n').length) || 0;
@ -69,7 +69,7 @@ export class GitUri extends Uri {
: `${path.basename(this.fsPath)}${separator}${directory}`;
}
static async fromUri(uri: Uri, git: GitProvider) {
static async fromUri(uri: Uri, git: GitService) {
if (uri instanceof GitUri) return uri;
const gitUri = git.getGitUriForFile(uri.fsPath);

+ 2
- 2
src/gitCodeLensProvider.ts Ver arquivo

@ -4,7 +4,7 @@ import { CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelect
import { Commands } from './commands';
import { BuiltInCommands, DocumentSchemes } from './constants';
import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration';
import { GitCommit, GitProvider, GitUri, IGitBlame, IGitBlameLines } from './gitProvider';
import { GitCommit, GitService, GitUri, IGitBlame, IGitBlameLines } from './gitService';
import { Logger } from './logger';
import * as moment from 'moment';
@ -42,7 +42,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
private _config: IConfig;
private _documentIsDirty: boolean;
constructor(context: ExtensionContext, private git: GitProvider) {
constructor(context: ExtensionContext, private git: GitService) {
this._config = workspace.getConfiguration('').get<IConfig>('gitlens');
}

+ 3
- 3
src/gitContentProvider.ts Ver arquivo

@ -1,7 +1,7 @@
'use strict';
import { ExtensionContext, TextDocumentContentProvider, Uri, window } from 'vscode';
import { DocumentSchemes } from './constants';
import { GitProvider } from './gitProvider';
import { GitService } from './gitService';
import { Logger } from './logger';
import * as path from 'path';
@ -9,10 +9,10 @@ export class GitContentProvider implements TextDocumentContentProvider {
static scheme = DocumentSchemes.GitLensGit;
constructor(context: ExtensionContext, private git: GitProvider) { }
constructor(context: ExtensionContext, private git: GitService) { }
async provideTextDocumentContent(uri: Uri): Promise<string> {
const data = GitProvider.fromGitContentUri(uri);
const data = GitService.fromGitContentUri(uri);
const fileName = data.originalFileName || data.fileName;
try {
let text = await this.git.getVersionedFileText(fileName, data.repoPath, data.sha) as string;

+ 5
- 5
src/gitRevisionCodeLensProvider.ts Ver arquivo

@ -3,18 +3,18 @@ import { Iterables } from './system';
import { CancellationToken, CodeLens, CodeLensProvider, DocumentSelector, ExtensionContext, Range, TextDocument, Uri } from 'vscode';
import { Commands } from './commands';
import { DocumentSchemes } from './constants';
import { GitCommit, GitProvider, GitUri } from './gitProvider';
import { GitCommit, GitService, GitUri } from './gitService';
export class GitDiffWithWorkingCodeLens extends CodeLens {
constructor(git: GitProvider, public fileName: string, public commit: GitCommit, range: Range) {
constructor(git: GitService, public fileName: string, public commit: GitCommit, range: Range) {
super(range);
}
}
export class GitDiffWithPreviousCodeLens extends CodeLens {
constructor(git: GitProvider, public fileName: string, public commit: GitCommit, range: Range) {
constructor(git: GitService, public fileName: string, public commit: GitCommit, range: Range) {
super(range);
}
}
@ -23,10 +23,10 @@ export class GitRevisionCodeLensProvider implements CodeLensProvider {
static selector: DocumentSelector = { scheme: DocumentSchemes.GitLensGit };
constructor(context: ExtensionContext, private git: GitProvider) { }
constructor(context: ExtensionContext, private git: GitService) { }
async provideCodeLenses(document: TextDocument, token: CancellationToken): Promise<CodeLens[]> {
const data = GitProvider.fromGitContentUri(document.uri);
const data = GitService.fromGitContentUri(document.uri);
const gitUri = new GitUri(Uri.file(data.fileName), data);
const lenses: CodeLens[] = [];

src/gitProvider.ts → src/gitService.ts Ver arquivo

@ -46,7 +46,7 @@ enum RemoveCacheReason {
DocumentSaved
}
export class GitProvider extends Disposable {
export class GitService extends Disposable {
private _onDidChangeGitCacheEmitter = new EventEmitter<void>();
get onDidChangeGitCache(): Event<void> {
@ -335,11 +335,11 @@ export class GitProvider extends Disposable {
if (cacheKey) {
this._onDidBlameFailEmitter.fire(cacheKey);
}
return GitProvider.EmptyPromise as Promise<IGitBlame>;
return GitService.EmptyPromise as Promise<IGitBlame>;
}
return Git.blame(GitProvider.BlameFormat, fileName, sha, repoPath)
.then(data => new GitBlameParserEnricher(GitProvider.BlameFormat).enrich(data, fileName))
return Git.blame(GitService.BlameFormat, fileName, sha, repoPath)
.then(data => new GitBlameParserEnricher(GitService.BlameFormat).enrich(data, fileName))
.catch(ex => {
// Trap and cache expected blame errors
if (useCaching) {
@ -348,13 +348,13 @@ export class GitProvider extends Disposable {
entry.blame = {
//date: new Date(),
item: GitProvider.EmptyPromise,
item: GitService.EmptyPromise,
errorMessage: msg
} as ICachedBlame;
this._onDidBlameFailEmitter.fire(cacheKey);
this._gitCache.set(cacheKey, entry);
return GitProvider.EmptyPromise as Promise<IGitBlame>;
return GitService.EmptyPromise as Promise<IGitBlame>;
}
return undefined;
});
@ -393,8 +393,8 @@ export class GitProvider extends Disposable {
fileName = Git.normalizePath(fileName);
try {
const data = await Git.blameLines(GitProvider.BlameFormat, fileName, line + 1, line + 1, sha, repoPath);
const blame = new GitBlameParserEnricher(GitProvider.BlameFormat).enrich(data, fileName);
const data = await Git.blameLines(GitService.BlameFormat, fileName, line + 1, line + 1, sha, repoPath);
const blame = new GitBlameParserEnricher(GitService.BlameFormat).enrich(data, fileName);
if (!blame) return undefined;
const commit = Iterables.first(blame.commits.values());
@ -480,7 +480,7 @@ export class GitProvider extends Disposable {
if (c.isUncommitted) return;
const decoration = `\u2937 ${c.author}, ${moment(c.date).format('MMMM Do, YYYY h:MMa')}`;
const uri = GitProvider.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration);
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration);
locations.push(new Location(uri, new Position(0, 0)));
if (c.sha === selectedSha) {
locations.push(new Location(uri, new Position(line + 1, 0)));
@ -527,7 +527,7 @@ export class GitProvider extends Disposable {
const promise = this._gitignore.then(ignore => {
if (ignore && !ignore.filter([fileName]).length) {
Logger.log(`Skipping log; '${fileName}' is gitignored`);
return GitProvider.EmptyPromise as Promise<IGitLog>;
return GitService.EmptyPromise as Promise<IGitLog>;
}
return (range
@ -542,12 +542,12 @@ export class GitProvider extends Disposable {
entry.log = {
//date: new Date(),
item: GitProvider.EmptyPromise,
item: GitService.EmptyPromise,
errorMessage: msg
} as ICachedLog;
this._gitCache.set(cacheKey, entry);
return GitProvider.EmptyPromise as Promise<IGitLog>;
return GitService.EmptyPromise as Promise<IGitLog>;
}
return undefined;
});
@ -580,7 +580,7 @@ export class GitProvider extends Disposable {
if (c.isUncommitted) return;
const decoration = `\u2937 ${c.author}, ${moment(c.date).format('MMMM Do, YYYY h:MMa')}`;
const uri = GitProvider.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration);
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration);
locations.push(new Location(uri, new Position(0, 0)));
if (c.sha === selectedSha) {
locations.push(new Location(uri, new Position(line + 1, 0)));
@ -658,7 +658,7 @@ export class GitProvider extends Disposable {
static fromGitContentUri(uri: Uri): IGitUriData {
if (uri.scheme !== DocumentSchemes.GitLensGit) throw new Error(`fromGitUri(uri=${uri}) invalid scheme`);
return GitProvider._fromGitContentUri<IGitUriData>(uri);
return GitService._fromGitContentUri<IGitUriData>(uri);
}
private static _fromGitContentUri<T extends IGitUriData>(uri: Uri): T {
@ -670,7 +670,7 @@ export class GitProvider extends Disposable {
static toGitContentUri(shaOrcommit: string | GitCommit, fileName?: string, repoPath?: string, originalFileName?: string): Uri {
let data: IGitUriData;
if (typeof shaOrcommit === 'string') {
data = GitProvider._toGitUriData({
data = GitService._toGitUriData({
sha: shaOrcommit,
fileName: fileName,
repoPath: repoPath,
@ -678,7 +678,7 @@ export class GitProvider extends Disposable {
});
}
else {
data = GitProvider._toGitUriData(shaOrcommit, undefined, shaOrcommit.originalFileName);
data = GitService._toGitUriData(shaOrcommit, undefined, shaOrcommit.originalFileName);
fileName = shaOrcommit.fileName;
}
@ -687,7 +687,7 @@ export class GitProvider extends Disposable {
}
static toReferenceGitContentUri(commit: GitCommit, index: number, commitCount: number, originalFileName?: string, decoration?: string): Uri {
return GitProvider._toReferenceGitContentUri(commit, DocumentSchemes.GitLensGit, commitCount, GitProvider._toGitUriData(commit, index, originalFileName, decoration));
return GitService._toReferenceGitContentUri(commit, DocumentSchemes.GitLensGit, commitCount, GitService._toGitUriData(commit, index, originalFileName, decoration));
}
private static _toReferenceGitContentUri(commit: GitCommit, scheme: DocumentSchemes, commitCount: number, data: IGitUriData) {

+ 3
- 3
src/quickPicks/commitDetails.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { GitLogCommit, GitProvider, IGitLog } from '../gitProvider';
import { GitLogCommit, GitService, IGitLog } from '../gitService';
import { CommitWithFileStatusQuickPickItem } from './gitQuickPicks';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './quickPicks';
import * as moment from 'moment';
@ -12,7 +12,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
constructor(commit: GitLogCommit, item?: QuickPickItem) {
const repoPath = commit.repoPath;
const uris = commit.fileStatuses.map(_ => GitProvider.toGitContentUri(commit.sha, _.fileName, repoPath, commit.originalFileName));
const uris = commit.fileStatuses.map(_ => GitService.toGitContentUri(commit.sha, _.fileName, repoPath, commit.originalFileName));
super(uris, item || {
label: `$(file-symlink-file) Open Changed Files`,
description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.shortSha}`
@ -36,7 +36,7 @@ export class OpenCommitWorkingTreeFilesCommandQuickPickItem extends OpenFilesCom
export class CommitDetailsQuickPick {
static async show(git: GitProvider, commit: GitLogCommit, uri: Uri, goBackCommand?: CommandQuickPickItem, repoLog?: IGitLog): Promise<CommitWithFileStatusQuickPickItem | CommandQuickPickItem | undefined> {
static async show(git: GitService, commit: GitLogCommit, uri: Uri, goBackCommand?: CommandQuickPickItem, repoLog?: IGitLog): Promise<CommitWithFileStatusQuickPickItem | CommandQuickPickItem | undefined> {
const items: (CommitWithFileStatusQuickPickItem | CommandQuickPickItem)[] = commit.fileStatuses.map(fs => new CommitWithFileStatusQuickPickItem(commit, fs.fileName, fs.status));
let index = 0;

+ 3
- 3
src/quickPicks/commitFileDetails.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { GitCommit, GitLogCommit, GitProvider, GitUri, IGitLog } from '../gitProvider';
import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitService';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './quickPicks';
import * as moment from 'moment';
import * as path from 'path';
@ -10,7 +10,7 @@ import * as path from 'path';
export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {
constructor(commit: GitCommit, item?: QuickPickItem) {
const uri = GitProvider.toGitContentUri(commit);
const uri = GitService.toGitContentUri(commit);
super(uri, item || {
label: `$(file-symlink-file) Open File`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${commit.shortSha}`
@ -31,7 +31,7 @@ export class OpenCommitWorkingTreeFileCommandQuickPickItem extends OpenFileComma
export class CommitFileDetailsQuickPick {
static async show(git: GitProvider, commit: GitLogCommit, workingFileName: string, uri: Uri, goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}, fileLog?: IGitLog): Promise<CommandQuickPickItem | undefined> {
static async show(git: GitService, commit: GitLogCommit, workingFileName: string, uri: Uri, goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}, fileLog?: IGitLog): Promise<CommandQuickPickItem | undefined> {
const items: CommandQuickPickItem[] = [];
const workingName = (workingFileName && path.basename(workingFileName)) || path.basename(commit.fileName);

+ 1
- 1
src/quickPicks/fileHistory.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { GitUri, IGitLog } from '../gitProvider';
import { GitUri, IGitLog } from '../gitService';
import { CommitQuickPickItem } from './gitQuickPicks';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';
import * as path from 'path';

+ 2
- 2
src/quickPicks/gitQuickPicks.ts Ver arquivo

@ -1,6 +1,6 @@
'use strict';
import { QuickPickItem, Uri } from 'vscode';
import { getGitStatusIcon, GitCommit, GitFileStatus, GitProvider, GitUri } from '../gitProvider';
import { getGitStatusIcon, GitCommit, GitFileStatus, GitService, GitUri } from '../gitService';
import { OpenFileCommandQuickPickItem } from './quickPicks';
import * as moment from 'moment';
import * as path from 'path';
@ -34,7 +34,7 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
directory = undefined;
}
super(GitProvider.toGitContentUri(commit.sha, fileName, commit.repoPath, commit.originalFileName), {
super(GitService.toGitContentUri(commit.sha, fileName, commit.repoPath, commit.originalFileName), {
label: `\u00a0\u00a0\u00a0\u00a0${icon}\u00a0\u00a0 ${path.basename(fileName)}`,
description: directory
});

+ 1
- 1
src/quickPicks/repoHistory.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
import { GitUri, IGitLog } from '../gitProvider';
import { GitUri, IGitLog } from '../gitService';
import { CommitQuickPickItem } from './gitQuickPicks';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';

+ 1
- 1
src/quickPicks/repoStatus.ts Ver arquivo

@ -2,7 +2,7 @@
import { Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard } from '../commands';
import { getGitStatusIcon, GitFileStatusItem } from '../gitProvider';
import { getGitStatusIcon, GitFileStatusItem } from '../gitService';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem } from './quickPicks';
import * as path from 'path';

Carregando…
Cancelar
Salvar