diff --git a/src/blameActiveLineController.ts b/src/blameActiveLineController.ts index 7af6e36..18297c4 100644 --- a/src/blameActiveLineController.ts +++ b/src/blameActiveLineController.ts @@ -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); diff --git a/src/blameAnnotationController.ts b/src/blameAnnotationController.ts index d12696c..f779f6d 100644 --- a/src/blameAnnotationController.ts +++ b/src/blameAnnotationController.ts @@ -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(); diff --git a/src/blameAnnotationFormatter.ts b/src/blameAnnotationFormatter.ts index 973d1f0..5b440e0 100644 --- a/src/blameAnnotationFormatter.ts +++ b/src/blameAnnotationFormatter.ts @@ -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; diff --git a/src/blameAnnotationProvider.ts b/src/blameAnnotationProvider.ts index 70ac41f..85cdbea 100644 --- a/src/blameAnnotationProvider.ts +++ b/src/blameAnnotationProvider.ts @@ -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; diff --git a/src/blameabilityTracker.ts b/src/blameabilityTracker.ts index 230312f..500daf4 100644 --- a/src/blameabilityTracker.ts +++ b/src/blameabilityTracker.ts @@ -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[] = []; diff --git a/src/commands/closeUnchangedFiles.ts b/src/commands/closeUnchangedFiles.ts index aaa08ee..8c64b30 100644 --- a/src/commands/closeUnchangedFiles.ts +++ b/src/commands/closeUnchangedFiles.ts @@ -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); } diff --git a/src/commands/copyMessageToClipboard.ts b/src/commands/copyMessageToClipboard.ts index 8728298..d412302 100644 --- a/src/commands/copyMessageToClipboard.ts +++ b/src/commands/copyMessageToClipboard.ts @@ -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); } diff --git a/src/commands/copyShaToClipboard.ts b/src/commands/copyShaToClipboard.ts index 75327de..417cce1 100644 --- a/src/commands/copyShaToClipboard.ts +++ b/src/commands/copyShaToClipboard.ts @@ -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); } diff --git a/src/commands/diffDirectory.ts b/src/commands/diffDirectory.ts index 1cb093f..10ff4ac 100644 --- a/src/commands/diffDirectory.ts +++ b/src/commands/diffDirectory.ts @@ -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); } diff --git a/src/commands/diffLineWithPrevious.ts b/src/commands/diffLineWithPrevious.ts index f866552..8415e67 100644 --- a/src/commands/diffLineWithPrevious.ts +++ b/src/commands/diffLineWithPrevious.ts @@ -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; diff --git a/src/commands/diffLineWithWorking.ts b/src/commands/diffLineWithWorking.ts index 4b522b8..d7387e1 100644 --- a/src/commands/diffLineWithWorking.ts +++ b/src/commands/diffLineWithWorking.ts @@ -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; diff --git a/src/commands/diffWithNext.ts b/src/commands/diffWithNext.ts index 49f10dd..4506b72 100644 --- a/src/commands/diffWithNext.ts +++ b/src/commands/diffWithNext.ts @@ -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); } diff --git a/src/commands/diffWithPrevious.ts b/src/commands/diffWithPrevious.ts index 802255c..4ca6bbe 100644 --- a/src/commands/diffWithPrevious.ts +++ b/src/commands/diffWithPrevious.ts @@ -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); } diff --git a/src/commands/diffWithWorking.ts b/src/commands/diffWithWorking.ts index c371cb2..7b6c6c5 100644 --- a/src/commands/diffWithWorking.ts +++ b/src/commands/diffWithWorking.ts @@ -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 { diff --git a/src/commands/openChangedFiles.ts b/src/commands/openChangedFiles.ts index b42defd..126bb28 100644 --- a/src/commands/openChangedFiles.ts +++ b/src/commands/openChangedFiles.ts @@ -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); } diff --git a/src/commands/showBlameHistory.ts b/src/commands/showBlameHistory.ts index d9efbac..93a9ba3 100644 --- a/src/commands/showBlameHistory.ts +++ b/src/commands/showBlameHistory.ts @@ -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); } diff --git a/src/commands/showFileHistory.ts b/src/commands/showFileHistory.ts index 585ea00..38fb35a 100644 --- a/src/commands/showFileHistory.ts +++ b/src/commands/showFileHistory.ts @@ -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); } diff --git a/src/commands/showQuickCommitDetails.ts b/src/commands/showQuickCommitDetails.ts index 87d3b26..47e0407 100644 --- a/src/commands/showQuickCommitDetails.ts +++ b/src/commands/showQuickCommitDetails.ts @@ -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); } diff --git a/src/commands/showQuickCommitFileDetails.ts b/src/commands/showQuickCommitFileDetails.ts index b7a186f..0678857 100644 --- a/src/commands/showQuickCommitFileDetails.ts +++ b/src/commands/showQuickCommitFileDetails.ts @@ -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); } diff --git a/src/commands/showQuickFileHistory.ts b/src/commands/showQuickFileHistory.ts index f1f24a0..9a39d6a 100644 --- a/src/commands/showQuickFileHistory.ts +++ b/src/commands/showQuickFileHistory.ts @@ -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); } diff --git a/src/commands/showQuickRepoHistory.ts b/src/commands/showQuickRepoHistory.ts index ba7ce5c..f89d21d 100644 --- a/src/commands/showQuickRepoHistory.ts +++ b/src/commands/showQuickRepoHistory.ts @@ -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); } diff --git a/src/commands/showQuickRepoStatus.ts b/src/commands/showQuickRepoStatus.ts index 3c3d0b1..c561ee2 100644 --- a/src/commands/showQuickRepoStatus.ts +++ b/src/commands/showQuickRepoStatus.ts @@ -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); } diff --git a/src/commands/toggleCodeLens.ts b/src/commands/toggleCodeLens.ts index 4026062..6e36344 100644 --- a/src/commands/toggleCodeLens.ts +++ b/src/commands/toggleCodeLens.ts @@ -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); } diff --git a/src/extension.ts b/src/extension.ts index 5ec9a66..df3b620 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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); diff --git a/src/git/gitUri.ts b/src/git/gitUri.ts index bb07d8b..6e5d000 100644 --- a/src/git/gitUri.ts +++ b/src/git/gitUri.ts @@ -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); diff --git a/src/gitCodeLensProvider.ts b/src/gitCodeLensProvider.ts index a720d35..be294f5 100644 --- a/src/gitCodeLensProvider.ts +++ b/src/gitCodeLensProvider.ts @@ -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('gitlens'); } diff --git a/src/gitContentProvider.ts b/src/gitContentProvider.ts index 55c6cc6..8a7eb24 100644 --- a/src/gitContentProvider.ts +++ b/src/gitContentProvider.ts @@ -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 { - 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; diff --git a/src/gitRevisionCodeLensProvider.ts b/src/gitRevisionCodeLensProvider.ts index 7671f8c..b92cdc8 100644 --- a/src/gitRevisionCodeLensProvider.ts +++ b/src/gitRevisionCodeLensProvider.ts @@ -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 { - const data = GitProvider.fromGitContentUri(document.uri); + const data = GitService.fromGitContentUri(document.uri); const gitUri = new GitUri(Uri.file(data.fileName), data); const lenses: CodeLens[] = []; diff --git a/src/gitProvider.ts b/src/gitService.ts similarity index 94% rename from src/gitProvider.ts rename to src/gitService.ts index cde0e63..cd2fd02 100644 --- a/src/gitProvider.ts +++ b/src/gitService.ts @@ -46,7 +46,7 @@ enum RemoveCacheReason { DocumentSaved } -export class GitProvider extends Disposable { +export class GitService extends Disposable { private _onDidChangeGitCacheEmitter = new EventEmitter(); get onDidChangeGitCache(): Event { @@ -335,11 +335,11 @@ export class GitProvider extends Disposable { if (cacheKey) { this._onDidBlameFailEmitter.fire(cacheKey); } - return GitProvider.EmptyPromise as Promise; + return GitService.EmptyPromise as Promise; } - 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; + return GitService.EmptyPromise as Promise; } 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; + return GitService.EmptyPromise as Promise; } 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; + return GitService.EmptyPromise as Promise; } 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(uri); + return GitService._fromGitContentUri(uri); } private static _fromGitContentUri(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) { diff --git a/src/quickPicks/commitDetails.ts b/src/quickPicks/commitDetails.ts index 852403e..019a511 100644 --- a/src/quickPicks/commitDetails.ts +++ b/src/quickPicks/commitDetails.ts @@ -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 { + static async show(git: GitService, commit: GitLogCommit, uri: Uri, goBackCommand?: CommandQuickPickItem, repoLog?: IGitLog): Promise { const items: (CommitWithFileStatusQuickPickItem | CommandQuickPickItem)[] = commit.fileStatuses.map(fs => new CommitWithFileStatusQuickPickItem(commit, fs.fileName, fs.status)); let index = 0; diff --git a/src/quickPicks/commitFileDetails.ts b/src/quickPicks/commitFileDetails.ts index 0219cda..54d2d06 100644 --- a/src/quickPicks/commitFileDetails.ts +++ b/src/quickPicks/commitFileDetails.ts @@ -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 { + static async show(git: GitService, commit: GitLogCommit, workingFileName: string, uri: Uri, goBackCommand?: CommandQuickPickItem, currentCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}, fileLog?: IGitLog): Promise { const items: CommandQuickPickItem[] = []; const workingName = (workingFileName && path.basename(workingFileName)) || path.basename(commit.fileName); diff --git a/src/quickPicks/fileHistory.ts b/src/quickPicks/fileHistory.ts index dfc770d..956a3b4 100644 --- a/src/quickPicks/fileHistory.ts +++ b/src/quickPicks/fileHistory.ts @@ -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'; diff --git a/src/quickPicks/gitQuickPicks.ts b/src/quickPicks/gitQuickPicks.ts index 521b843..40936f0 100644 --- a/src/quickPicks/gitQuickPicks.ts +++ b/src/quickPicks/gitQuickPicks.ts @@ -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 }); diff --git a/src/quickPicks/repoHistory.ts b/src/quickPicks/repoHistory.ts index d4a936d..78b7a1a 100644 --- a/src/quickPicks/repoHistory.ts +++ b/src/quickPicks/repoHistory.ts @@ -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'; diff --git a/src/quickPicks/repoStatus.ts b/src/quickPicks/repoStatus.ts index a7d8820..a8d8d91 100644 --- a/src/quickPicks/repoStatus.ts +++ b/src/quickPicks/repoStatus.ts @@ -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';