Просмотр исходного кода

Closes #66 - Removes peek explorers

Converts type/const into string enums
Refactors command initialization
main
Eric Amodio 7 лет назад
Родитель
Сommit
1d3845b0c9
39 измененных файлов: 387 добавлений и 796 удалений
  1. +3
    -9
      README.md
  2. +3
    -27
      package.json
  3. +5
    -6
      src/annotations/annotationController.ts
  4. +1
    -1
      src/annotations/annotations.ts
  5. +4
    -7
      src/annotations/blameAnnotationProvider.ts
  6. +1
    -2
      src/annotations/gutterBlameAnnotationProvider.ts
  7. +1
    -2
      src/annotations/hoverBlameAnnotationProvider.ts
  8. +59
    -3
      src/commands.ts
  9. +43
    -89
      src/commands/common.ts
  10. +1
    -2
      src/commands/copyMessageToClipboard.ts
  11. +1
    -2
      src/commands/copyShaToClipboard.ts
  12. +2
    -2
      src/commands/diffLineWithPrevious.ts
  13. +3
    -3
      src/commands/diffLineWithWorking.ts
  14. +1
    -2
      src/commands/openCommitInRemote.ts
  15. +5
    -5
      src/commands/openInRemote.ts
  16. +0
    -47
      src/commands/showBlameHistory.ts
  17. +1
    -2
      src/commands/showCommitSearch.ts
  18. +0
    -51
      src/commands/showFileHistory.ts
  19. +1
    -1
      src/commands/showQuickCommitDetails.ts
  20. +1
    -1
      src/commands/showQuickCommitFileDetails.ts
  21. +41
    -77
      src/configuration.ts
  22. +62
    -112
      src/constants.ts
  23. +6
    -15
      src/currentLineController.ts
  24. +3
    -59
      src/extension.ts
  25. +21
    -23
      src/git/gitUri.ts
  26. +2
    -2
      src/git/models/blameCommit.ts
  27. +6
    -1
      src/git/models/commit.ts
  28. +4
    -1
      src/git/models/remote.ts
  29. +2
    -1
      src/git/models/stashCommit.ts
  30. +27
    -19
      src/git/remotes/provider.ts
  31. +16
    -71
      src/gitCodeLensProvider.ts
  32. +4
    -7
      src/gitContentProvider.ts
  33. +25
    -99
      src/gitService.ts
  34. +5
    -6
      src/logger.ts
  35. +10
    -18
      src/messages.ts
  36. +7
    -7
      src/quickPicks/remotes.ts
  37. +5
    -9
      src/views/gitExplorer.ts
  38. +3
    -3
      src/views/remoteNode.ts
  39. +2
    -2
      src/views/statusFilesNode.ts

+ 3
- 9
README.md Просмотреть файл

@ -255,12 +255,6 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Adds a `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`) with a shortcut of `alt+-` to quickly get back to where you were when the last GitLens quick pick menu closed
- Adds a `Open File History Explorer` command (`gitlens.showFileHistory`) to show a **file history explorer** (peek style) to visualize the history of a file
- Likely to be deprecated in a future release, add your voice to [#66](https://github.com/eamodio/vscode-gitlens/issues/66) if you feel it should not be removed
- Adds a `Open Blame History Explorer` command (`gitlens.showBlameHistory`) to show a **blame history explorer** (peek style) to visualize the blame history of a file or code block
- Likely to be deprecated in a future release, add your voice to [#66](https://github.com/eamodio/vscode-gitlens/issues/66) if you feel it should not be removed
### And More
- Adds a `Copy Commit ID to Clipboard` command (`gitlens.copyShaToClipboard`) to copy the commit id (sha) of the active line to the clipboard or from the most recent commit to the current branch, if there is no active editor
@ -343,9 +337,9 @@ GitLens is highly customizable and provides many configuration settings to allow
|-----|------------
|`gitlens.codeLens.enabled`|Specifies whether or not to provide any Git code lens, by default<br />Use the `gitlens.toggleCodeLens` command to toggle the Git code lens on and off for the current session
|`gitlens.codeLens.recentChange.enabled`|Specifies whether or not to show a `recent change` code lens showing the author and date of the most recent commit for the file or code block
|`gitlens.codeLens.recentChange.command`|Specifies the command to be executed when the `recent change` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.recentChange.command`|Specifies the command to be executed when the `recent change` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.authors.enabled`|Specifies whether or not to show an `authors` code lens showing number of authors of the file or code block and the most prominent author (if there is more than one)
|`gitlens.codeLens.authors.command`|Specifies the command to be executed when the `authors` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.authors.command`|Specifies the command to be executed when the `authors` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.locations`|Specifies where Git code lens will be shown in the document<br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, properties, etc) lines<br />`custom` - adds code lens at the start of symbols contained in `gitlens.codeLens.locationCustomSymbols`
|`gitlens.codeLens.customLocationSymbols`|Specifies the set of document symbols where Git code lens will be shown in the document
|`gitlens.codeLens.perLanguageLocations`|Specifies where Git code lens will be shown in the document for the specified languages
@ -379,7 +373,7 @@ GitLens is highly customizable and provides many configuration settings to allow
|-----|------------
|`gitlens.statusBar.enabled`|Specifies whether or not to provide blame information on the status bar
|`gitlens.statusBar.alignment`|Specifies the blame alignment in the status bar<br />`left` - align to the left, `right` - align to the right
|`gitlens.statusBar.command`|Specifies the command to be executed when the blame status bar item is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.showBlameHistory` - opens the blame history explorer<br />`gitlens.showFileHistory` - opens the file history explorer<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.statusBar.command`|Specifies the command to be executed when the blame status bar item is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.statusBar.format`|Specifies the format of the blame information on the status bar<br />Available tokens<br />`${id}` - commit id<br />`${author}` - commit author<br />`${message}` - commit message<br />`${ago}` - relative commit date (e.g. 1 day ago)<br />`${date}` - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|`gitlens.statusBar.dateFormat`|Specifies the date format of absolute dates shown in the blame information on the status bar<br />See https://momentjs.com/docs/#/displaying/format/ for valid formats

+ 3
- 27
package.json Просмотреть файл

@ -255,15 +255,13 @@
"default": "gitlens.showQuickCommitFileDetails",
"enum": [
"gitlens.toggleFileBlame",
"gitlens.showBlameHistory",
"gitlens.showFileHistory",
"gitlens.diffWithPrevious",
"gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory",
"gitlens.showQuickRepoHistory"
],
"description": "Specifies the command to be executed when the `recent change` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
"description": "Specifies the command to be executed when the `recent change` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
},
"gitlens.codeLens.authors.enabled": {
"type": "boolean",
@ -275,15 +273,13 @@
"default": "gitlens.toggleFileBlame",
"enum": [
"gitlens.toggleFileBlame",
"gitlens.showBlameHistory",
"gitlens.showFileHistory",
"gitlens.diffWithPrevious",
"gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory",
"gitlens.showQuickRepoHistory"
],
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
},
"gitlens.codeLens.locations": {
"type": "array",
@ -589,8 +585,6 @@
"default": "gitlens.showQuickCommitDetails",
"enum": [
"gitlens.toggleFileBlame",
"gitlens.showBlameHistory",
"gitlens.showFileHistory",
"gitlens.diffWithPrevious",
"gitlens.diffWithWorking",
"gitlens.toggleCodeLens",
@ -599,7 +593,7 @@
"gitlens.showQuickFileHistory",
"gitlens.showQuickRepoHistory"
],
"description": "Specifies the command to be executed when the blame status bar item is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.showBlameHistory` - opens the blame history explorer\n `gitlens.showFileHistory` - opens the file history explorer\n `gitlens.diffWithPrevious` - compares the current line commit with the previous\n `gitlens.diffWithWorking` - compares the current line commit with the working tree\n `gitlens.toggleCodeLens` - toggles Git code lens\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
"description": "Specifies the command to be executed when the blame status bar item is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current line commit with the previous\n `gitlens.diffWithWorking` - compares the current line commit with the working tree\n `gitlens.toggleCodeLens` - toggles Git code lens\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick"
},
"gitlens.statusBar.format": {
"type": "string",
@ -1004,11 +998,6 @@
"category": "GitLens"
},
{
"command": "gitlens.showBlameHistory",
"title": "Open Blame History Explorer",
"category": "GitLens"
},
{
"command": "gitlens.showCommitSearch",
"title": "Search Commits",
"category": "GitLens",
@ -1018,11 +1007,6 @@
}
},
{
"command": "gitlens.showFileHistory",
"title": "Open File History Explorer",
"category": "GitLens"
},
{
"command": "gitlens.showLastQuickPick",
"title": "Show Last Opened Quick Pick",
"category": "GitLens"
@ -1285,14 +1269,6 @@
"when": "gitlens:isTracked && gitlens:canToggleCodeLens"
},
{
"command": "gitlens.showBlameHistory",
"when": "gitlens:isBlameable"
},
{
"command": "gitlens.showFileHistory",
"when": "gitlens:isTracked"
},
{
"command": "gitlens.showLastQuickPick",
"when": "gitlens:enabled"
},

+ 5
- 6
src/annotations/annotationController.ts Просмотреть файл

@ -14,12 +14,11 @@ import { RecentChangesAnnotationProvider } from './recentChangesAnnotationProvid
import { WhitespaceController } from './whitespaceController';
import * as path from 'path';
export type FileAnnotationType = 'gutter' | 'hover' | 'recentChanges';
export const FileAnnotationType = {
Gutter: 'gutter' as FileAnnotationType,
Hover: 'hover' as FileAnnotationType,
RecentChanges: 'recentChanges' as FileAnnotationType
};
export enum FileAnnotationType {
Gutter = 'gutter',
Hover = 'hover',
RecentChanges = 'recentChanges'
}
export const Decorations = {
blameAnnotation: window.createTextEditorDecorationType({

+ 1
- 1
src/annotations/annotations.ts Просмотреть файл

@ -121,7 +121,7 @@ export class Annotations {
}
static async changesHover(commit: GitCommit, line: number, uri: GitUri, git: GitService): Promise<DecorationOptions> {
const chunkLine = await git.getDiffForLine(uri, line + uri.offset, commit.isUncommitted ? undefined : commit.previousSha);
const chunkLine = await git.getDiffForLine(uri, line, commit.isUncommitted ? undefined : commit.previousSha);
const message = this.getHoverDiffMessage(commit, chunkLine);
return {

+ 4
- 7
src/annotations/blameAnnotationProvider.ts Просмотреть файл

@ -30,16 +30,13 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
if (!blame || !blame.lines.length) return;
}
const offset = this.uri.offset;
let sha: string | undefined = undefined;
if (typeof shaOrLine === 'string') {
sha = shaOrLine;
}
else if (typeof shaOrLine === 'number') {
const line = shaOrLine - offset;
if (line >= 0) {
const commitLine = blame.lines[line];
if (shaOrLine >= 0) {
const commitLine = blame.lines[shaOrLine];
sha = commitLine && commitLine.sha;
}
}
@ -54,7 +51,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
const highlightDecorationRanges = blame.lines
.filter(l => l.sha === sha)
.map(l => this.editor.document.validateRange(new Range(l.line + offset, 0, l.line + offset, 1000000)));
.map(l => this.editor.document.validateRange(new Range(l.line, 0, l.line, 1000000)));
this.editor.setDecorations(this.highlightDecoration, highlightDecorationRanges);
}
@ -101,7 +98,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
const blame = await this.getBlame(true);
if (blame === undefined) return undefined;
const line = blame.lines[position.line - this.uri.offset];
const line = blame.lines[position.line];
const commit = blame.commits.get(line.sha);
if (commit === undefined) return undefined;

+ 1
- 2
src/annotations/gutterBlameAnnotationProvider.ts Просмотреть файл

@ -33,7 +33,6 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
};
const now = Date.now();
const offset = this.uri.offset;
const renderOptions = Annotations.gutterRenderOptions(this._config.theme, cfg.heatmap, options);
const separateLines = this._config.theme.annotations.file.gutter.separateLines;
@ -46,7 +45,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
let previousSha: string | undefined;
for (const l of blame.lines) {
const line = l.line + offset;
const line = l.line;
if (previousSha === l.sha) {
// Use a shallow copy of the previous decoration options

+ 1
- 2
src/annotations/hoverBlameAnnotationProvider.ts Просмотреть файл

@ -20,7 +20,6 @@ export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
const start = process.hrtime();
const now = Date.now();
const offset = this.uri.offset;
const renderOptions = Annotations.hoverRenderOptions(this._config.theme, cfg.heatmap);
const decorations: DecorationOptions[] = [];
@ -30,7 +29,7 @@ export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
let hover: DecorationOptions | undefined;
for (const l of blame.lines) {
const line = l.line + offset;
const line = l.line;
hover = decorationsMap[l.sha];

+ 59
- 3
src/commands.ts Просмотреть файл

@ -1,4 +1,10 @@
'use strict';
import { ExtensionContext } from 'vscode';
import { AnnotationController } from './annotations/annotationController';
import { CurrentLineController } from './currentLineController';
import { CodeLensController } from './codeLensController';
import { GitService } from './gitService';
export * from './commands/common';
export * from './commands/clearFileAnnotations';
@ -24,10 +30,8 @@ export * from './commands/openFileRevision';
export * from './commands/openInRemote';
export * from './commands/openRepoInRemote';
export * from './commands/resetSuppressedWarnings';
export * from './commands/showBlameHistory';
export * from './commands/showCommitSearch';
export * from './commands/showFileBlame';
export * from './commands/showFileHistory';
export * from './commands/showLastQuickPick';
export * from './commands/showLineBlame';
export * from './commands/showQuickBranchHistory';
@ -43,4 +47,56 @@ export * from './commands/stashSave';
export * from './commands/toggleCodeLens';
export * from './commands/toggleFileBlame';
export * from './commands/toggleFileRecentChanges';
export * from './commands/toggleLineBlame';
export * from './commands/toggleLineBlame';
import * as Commands from './commands';
export function configureCommands(
context: ExtensionContext,
git: GitService,
annotationController: AnnotationController,
currentLineController: CurrentLineController,
codeLensController: CodeLensController
): void {
context.subscriptions.push(new Commands.CloseUnchangedFilesCommand(git));
context.subscriptions.push(new Commands.OpenChangedFilesCommand(git));
context.subscriptions.push(new Commands.ExternalDiffCommand(git));
context.subscriptions.push(new Commands.CopyMessageToClipboardCommand(git));
context.subscriptions.push(new Commands.CopyShaToClipboardCommand(git));
context.subscriptions.push(new Commands.DiffDirectoryCommand(git));
context.subscriptions.push(new Commands.DiffLineWithPreviousCommand(git));
context.subscriptions.push(new Commands.DiffLineWithWorkingCommand(git));
context.subscriptions.push(new Commands.DiffWithCommand(git));
context.subscriptions.push(new Commands.DiffWithBranchCommand(git));
context.subscriptions.push(new Commands.DiffWithNextCommand(git));
context.subscriptions.push(new Commands.DiffWithPreviousCommand(git));
context.subscriptions.push(new Commands.DiffWithRevisionCommand(git));
context.subscriptions.push(new Commands.DiffWithWorkingCommand(git));
context.subscriptions.push(new Commands.OpenBranchesInRemoteCommand(git));
context.subscriptions.push(new Commands.OpenBranchInRemoteCommand(git));
context.subscriptions.push(new Commands.OpenCommitInRemoteCommand(git));
context.subscriptions.push(new Commands.OpenFileInRemoteCommand(git));
context.subscriptions.push(new Commands.OpenFileRevisionCommand(annotationController));
context.subscriptions.push(new Commands.OpenInRemoteCommand());
context.subscriptions.push(new Commands.OpenRepoInRemoteCommand(git));
context.subscriptions.push(new Commands.ClearFileAnnotationsCommand(annotationController));
context.subscriptions.push(new Commands.ShowFileBlameCommand(annotationController));
context.subscriptions.push(new Commands.ShowLineBlameCommand(currentLineController));
context.subscriptions.push(new Commands.ToggleFileBlameCommand(annotationController));
context.subscriptions.push(new Commands.ToggleFileRecentChangesCommand(annotationController));
context.subscriptions.push(new Commands.ToggleLineBlameCommand(currentLineController));
context.subscriptions.push(new Commands.ResetSuppressedWarningsCommand(context));
context.subscriptions.push(new Commands.ShowLastQuickPickCommand());
context.subscriptions.push(new Commands.ShowQuickBranchHistoryCommand(git));
context.subscriptions.push(new Commands.ShowQuickCurrentBranchHistoryCommand(git));
context.subscriptions.push(new Commands.ShowQuickCommitDetailsCommand(git));
context.subscriptions.push(new Commands.ShowQuickCommitFileDetailsCommand(git));
context.subscriptions.push(new Commands.ShowCommitSearchCommand(git));
context.subscriptions.push(new Commands.ShowQuickFileHistoryCommand(git));
context.subscriptions.push(new Commands.ShowQuickRepoStatusCommand(git));
context.subscriptions.push(new Commands.ShowQuickStashListCommand(git));
context.subscriptions.push(new Commands.StashApplyCommand(git));
context.subscriptions.push(new Commands.StashDeleteCommand(git));
context.subscriptions.push(new Commands.StashSaveCommand(git));
context.subscriptions.push(new Commands.ToggleCodeLensCommand(codeLensController));
}

+ 43
- 89
src/commands/common.ts Просмотреть файл

@ -5,95 +5,49 @@ import { GitBranch, GitCommit, GitRemote } from '../gitService';
import { Logger } from '../logger';
import { Telemetry } from '../telemetry';
export type Commands =
'gitlens.clearFileAnnotations' |
'gitlens.closeUnchangedFiles' |
'gitlens.copyMessageToClipboard' |
'gitlens.copyShaToClipboard' |
'gitlens.diffDirectory' |
'gitlens.diffWith' |
'gitlens.diffWithBranch' |
'gitlens.diffWithNext' |
'gitlens.diffWithPrevious' |
'gitlens.diffLineWithPrevious' |
'gitlens.diffWithRevision' |
'gitlens.diffWithWorking' |
'gitlens.diffLineWithWorking' |
'gitlens.externalDiff' |
'gitlens.openChangedFiles' |
'gitlens.openBranchesInRemote' |
'gitlens.openBranchInRemote' |
'gitlens.openCommitInRemote' |
'gitlens.openFileInRemote' |
'gitlens.openFileRevision' |
'gitlens.openInRemote' |
'gitlens.openRepoInRemote' |
'gitlens.resetSuppressedWarnings' |
'gitlens.showBlameHistory' |
'gitlens.showCommitSearch' |
'gitlens.showFileBlame' |
'gitlens.showFileHistory' |
'gitlens.showLastQuickPick' |
'gitlens.showLineBlame' |
'gitlens.showQuickBranchHistory' |
'gitlens.showQuickCommitDetails' |
'gitlens.showQuickCommitFileDetails' |
'gitlens.showQuickFileHistory' |
'gitlens.showQuickRepoHistory' |
'gitlens.showQuickRepoStatus' |
'gitlens.showQuickStashList' |
'gitlens.stashApply' |
'gitlens.stashDelete' |
'gitlens.stashSave' |
'gitlens.toggleCodeLens' |
'gitlens.toggleFileBlame' |
'gitlens.toggleFileRecentChanges' |
'gitlens.toggleLineBlame';
export const Commands = {
ClearFileAnnotations: 'gitlens.clearFileAnnotations' as Commands,
CloseUnchangedFiles: 'gitlens.closeUnchangedFiles' as Commands,
CopyMessageToClipboard: 'gitlens.copyMessageToClipboard' as Commands,
CopyShaToClipboard: 'gitlens.copyShaToClipboard' as Commands,
DiffDirectory: 'gitlens.diffDirectory' as Commands,
DiffWith: 'gitlens.diffWith' as Commands,
DiffWithBranch: 'gitlens.diffWithBranch' as Commands,
DiffWithNext: 'gitlens.diffWithNext' as Commands,
DiffWithPrevious: 'gitlens.diffWithPrevious' as Commands,
DiffLineWithPrevious: 'gitlens.diffLineWithPrevious' as Commands,
DiffWithRevision: 'gitlens.diffWithRevision' as Commands,
DiffWithWorking: 'gitlens.diffWithWorking' as Commands,
DiffLineWithWorking: 'gitlens.diffLineWithWorking' as Commands,
ExternalDiff: 'gitlens.externalDiff' as Commands,
OpenChangedFiles: 'gitlens.openChangedFiles' as Commands,
OpenBranchesInRemote: 'gitlens.openBranchesInRemote' as Commands,
OpenBranchInRemote: 'gitlens.openBranchInRemote' as Commands,
OpenCommitInRemote: 'gitlens.openCommitInRemote' as Commands,
OpenFileInRemote: 'gitlens.openFileInRemote' as Commands,
OpenFileRevision: 'gitlens.openFileRevision' as Commands,
OpenInRemote: 'gitlens.openInRemote' as Commands,
OpenRepoInRemote: 'gitlens.openRepoInRemote' as Commands,
ResetSuppressedWarnings: 'gitlens.resetSuppressedWarnings' as Commands,
ShowBlameHistory: 'gitlens.showBlameHistory' as Commands,
ShowCommitSearch: 'gitlens.showCommitSearch' as Commands,
ShowFileBlame: 'gitlens.showFileBlame' as Commands,
ShowFileHistory: 'gitlens.showFileHistory' as Commands,
ShowLastQuickPick: 'gitlens.showLastQuickPick' as Commands,
ShowLineBlame: 'gitlens.showLineBlame' as Commands,
ShowQuickCommitDetails: 'gitlens.showQuickCommitDetails' as Commands,
ShowQuickCommitFileDetails: 'gitlens.showQuickCommitFileDetails' as Commands,
ShowQuickFileHistory: 'gitlens.showQuickFileHistory' as Commands,
ShowQuickBranchHistory: 'gitlens.showQuickBranchHistory' as Commands,
ShowQuickCurrentBranchHistory: 'gitlens.showQuickRepoHistory' as Commands,
ShowQuickRepoStatus: 'gitlens.showQuickRepoStatus' as Commands,
ShowQuickStashList: 'gitlens.showQuickStashList' as Commands,
StashApply: 'gitlens.stashApply' as Commands,
StashDelete: 'gitlens.stashDelete' as Commands,
StashSave: 'gitlens.stashSave' as Commands,
ToggleCodeLens: 'gitlens.toggleCodeLens' as Commands,
ToggleFileBlame: 'gitlens.toggleFileBlame' as Commands,
ToggleFileRecentChanges: 'gitlens.toggleFileRecentChanges' as Commands,
ToggleLineBlame: 'gitlens.toggleLineBlame' as Commands
};
export enum Commands {
ClearFileAnnotations = 'gitlens.clearFileAnnotations',
CloseUnchangedFiles = 'gitlens.closeUnchangedFiles',
CopyMessageToClipboard = 'gitlens.copyMessageToClipboard',
CopyShaToClipboard = 'gitlens.copyShaToClipboard',
DiffDirectory = 'gitlens.diffDirectory',
DiffWith = 'gitlens.diffWith',
DiffWithBranch = 'gitlens.diffWithBranch',
DiffWithNext = 'gitlens.diffWithNext',
DiffWithPrevious = 'gitlens.diffWithPrevious',
DiffLineWithPrevious = 'gitlens.diffLineWithPrevious',
DiffWithRevision = 'gitlens.diffWithRevision',
DiffWithWorking = 'gitlens.diffWithWorking',
DiffLineWithWorking = 'gitlens.diffLineWithWorking',
ExternalDiff = 'gitlens.externalDiff',
OpenChangedFiles = 'gitlens.openChangedFiles',
OpenBranchesInRemote = 'gitlens.openBranchesInRemote',
OpenBranchInRemote = 'gitlens.openBranchInRemote',
OpenCommitInRemote = 'gitlens.openCommitInRemote',
OpenFileInRemote = 'gitlens.openFileInRemote',
OpenFileRevision = 'gitlens.openFileRevision',
OpenInRemote = 'gitlens.openInRemote',
OpenRepoInRemote = 'gitlens.openRepoInRemote',
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings',
ShowCommitSearch = 'gitlens.showCommitSearch',
ShowFileBlame = 'gitlens.showFileBlame',
ShowLastQuickPick = 'gitlens.showLastQuickPick',
ShowLineBlame = 'gitlens.showLineBlame',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ShowQuickBranchHistory = 'gitlens.showQuickBranchHistory',
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus',
ShowQuickStashList = 'gitlens.showQuickStashList',
StashApply = 'gitlens.stashApply',
StashDelete = 'gitlens.stashDelete',
StashSave = 'gitlens.stashSave',
ToggleCodeLens = 'gitlens.toggleCodeLens',
ToggleFileBlame = 'gitlens.toggleFileBlame',
ToggleFileRecentChanges = 'gitlens.toggleFileRecentChanges',
ToggleLineBlame = 'gitlens.toggleLineBlame'
}
export function getCommandUri(uri?: Uri, editor?: TextEditor): Uri | undefined {
if (uri instanceof Uri) return uri;

+ 1
- 2
src/commands/copyMessageToClipboard.ts Просмотреть файл

@ -51,8 +51,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
if (args.sha === undefined) {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
const line = (editor && editor.selection.active.line) || gitUri.offset;
const blameline = line - gitUri.offset;
const blameline = (editor && editor.selection.active.line) || 0;
if (blameline < 0) return undefined;
try {

+ 1
- 2
src/commands/copyShaToClipboard.ts Просмотреть файл

@ -49,8 +49,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
if (args.sha === undefined) {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
const line = (editor && editor.selection.active.line) || gitUri.offset;
const blameline = line - gitUri.offset;
const blameline = (editor && editor.selection.active.line) || 0;
if (blameline < 0) return undefined;
try {

+ 2
- 2
src/commands/diffLineWithPrevious.ts Просмотреть файл

@ -27,13 +27,13 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
args = { ...args };
if (args.line === undefined) {
args.line = editor === undefined ? gitUri.offset : editor.selection.active.line;
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
if (args.commit === undefined || GitService.isUncommitted(args.commit.sha)) {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
const blameline = args.line - gitUri.offset;
const blameline = args.line;
if (blameline < 0) return undefined;
try {

+ 3
- 3
src/commands/diffLineWithWorking.ts Просмотреть файл

@ -27,13 +27,13 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
args = { ...args };
if (args.line === undefined) {
args.line = editor === undefined ? gitUri.offset : editor.selection.active.line;
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
if (args.commit === undefined || GitService.isUncommitted(args.commit.sha)) {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
const blameline = args.line - gitUri.offset;
const blameline = args.line;
if (blameline < 0) return undefined;
try {
@ -44,7 +44,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
// If the line is uncommitted, find the previous commit
if (args.commit.isUncommitted) {
args.commit = new GitCommit(args.commit.type, args.commit.repoPath, args.commit.previousSha!, args.commit.previousFileName!, args.commit.author, args.commit.date, args.commit.message);
args.line = blame.line.line + 1 + gitUri.offset;
args.line = blame.line.line + 1;
}
}
catch (ex) {

+ 1
- 2
src/commands/openCommitInRemote.ts Просмотреть файл

@ -45,8 +45,7 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
try {
if (args.sha === undefined) {
const line = editor === undefined ? gitUri.offset : editor.selection.active.line;
const blameline = line - gitUri.offset;
const blameline = editor === undefined ? 0 : editor.selection.active.line;
if (blameline < 0) return undefined;
const blame = await this.git.getBlameForLine(gitUri, blameline);

+ 5
- 5
src/commands/openInRemote.ts Просмотреть файл

@ -3,7 +3,7 @@ import { Strings } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
import { GlyphChars } from '../constants';
import { GitLogCommit, GitRemote, GitService, RemoteResource } from '../gitService';
import { GitLogCommit, GitRemote, GitService, RemoteResource, RemoteResourceType } from '../gitService';
import { Logger } from '../logger';
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickPicks';
@ -44,21 +44,21 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
let placeHolder = '';
switch (args.resource.type) {
case 'branch':
case RemoteResourceType.Branch:
this.ensureRemoteBranchName(args);
placeHolder = `open ${args.resource.branch} branch in${GlyphChars.Ellipsis}`;
break;
case 'commit':
case RemoteResourceType.Commit:
const shortSha = GitService.shortenSha(args.resource.sha);
placeHolder = `open commit ${shortSha} in${GlyphChars.Ellipsis}`;
break;
case 'file':
case RemoteResourceType.File:
placeHolder = `open ${args.resource.fileName} in${GlyphChars.Ellipsis}`;
break;
case 'revision':
case RemoteResourceType.Revision:
if (args.resource.commit !== undefined && args.resource.commit instanceof GitLogCommit) {
if (args.resource.commit.status === 'D') {
args.resource.sha = args.resource.commit.previousSha;

+ 0
- 47
src/commands/showBlameHistory.ts Просмотреть файл

@ -1,47 +0,0 @@
'use strict';
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand, getCommandUri } from './common';
import { BuiltInCommands } from '../constants';
import { GitService, GitUri } from '../gitService';
import { Messages } from '../messages';
import { Logger } from '../logger';
export interface ShowBlameHistoryCommandArgs {
line?: number;
position?: Position;
range?: Range;
sha?: string;
}
export class ShowBlameHistoryCommand extends EditorCommand {
constructor(private git: GitService) {
super(Commands.ShowBlameHistory);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ShowBlameHistoryCommandArgs = {}) {
uri = getCommandUri(uri, editor);
if (uri === undefined) return undefined;
if (args.range == null || args.position == null) {
args = { ...args };
// If the command is executed manually -- treat it as a click on the root lens (i.e. show blame for the whole file)
args.range = editor.document.validateRange(new Range(0, 0, 1000000, 1000000));
args.position = editor.document.validateRange(new Range(0, 0, 0, 1000000)).start;
}
const gitUri = await GitUri.fromUri(uri, this.git);
try {
const locations = await this.git.getBlameLocations(gitUri, args.range, args.sha, args.line);
if (locations === undefined) return Messages.showFileNotUnderSourceControlWarningMessage('Unable to show blame history');
return commands.executeCommand(BuiltInCommands.ShowReferences, uri, args.position, locations);
}
catch (ex) {
Logger.error(ex, 'ShowBlameHistoryCommand', 'getBlameLocations');
return window.showErrorMessage(`Unable to show blame history. See output channel for more details`);
}
}
}

+ 1
- 2
src/commands/showCommitSearch.ts Просмотреть файл

@ -42,8 +42,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
try {
if (!args.search) {
if (editor !== undefined && gitUri !== undefined) {
const line = editor.selection.active.line - gitUri.offset;
const blameLine = await this.git.getBlameForLine(gitUri, line);
const blameLine = await this.git.getBlameForLine(gitUri, editor.selection.active.line);
if (blameLine !== undefined) {
args.search = `#${blameLine.commit.shortSha}`;
}

+ 0
- 51
src/commands/showFileHistory.ts Просмотреть файл

@ -1,51 +0,0 @@
'use strict';
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand, getCommandUri } from './common';
import { BuiltInCommands } from '../constants';
// import { GitExplorer } from '../views/gitExplorer';
import { GitService, GitUri } from '../gitService';
import { Messages } from '../messages';
import { Logger } from '../logger';
export interface ShowFileHistoryCommandArgs {
line?: number;
position?: Position;
sha?: string;
}
export class ShowFileHistoryCommand extends EditorCommand {
constructor(private git: GitService) {
super(Commands.ShowFileHistory);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ShowFileHistoryCommandArgs = {}) {
uri = getCommandUri(uri, editor);
if (uri === undefined) return undefined;
if (args.position == null) {
args = { ...args };
// If the command is executed manually -- treat it as a click on the root lens (i.e. show blame for the whole file)
args.position = editor.document.validateRange(new Range(0, 0, 0, 1000000)).start;
}
const gitUri = await GitUri.fromUri(uri, this.git);
try {
// if (this.explorer !== undefined) {
// this.explorer.addHistory(gitUri);
// return undefined;
// }
const locations = await this.git.getLogLocations(gitUri, args.sha, args.line);
if (locations === undefined) return Messages.showFileNotUnderSourceControlWarningMessage('Unable to show file history');
return commands.executeCommand(BuiltInCommands.ShowReferences, uri, args.position, locations);
}
catch (ex) {
Logger.error(ex, 'ShowFileHistoryCommand', 'getLogLocations');
return window.showErrorMessage(`Unable to show file history. See output channel for more details`);
}
}
}

+ 1
- 1
src/commands/showQuickCommitDetails.ts Просмотреть файл

@ -58,7 +58,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
if (args.sha === undefined) {
if (editor === undefined) return undefined;
const blameline = editor.selection.active.line - gitUri.offset;
const blameline = editor.selection.active.line;
if (blameline < 0) return undefined;
try {

+ 1
- 1
src/commands/showQuickCommitFileDetails.ts Просмотреть файл

@ -57,7 +57,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
if (args.sha === undefined) {
if (editor === undefined) return undefined;
const blameline = editor.selection.active.line - gitUri.offset;
const blameline = editor.selection.active.line;
if (blameline < 0) return undefined;
try {

+ 41
- 77
src/configuration.ts Просмотреть файл

@ -1,93 +1,57 @@
'use strict';
import { FileAnnotationType } from './annotations/annotationController';
import { Commands } from './commands';
import { LineAnnotationType } from './currentLineController';
import { GitExplorerView } from './views/gitExplorer';
import { OutputLevel } from './logger';
export { ExtensionKey } from './constants';
export type CodeLensCommand =
'gitlens.toggleFileBlame' |
'gitlens.showBlameHistory' |
'gitlens.showFileHistory' |
'gitlens.diffWithPrevious' |
'gitlens.showQuickCommitDetails' |
'gitlens.showQuickCommitFileDetails' |
'gitlens.showQuickFileHistory' |
'gitlens.showQuickRepoHistory';
export const CodeLensCommand = {
BlameAnnotate: Commands.ToggleFileBlame as CodeLensCommand,
ShowBlameHistory: Commands.ShowBlameHistory as CodeLensCommand,
ShowFileHistory: Commands.ShowFileHistory as CodeLensCommand,
DiffWithPrevious: Commands.DiffWithPrevious as CodeLensCommand,
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as CodeLensCommand,
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as CodeLensCommand,
ShowQuickFileHistory: Commands.ShowQuickFileHistory as CodeLensCommand,
ShowQuickCurrentBranchHistory: Commands.ShowQuickCurrentBranchHistory as CodeLensCommand
};
export enum CodeLensCommand {
DiffWithPrevious = 'gitlens.diffWithPrevious',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ToggleFileBlame = 'gitlens.toggleFileBlame'
}
export type CodeLensLocations = 'document' | 'containers' | 'blocks' | 'custom';
export const CodeLensLocations = {
Document: 'document' as CodeLensLocations,
Containers: 'containers' as CodeLensLocations,
Blocks: 'blocks' as CodeLensLocations,
Custom: 'custom' as CodeLensLocations
};
export enum CodeLensLocations {
Document = 'document',
Containers = 'containers',
Blocks = 'blocks',
Custom = 'custom'
}
export type LineHighlightLocations = 'gutter' | 'line' | 'overviewRuler';
export const LineHighlightLocations = {
Gutter: 'gutter' as LineHighlightLocations,
Line: 'line' as LineHighlightLocations,
OverviewRuler: 'overviewRuler' as LineHighlightLocations
};
export enum LineHighlightLocations {
Gutter = 'gutter',
Line = 'line',
OverviewRuler = 'overviewRuler'
}
export type CustomRemoteType =
'Bitbucket' |
'Custom' |
'GitHub' |
'GitLab';
export const CustomRemoteType = {
Bitbucket: 'Bitbucket' as CustomRemoteType,
BitbucketServer: 'BitbucketServer' as CustomRemoteType,
Custom: 'Custom' as CustomRemoteType,
GitHub: 'GitHub' as CustomRemoteType,
GitLab: 'GitLab' as CustomRemoteType
};
export enum CustomRemoteType {
Bitbucket = 'Bitbucket',
BitbucketServer = 'BitbucketServer',
Custom = 'Custom',
GitHub = 'GitHub',
GitLab = 'GitLab'
}
export type GitExplorerFilesLayout =
'auto' |
'list' |
'tree';
export const GitExplorerFilesLayout = {
Auto: 'auto' as GitExplorerFilesLayout,
List: 'list' as GitExplorerFilesLayout,
Tree: 'tree' as GitExplorerFilesLayout
};
export enum GitExplorerFilesLayout {
Auto = 'auto',
List = 'list',
Tree = 'tree'
}
export type StatusBarCommand =
'gitlens.toggleFileBlame' |
'gitlens.showBlameHistory' |
'gitlens.showFileHistory' |
'gitlens.toggleCodeLens' |
'gitlens.diffWithPrevious' |
'gitlens.diffWithWorking' |
'gitlens.showQuickCommitDetails' |
'gitlens.showQuickCommitFileDetails' |
'gitlens.showQuickFileHistory' |
'gitlens.showQuickRepoHistory';
export const StatusBarCommand = {
BlameAnnotate: Commands.ToggleFileBlame as StatusBarCommand,
ShowBlameHistory: Commands.ShowBlameHistory as StatusBarCommand,
ShowFileHistory: Commands.ShowFileHistory as CodeLensCommand,
DiffWithPrevious: Commands.DiffWithPrevious as StatusBarCommand,
DiffWithWorking: Commands.DiffWithWorking as StatusBarCommand,
ToggleCodeLens: Commands.ToggleCodeLens as StatusBarCommand,
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as StatusBarCommand,
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as StatusBarCommand,
ShowQuickFileHistory: Commands.ShowQuickFileHistory as StatusBarCommand,
ShowQuickCurrentBranchHistory: Commands.ShowQuickCurrentBranchHistory as StatusBarCommand
};
export enum StatusBarCommand {
DiffWithPrevious = 'gitlens.diffWithPrevious',
DiffWithWorking = 'gitlens.diffWithWorking',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ToggleCodeLens = 'gitlens.toggleCodeLens',
ToggleFileBlame = 'gitlens.toggleFileBlame'
}
export interface IAdvancedConfig {
caching: {

+ 62
- 112
src/constants.ts Просмотреть файл

@ -8,124 +8,74 @@ export const QualifiedExtensionId = `eamodio.${ExtensionId}`;
export const ApplicationInsightsKey = 'a9c302f8-6483-4d01-b92c-c159c799c679';
export type BuiltInCommands = 'cursorMove' |
'editor.action.showReferences' |
'editor.action.toggleRenderWhitespace' |
'editorScroll' |
'revealLine' |
'setContext' |
'vscode.diff' |
'vscode.executeDocumentSymbolProvider' |
'vscode.executeCodeLensProvider' |
'vscode.open' |
'vscode.previewHtml' |
'workbench.action.closeActiveEditor' |
'workbench.action.closeAllEditors' |
'workbench.action.nextEditor';
export const BuiltInCommands = {
CloseActiveEditor: 'workbench.action.closeActiveEditor' as BuiltInCommands,
CloseAllEditors: 'workbench.action.closeAllEditors' as BuiltInCommands,
CursorMove: 'cursorMove' as BuiltInCommands,
Diff: 'vscode.diff' as BuiltInCommands,
EditorScroll: 'editorScroll' as BuiltInCommands,
ExecuteDocumentSymbolProvider: 'vscode.executeDocumentSymbolProvider' as BuiltInCommands,
ExecuteCodeLensProvider: 'vscode.executeCodeLensProvider' as BuiltInCommands,
Open: 'vscode.open' as BuiltInCommands,
NextEditor: 'workbench.action.nextEditor' as BuiltInCommands,
PreviewHtml: 'vscode.previewHtml' as BuiltInCommands,
RevealLine: 'revealLine' as BuiltInCommands,
SetContext: 'setContext' as BuiltInCommands,
ShowReferences: 'editor.action.showReferences' as BuiltInCommands,
ToggleRenderWhitespace: 'editor.action.toggleRenderWhitespace' as BuiltInCommands
};
export enum BuiltInCommands {
CloseActiveEditor = 'workbench.action.closeActiveEditor',
CloseAllEditors = 'workbench.action.closeAllEditors',
CursorMove = 'cursorMove',
Diff = 'vscode.diff',
EditorScroll = 'editorScroll',
ExecuteDocumentSymbolProvider = 'vscode.executeDocumentSymbolProvider',
ExecuteCodeLensProvider = 'vscode.executeCodeLensProvider',
Open = 'vscode.open',
NextEditor = 'workbench.action.nextEditor',
PreviewHtml = 'vscode.previewHtml',
RevealLine = 'revealLine',
SetContext = 'setContext',
ShowReferences = 'editor.action.showReferences',
ToggleRenderWhitespace = 'editor.action.toggleRenderWhitespace'
}
export type CommandContext =
'gitlens:annotationStatus' |
'gitlens:canToggleCodeLens' |
'gitlens:enabled' |
'gitlens:hasRemotes' |
'gitlens:gitExplorer:view' |
'gitlens:isBlameable' |
'gitlens:isRepository' |
'gitlens:isTracked' |
'gitlens:key';
export const CommandContext = {
AnnotationStatus: 'gitlens:annotationStatus' as CommandContext,
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
Enabled: 'gitlens:enabled' as CommandContext,
GitExplorerView: 'gitlens:gitExplorer:view' as CommandContext,
HasRemotes: 'gitlens:hasRemotes' as CommandContext,
IsBlameable: 'gitlens:isBlameable' as CommandContext,
IsRepository: 'gitlens:isRepository' as CommandContext,
IsTracked: 'gitlens:isTracked' as CommandContext,
Key: 'gitlens:key' as CommandContext
};
export enum CommandContext {
AnnotationStatus = 'gitlens:annotationStatus',
CanToggleCodeLens = 'gitlens:canToggleCodeLens',
Enabled = 'gitlens:enabled',
GitExplorerView = 'gitlens:gitExplorer:view',
HasRemotes = 'gitlens:hasRemotes',
IsBlameable = 'gitlens:isBlameable',
IsRepository = 'gitlens:isRepository',
IsTracked = 'gitlens:isTracked',
Key = 'gitlens:key'
}
export function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
}
export type DocumentSchemes = 'file' | 'git' | 'gitlens-git';
export const DocumentSchemes = {
File: 'file' as DocumentSchemes,
Git: 'git' as DocumentSchemes,
GitLensGit: 'gitlens-git' as DocumentSchemes
};
export enum DocumentSchemes {
File = 'file',
Git = 'git',
GitLensGit = 'gitlens-git'
}
export type GlyphChars =
'\u21a9' |
'\u2193' |
'\u2937' |
'\u2190' |
'\u2194' |
'\u2192' |
'\u21e8' |
'\u2191' |
'\u2197' |
'\u2217' |
'\u2713' |
'\u2014' |
'\u2022' |
'\u226A' |
'\u22D8' |
'\u2026' |
'\u22EF' |
'\u270E' |
'\u00a0' |
'\u274F' |
'\u2750' |
'\u200b';
export const GlyphChars = {
ArrowBack: '\u21a9' as GlyphChars,
ArrowDown: '\u2193' as GlyphChars,
ArrowDropRight: '\u2937' as GlyphChars,
ArrowLeft: '\u2190' as GlyphChars,
ArrowLeftRight: '\u2194' as GlyphChars,
ArrowRight: '\u2192' as GlyphChars,
ArrowRightHollow: '\u21e8' as GlyphChars,
ArrowUp: '\u2191' as GlyphChars,
ArrowUpRight: '\u2197' as GlyphChars,
Asterisk: '\u2217' as GlyphChars,
Check: '\u2713' as GlyphChars,
Dash: '\u2014' as GlyphChars,
Dot: '\u2022' as GlyphChars,
DoubleArrowLeft: '\u226A' as GlyphChars,
DoubleArrowRight: '\u22D8' as GlyphChars,
Ellipsis: '\u2026' as GlyphChars,
MiddleEllipsis: '\u22EF' as GlyphChars,
Pensil: '\u270E' as GlyphChars,
Space: '\u00a0' as GlyphChars,
SquareWithBottomShadow: '\u274F' as GlyphChars,
SquareWithTopShadow: '\u2750' as GlyphChars,
ZeroWidthSpace: '\u200b' as GlyphChars
};
export enum GlyphChars {
ArrowBack = '\u21a9',
ArrowDown = '\u2193',
ArrowDropRight = '\u2937',
ArrowLeft = '\u2190',
ArrowLeftRight = '\u2194',
ArrowRight = '\u2192',
ArrowRightHollow = '\u21e8',
ArrowUp = '\u2191',
ArrowUpRight = '\u2197',
Asterisk = '\u2217',
Check = '\u2713',
Dash = '\u2014',
Dot = '\u2022',
DoubleArrowLeft = '\u226A',
DoubleArrowRight = '\u22D8',
Ellipsis = '\u2026',
MiddleEllipsis = '\u22EF',
Pensil = '\u270E',
Space = '\u00a0',
SquareWithBottomShadow = '\u274F',
SquareWithTopShadow = '\u2750',
ZeroWidthSpace = '\u200b'
}
export type GlobalState = 'gitlensVersion';
export const GlobalState = {
GitLensVersion: 'gitlensVersion' as GlobalState
};
export enum GlobalState {
GitLensVersion = 'gitlensVersion'
}
export type WorkspaceState = 'gitlens:gitExplorer:view';
export const WorkspaceState = {
GitExplorerView: 'gitlens:gitExplorer:view' as WorkspaceState
};
export enum WorkspaceState {
GitExplorerView = 'gitlens:gitExplorer:view'
}

+ 6
- 15
src/currentLineController.ts Просмотреть файл

@ -17,11 +17,10 @@ const annotationDecoration: TextEditorDecorationType = window.createTextEditorDe
}
} as DecorationRenderOptions);
export type LineAnnotationType = 'trailing' | 'hover';
export const LineAnnotationType = {
Trailing: 'trailing' as LineAnnotationType,
Hover: 'hover' as LineAnnotationType
};
export enum LineAnnotationType {
Trailing = 'trailing',
Hover = 'hover'
}
export class CurrentLineController extends Disposable {
@ -193,8 +192,6 @@ export class CurrentLineController extends Disposable {
}
private async _updateBlame(line: number, editor: TextEditor) {
line = line - this._uri.offset;
let commit: GitCommit | undefined = undefined;
let commitLine: GitCommitLine | undefined = undefined;
// Since blame information isn't valid when there are unsaved changes -- don't show any status
@ -290,7 +287,7 @@ export class CurrentLineController extends Disposable {
const state = this._blameLineAnnotationState !== undefined ? this._blameLineAnnotationState : cfg;
if (!state.enabled) return;
line = line === undefined ? blameLine.line + this._uri.offset : line;
line = line === undefined ? blameLine.line : line;
const decorationOptions: DecorationOptions[] = [];
@ -419,15 +416,9 @@ export class CurrentLineController extends Disposable {
} as ICommitFormatOptions)}`;
switch (cfg.command) {
case StatusBarCommand.BlameAnnotate:
case StatusBarCommand.ToggleFileBlame:
this._statusBarItem.tooltip = 'Toggle Blame Annotations';
break;
case StatusBarCommand.ShowBlameHistory:
this._statusBarItem.tooltip = 'Open Blame History Explorer';
break;
case StatusBarCommand.ShowFileHistory:
this._statusBarItem.tooltip = 'Open File History Explorer';
break;
case StatusBarCommand.DiffWithPrevious:
this._statusBarItem.command = Commands.DiffLineWithPrevious;
this._statusBarItem.tooltip = 'Compare Line Revision with Previous';

+ 3
- 59
src/extension.ts Просмотреть файл

@ -2,29 +2,15 @@
// import { Objects } from './system';
import { commands, ExtensionContext, extensions, languages, window, workspace } from 'vscode';
import { AnnotationController } from './annotations/annotationController';
import { CloseUnchangedFilesCommand, OpenChangedFilesCommand } from './commands';
import { ExternalDiffCommand } from './commands';
import { OpenBranchesInRemoteCommand, OpenBranchInRemoteCommand, OpenCommitInRemoteCommand, OpenFileInRemoteCommand, OpenFileRevisionCommand, OpenInRemoteCommand, OpenRepoInRemoteCommand } from './commands';
import { CopyMessageToClipboardCommand, CopyShaToClipboardCommand } from './commands';
import { DiffDirectoryCommand, DiffLineWithPreviousCommand, DiffLineWithWorkingCommand, DiffWithBranchCommand, DiffWithCommand, DiffWithNextCommand, DiffWithPreviousCommand, DiffWithRevisionCommand, DiffWithWorkingCommand } from './commands';
import { ResetSuppressedWarningsCommand } from './commands';
import { ClearFileAnnotationsCommand, ShowFileBlameCommand, ShowLineBlameCommand, ToggleFileBlameCommand, ToggleFileRecentChangesCommand, ToggleLineBlameCommand } from './commands';
import { ShowBlameHistoryCommand, ShowFileHistoryCommand } from './commands';
import { ShowLastQuickPickCommand } from './commands';
import { ShowQuickBranchHistoryCommand, ShowQuickCurrentBranchHistoryCommand, ShowQuickFileHistoryCommand } from './commands';
import { ShowCommitSearchCommand, ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand } from './commands';
import { ShowQuickRepoStatusCommand, ShowQuickStashListCommand } from './commands';
import { StashApplyCommand, StashDeleteCommand, StashSaveCommand } from './commands';
import { ToggleCodeLensCommand } from './commands';
import { CodeLensLocations, IConfig, LineHighlightLocations } from './configuration';
import { ApplicationInsightsKey, CommandContext, ExtensionKey, GlobalState, QualifiedExtensionId, setCommandContext } from './constants';
import { CodeLensController } from './codeLensController';
import { configureCommands } from './commands';
import { CurrentLineController, LineAnnotationType } from './currentLineController';
import { RemoteProviderFactory } from './git/remotes/factory';
import { GitContentProvider } from './gitContentProvider';
import { GitExplorer } from './views/gitExplorer';
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
import { GitContextTracker, GitService } from './gitService';
import { GitContextTracker, GitService, RemoteProviderFactory } from './gitService';
import { Keyboard } from './keyboard';
import { Logger } from './logger';
import { Messages, SuppressedKeys } from './messages';
@ -96,49 +82,7 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(window.registerTreeDataProvider('gitlens.gitExplorer', new GitExplorer(context, git)));
context.subscriptions.push(commands.registerTextEditorCommand('gitlens.computingFileAnnotations', () => { }));
context.subscriptions.push(new CloseUnchangedFilesCommand(git));
context.subscriptions.push(new ExternalDiffCommand(git));
context.subscriptions.push(new OpenChangedFilesCommand(git));
context.subscriptions.push(new CopyMessageToClipboardCommand(git));
context.subscriptions.push(new CopyShaToClipboardCommand(git));
context.subscriptions.push(new DiffDirectoryCommand(git));
context.subscriptions.push(new DiffLineWithPreviousCommand(git));
context.subscriptions.push(new DiffLineWithWorkingCommand(git));
context.subscriptions.push(new DiffWithCommand(git));
context.subscriptions.push(new DiffWithBranchCommand(git));
context.subscriptions.push(new DiffWithNextCommand(git));
context.subscriptions.push(new DiffWithPreviousCommand(git));
context.subscriptions.push(new DiffWithRevisionCommand(git));
context.subscriptions.push(new DiffWithWorkingCommand(git));
context.subscriptions.push(new OpenBranchesInRemoteCommand(git));
context.subscriptions.push(new OpenBranchInRemoteCommand(git));
context.subscriptions.push(new OpenCommitInRemoteCommand(git));
context.subscriptions.push(new OpenFileInRemoteCommand(git));
context.subscriptions.push(new OpenFileRevisionCommand(annotationController));
context.subscriptions.push(new OpenInRemoteCommand());
context.subscriptions.push(new OpenRepoInRemoteCommand(git));
context.subscriptions.push(new ClearFileAnnotationsCommand(annotationController));
context.subscriptions.push(new ShowFileBlameCommand(annotationController));
context.subscriptions.push(new ShowLineBlameCommand(currentLineController));
context.subscriptions.push(new ToggleFileBlameCommand(annotationController));
context.subscriptions.push(new ToggleFileRecentChangesCommand(annotationController));
context.subscriptions.push(new ToggleLineBlameCommand(currentLineController));
context.subscriptions.push(new ResetSuppressedWarningsCommand(context));
context.subscriptions.push(new ShowBlameHistoryCommand(git));
context.subscriptions.push(new ShowFileHistoryCommand(git));
context.subscriptions.push(new ShowLastQuickPickCommand());
context.subscriptions.push(new ShowQuickBranchHistoryCommand(git));
context.subscriptions.push(new ShowQuickCurrentBranchHistoryCommand(git));
context.subscriptions.push(new ShowQuickCommitDetailsCommand(git));
context.subscriptions.push(new ShowQuickCommitFileDetailsCommand(git));
context.subscriptions.push(new ShowCommitSearchCommand(git));
context.subscriptions.push(new ShowQuickFileHistoryCommand(git));
context.subscriptions.push(new ShowQuickRepoStatusCommand(git));
context.subscriptions.push(new ShowQuickStashListCommand(git));
context.subscriptions.push(new StashApplyCommand(git));
context.subscriptions.push(new StashDeleteCommand(git));
context.subscriptions.push(new StashSaveCommand(git));
context.subscriptions.push(new ToggleCodeLensCommand(codeLensController));
configureCommands(context, git, annotationController, currentLineController, codeLensController);
// Constantly over my data cap so stop collecting initialized event
// Telemetry.trackEvent('initialized', Objects.flatten(cfg, 'config', true));

+ 21
- 23
src/git/gitUri.ts Просмотреть файл

@ -12,7 +12,6 @@ interface UriEx {
export class GitUri extends (Uri as UriEx) {
offset: number;
repoPath?: string | undefined;
sha?: string | undefined;
@ -29,32 +28,33 @@ export class GitUri extends (Uri as UriEx) {
const data = GitService.fromGitContentUri(uri);
super(uri.scheme, uri.authority, path.resolve(data.repoPath, data.originalFileName || data.fileName), uri.query, uri.fragment);
this.offset = (data.decoration && data.decoration.split('\n').length) || 0;
if (!GitService.isUncommitted(data.sha)) {
this.sha = data.sha;
this.repoPath = data.repoPath;
}
return;
}
else if (commitOrRepoPath) {
if (typeof commitOrRepoPath === 'string') {
super(uri.scheme, uri.authority, uri.path, uri.query, uri.fragment);
this.offset = 0;
this.repoPath = commitOrRepoPath;
}
else {
const commit = commitOrRepoPath;
super(uri.scheme, uri.authority, path.resolve(commit.repoPath, commit.originalFileName || commit.fileName || ''), uri.query, uri.fragment);
this.offset = 0;
if (commit.repoPath !== undefined) {
this.repoPath = commit.repoPath;
}
if (commit.sha !== undefined && !GitService.isUncommitted(commit.sha)) {
this.sha = commit.sha;
}
}
if (!commitOrRepoPath) return;
if (typeof commitOrRepoPath === 'string') {
super(uri.scheme, uri.authority, uri.path, uri.query, uri.fragment);
this.repoPath = commitOrRepoPath;
return;
}
const commit = commitOrRepoPath;
super(uri.scheme, uri.authority, path.resolve(commit.repoPath, commit.originalFileName || commit.fileName || ''), uri.query, uri.fragment);
if (commit.repoPath !== undefined) {
this.repoPath = commit.repoPath;
}
if (commit.sha !== undefined && !GitService.isUncommitted(commit.sha)) {
this.sha = commit.sha;
}
}
@ -173,6 +173,4 @@ export interface IGitUriData {
fileName: string;
repoPath: string;
originalFileName?: string;
index?: number;
decoration?: string;
}

+ 2
- 2
src/git/models/blameCommit.ts Просмотреть файл

@ -1,5 +1,5 @@
'use strict';
import { GitCommit, GitCommitLine } from './commit';
import { GitCommit, GitCommitLine, GitCommitType } from './commit';
export class GitBlameCommit extends GitCommit {
@ -15,6 +15,6 @@ export class GitBlameCommit extends GitCommit {
previousSha?: string,
previousFileName?: string
) {
super('blame', repoPath, sha, fileName, author, date, message, originalFileName, previousSha, previousFileName);
super(GitCommitType.Blame, repoPath, sha, fileName, author, date, message, originalFileName, previousSha, previousFileName);
}
}

+ 6
- 1
src/git/models/commit.ts Просмотреть файл

@ -19,7 +19,12 @@ export interface GitCommitLine {
code?: string;
}
export type GitCommitType = 'blame' | 'branch' | 'file' | 'stash';
export enum GitCommitType {
Blame = 'blame',
Branch = 'branch',
File = 'file',
Stash = 'stash'
}
export class GitCommit {

+ 4
- 1
src/git/models/remote.ts Просмотреть файл

@ -1,7 +1,10 @@
'use strict';
import { RemoteProvider, RemoteProviderFactory } from '../remotes/factory';
export type GitRemoteType = 'fetch' | 'push';
export enum GitRemoteType {
Fetch = 'fetch',
Push = 'push'
}
export class GitRemote {

+ 2
- 1
src/git/models/stashCommit.ts Просмотреть файл

@ -1,4 +1,5 @@
'use strict';
import { GitCommitType } from './commit';
import { GitLogCommit } from './logCommit';
import { GitStatusFileStatus, IGitStatusFile } from './status';
@ -17,7 +18,7 @@ export class GitStashCommit extends GitLogCommit {
previousSha?: string,
previousFileName?: string
) {
super('stash', repoPath, sha, fileName, 'You', date, message, status, fileStatuses, originalFileName, previousSha, previousFileName);
super(GitCommitType.Stash, repoPath, sha, fileName, 'You', date, message, status, fileStatuses, originalFileName, previousSha, previousFileName);
}
get shortSha() {

+ 27
- 19
src/git/remotes/provider.ts Просмотреть файл

@ -3,23 +3,31 @@ import { commands, Range, Uri } from 'vscode';
import { BuiltInCommands } from '../../constants';
import { GitLogCommit } from '../../gitService';
export type RemoteResourceType = 'branch' | 'branches' | 'commit' | 'file' | 'repo' | 'revision';
export enum RemoteResourceType {
Branch = 'branch',
Branches = 'branches',
Commit = 'commit',
File = 'file',
Repo = 'repo',
Revision = 'revision'
}
export type RemoteResource =
{ type: 'branch', branch: string } |
{ type: 'branches' } |
{ type: 'commit', sha: string } |
{ type: 'file', branch?: string, fileName: string, range?: Range } |
{ type: 'repo' } |
{ type: 'revision', branch?: string, commit?: GitLogCommit, fileName: string, range?: Range, sha?: string };
{ type: RemoteResourceType.Branch, branch: string } |
{ type: RemoteResourceType.Branches } |
{ type: RemoteResourceType.Commit, sha: string } |
{ type: RemoteResourceType.File, branch?: string, fileName: string, range?: Range } |
{ type: RemoteResourceType.Repo } |
{ type: RemoteResourceType.Revision, branch?: string, commit?: GitLogCommit, fileName: string, range?: Range, sha?: string };
export function getNameFromRemoteResource(resource: RemoteResource) {
switch (resource.type) {
case 'branch': return 'Branch';
case 'branches': return 'Branches';
case 'commit': return 'Commit';
case 'file': return 'File';
case 'repo': return 'Repository';
case 'revision': return 'Revision';
case RemoteResourceType.Branch: return 'Branch';
case RemoteResourceType.Branches: return 'Branches';
case RemoteResourceType.Commit: return 'Commit';
case RemoteResourceType.File: return 'File';
case RemoteResourceType.Repo: return 'Repository';
case RemoteResourceType.Revision: return 'Revision';
default: return '';
}
}
@ -69,12 +77,12 @@ export abstract class RemoteProvider {
open(resource: RemoteResource): Promise<{} | undefined> {
switch (resource.type) {
case 'branch': return this.openBranch(resource.branch);
case 'branches': return this.openBranches();
case 'commit': return this.openCommit(resource.sha);
case 'file': return this.openFile(resource.fileName, resource.branch, undefined, resource.range);
case 'repo': return this.openRepo();
case 'revision': return this.openFile(resource.fileName, resource.branch, resource.sha, resource.range);
case RemoteResourceType.Branch: return this.openBranch(resource.branch);
case RemoteResourceType.Branches: return this.openBranches();
case RemoteResourceType.Commit: return this.openCommit(resource.sha);
case RemoteResourceType.File: return this.openFile(resource.fileName, resource.branch, undefined, resource.range);
case RemoteResourceType.Repo: return this.openRepo();
case RemoteResourceType.Revision: return this.openFile(resource.fileName, resource.branch, resource.sha, resource.range);
}
}

+ 16
- 71
src/gitCodeLensProvider.ts Просмотреть файл

@ -1,7 +1,7 @@
'use strict';
import { Functions, Iterables } from './system';
import { CancellationToken, CodeLens, CodeLensProvider, Command, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs, ShowBlameHistoryCommandArgs, ShowFileHistoryCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from './commands';
import { Commands, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from './commands';
import { BuiltInCommands, DocumentSchemes, ExtensionKey } from './constants';
import { CodeLensCommand, CodeLensLocations, ICodeLensLanguageLocation, IConfig } from './configuration';
import { GitBlame, GitBlameCommit, GitBlameLines, GitService, GitUri } from './gitService';
@ -259,14 +259,12 @@ export class GitCodeLensProvider implements CodeLensProvider {
}
switch (this._config.codeLens.recentChange.command) {
case CodeLensCommand.BlameAnnotate: return this._applyBlameAnnotateCommand<GitRecentChangeCodeLens>(title, lens, blame);
case CodeLensCommand.ShowBlameHistory: return this._applyShowBlameHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowFileHistory: return this._applyShowFileHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.DiffWithPrevious: return this._applyDiffWithPreviousCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickCommitDetails: return this._applyShowQuickCommitDetailsCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickCommitFileDetails: return this._applyShowQuickCommitFileDetailsCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickCurrentBranchHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickBranchHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ToggleFileBlame: return this._applyToggleFileBlameCommand<GitRecentChangeCodeLens>(title, lens, blame);
default: return lens;
}
}
@ -282,78 +280,16 @@ export class GitCodeLensProvider implements CodeLensProvider {
}
switch (this._config.codeLens.authors.command) {
case CodeLensCommand.BlameAnnotate: return this._applyBlameAnnotateCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowBlameHistory: return this._applyShowBlameHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowFileHistory: return this._applyShowFileHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.DiffWithPrevious: return this._applyDiffWithPreviousCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickCommitDetails: return this._applyShowQuickCommitDetailsCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickCommitFileDetails: return this._applyShowQuickCommitFileDetailsCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickCurrentBranchHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickBranchHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ToggleFileBlame: return this._applyToggleFileBlameCommand<GitAuthorsCodeLens>(title, lens, blame);
default: return lens;
}
}
_applyBlameAnnotateCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines): T {
lens.command = {
title: title,
command: Commands.ToggleFileBlame,
arguments: [Uri.file(lens.uri.fsPath)]
};
return lens;
}
_applyShowBlameHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
let line = lens.range.start.line;
if (commit) {
const blameLine = commit.lines.find(_ => _.line === line);
if (blameLine) {
line = blameLine.originalLine;
}
}
const position = lens.isFullRange ? new Position(1, 0) : lens.range.start;
lens.command = {
title: title,
command: Commands.ShowBlameHistory,
arguments: [
Uri.file(lens.uri.fsPath),
{
line,
position,
range: lens.blameRange,
sha: commit && commit.sha
} as ShowBlameHistoryCommandArgs
]
};
return lens;
}
_applyShowFileHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
let line = lens.range.start.line;
if (commit) {
const blameLine = commit.lines.find(_ => _.line === line);
if (blameLine) {
line = blameLine.originalLine;
}
}
const position = lens.isFullRange ? new Position(1, 0) : lens.range.start;
lens.command = {
title: title,
command: Commands.ShowFileHistory,
arguments: [
Uri.file(lens.uri.fsPath),
{
line,
position,
sha: commit && commit.sha
} as ShowFileHistoryCommandArgs
]
};
return lens;
}
_applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
if (commit === undefined) {
const blameLine = blame.allLines[lens.range.start.line];
@ -402,6 +338,15 @@ export class GitCodeLensProvider implements CodeLensProvider {
return lens;
}
_applyShowQuickCurrentBranchHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
lens.command = {
title: title,
command: CodeLensCommand.ShowQuickCurrentBranchHistory,
arguments: [Uri.file(lens.uri.fsPath)]
};
return lens;
}
_applyShowQuickFileHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
lens.command = {
title: title,
@ -416,10 +361,10 @@ export class GitCodeLensProvider implements CodeLensProvider {
return lens;
}
_applyShowQuickBranchHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines, commit?: GitBlameCommit): T {
_applyToggleFileBlameCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: GitBlameLines): T {
lens.command = {
title: title,
command: CodeLensCommand.ShowQuickCurrentBranchHistory,
command: Commands.ToggleFileBlame,
arguments: [Uri.file(lens.uri.fsPath)]
};
return lens;

+ 4
- 7
src/gitContentProvider.ts Просмотреть файл

@ -13,15 +13,12 @@ export class GitContentProvider implements TextDocumentContentProvider {
async provideTextDocumentContent(uri: Uri, token: CancellationToken): Promise<string | undefined> {
const data = GitService.fromGitContentUri(uri);
if (data.sha === GitService.fakeSha) return '';
const fileName = data.originalFileName || data.fileName;
try {
let text = data.sha !== GitService.fakeSha
? await this.git.getVersionedFileText(data.repoPath, fileName, data.sha)
: '';
if (data.decoration) {
text = `${data.decoration}\n${text}`;
}
return text;
return await this.git.getVersionedFileText(data.repoPath, fileName, data.sha);
}
catch (ex) {
Logger.error(ex, 'GitContentProvider', 'getVersionedFileText');

+ 25
- 99
src/gitService.ts Просмотреть файл

@ -1,10 +1,10 @@
'use strict';
import { Functions, Iterables, Objects } from './system';
import { Disposable, Event, EventEmitter, FileSystemWatcher, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
import { Disposable, Event, EventEmitter, FileSystemWatcher, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
import { IConfig } from './configuration';
import { DocumentSchemes, ExtensionKey, GlyphChars } from './constants';
import { DocumentSchemes, ExtensionKey } from './constants';
import { RemoteProviderFactory } from './git/remotes/factory';
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitBranchParser, GitCommit, GitDiff, GitDiffChunkLine, GitDiffParser, GitDiffShortStat, GitLog, GitLogCommit, GitLogParser, GitRemote, GitRemoteParser, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitBranchParser, GitCommit, GitCommitType, GitDiff, GitDiffChunkLine, GitDiffParser, GitDiffShortStat, GitLog, GitLogCommit, GitLogParser, GitRemote, GitRemoteParser, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri';
import { Logger } from './logger';
import * as fs from 'fs';
@ -15,7 +15,8 @@ export { GitUri, IGitCommitInfo };
export * from './git/models/models';
export * from './git/formatters/commit';
export * from './git/formatters/status';
export { getNameFromRemoteResource, RemoteResource, RemoteProvider } from './git/remotes/provider';
export { getNameFromRemoteResource, RemoteProvider, RemoteResource, RemoteResourceType } from './git/remotes/provider';
export { RemoteProviderFactory } from './git/remotes/factory';
export * from './git/gitContextTracker';
class UriCacheEntry {
@ -56,20 +57,18 @@ enum RemoveCacheReason {
DocumentSaved
}
export type GitRepoSearchBy = 'author' | 'files' | 'message' | 'sha';
export const GitRepoSearchBy = {
Author: 'author' as GitRepoSearchBy,
Files: 'files' as GitRepoSearchBy,
Message: 'message' as GitRepoSearchBy,
Sha: 'sha' as GitRepoSearchBy
};
export type RepoChangedReasons = 'remotes' | 'stash' | 'unknown';
export const RepoChangedReasons = {
Remotes: 'remotes' as RepoChangedReasons,
Stash: 'stash' as RepoChangedReasons,
Unknown: 'unknown' as RepoChangedReasons
};
export enum GitRepoSearchBy {
Author = 'author',
Files = 'files',
Message = 'message',
Sha = 'sha'
}
export enum RepoChangedReasons {
Remotes = 'remotes',
Stash = 'stash',
Unknown = ''
}
export class GitService extends Disposable {
@ -234,7 +233,7 @@ export class GitService extends Disposable {
private _onRepoChanged(uri: Uri) {
if (uri !== undefined && uri.path.endsWith('ref/stash')) {
this._fireRepoChange('stash');
this._fireRepoChange(RepoChangedReasons.Stash);
return;
}
@ -262,7 +261,7 @@ export class GitService extends Disposable {
private _fireRepoChangeDebounced: (() => void) | undefined = undefined;
private _repoChangedReasons: RepoChangedReasons[] = [];
private _fireRepoChange(reason: RepoChangedReasons = 'unknown') {
private _fireRepoChange(reason: RepoChangedReasons = RepoChangedReasons.Unknown) {
if (this._fireRepoChangeDebounced === undefined) {
this._fireRepoChangeDebounced = Functions.debounce(this._fireRepoChangeCore, 50);
}
@ -563,30 +562,6 @@ export class GitService extends Disposable {
} as GitBlameLines;
}
async getBlameLocations(uri: GitUri, range: Range, selectedSha?: string, line?: number): Promise<Location[] | undefined> {
Logger.log(`getBlameLocations('${uri.repoPath}', '${uri.fsPath}', [${range.start.line}, ${range.end.line}], ${uri.sha})`);
const blame = await this.getBlameForRange(uri, range);
if (blame === undefined) return undefined;
const commitCount = blame.commits.size;
const dateFormat = this.config.defaultDateFormat === null ? 'MMMM Do, YYYY h:MMa' : this.config.defaultDateFormat;
const locations: Location[] = [];
Iterables.forEach(blame.commits.values(), (c, i) => {
if (c.isUncommitted) return;
const decoration = `${GlyphChars.ArrowDropRight} ${c.author}, ${c.formatDate(dateFormat)}`;
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration, dateFormat);
locations.push(new Location(uri, new Position(0, 0)));
if (c.sha === selectedSha) {
locations.push(new Location(uri, new Position((line || 0) + 1, 0)));
}
});
return locations;
}
async getBranch(repoPath: string): Promise<GitBranch | undefined> {
Logger.log(`getBranch('${repoPath}')`);
@ -747,7 +722,7 @@ export class GitService extends Disposable {
try {
const data = await Git.log(repoPath, sha, maxCount, reverse);
const log = GitLogParser.parse(data, 'branch', repoPath, undefined, sha, maxCount, reverse, undefined);
const log = GitLogParser.parse(data, GitCommitType.Branch, repoPath, undefined, sha, maxCount, reverse, undefined);
return log;
}
catch (ex) {
@ -781,7 +756,7 @@ export class GitService extends Disposable {
try {
const data = await Git.log_search(repoPath, searchArgs, maxCount);
const log = GitLogParser.parse(data, 'branch', repoPath, undefined, undefined, maxCount, false, undefined);
const log = GitLogParser.parse(data, GitCommitType.Branch, repoPath, undefined, undefined, maxCount, false, undefined);
return log;
}
catch (ex) {
@ -867,7 +842,7 @@ export class GitService extends Disposable {
try {
const { range, ...opts } = options;
const data = await Git.log_file(root, file, sha, { ...opts, ...{ startLine: range && range.start.line + 1, endLine: range && range.end.line + 1 } });
const log = GitLogParser.parse(data, 'file', root, file, sha, options.maxCount, options.reverse!, range);
const log = GitLogParser.parse(data, GitCommitType.File, root, file, sha, options.maxCount, options.reverse!, range);
return log;
}
catch (ex) {
@ -888,30 +863,6 @@ export class GitService extends Disposable {
}
}
async getLogLocations(uri: GitUri, selectedSha?: string, line?: number): Promise<Location[] | undefined> {
Logger.log(`getLogLocations('${uri.repoPath}', '${uri.fsPath}', ${uri.sha}, ${selectedSha}, ${line})`);
const log = await this.getLogForFile(uri.repoPath, uri.fsPath, uri.sha);
if (log === undefined) return undefined;
const commitCount = log.commits.size;
const dateFormat = this.config.defaultDateFormat === null ? 'MMMM Do, YYYY h:MMa' : this.config.defaultDateFormat;
const locations: Location[] = [];
Iterables.forEach(log.commits.values(), (c, i) => {
if (c.isUncommitted) return;
const decoration = `${GlyphChars.ArrowDropRight} ${c.author}, ${c.formatDate(dateFormat)}`;
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration, dateFormat);
locations.push(new Location(uri, new Position(0, 0)));
if (c.sha === selectedSha) {
locations.push(new Location(uri, new Position((line || 0) + 1, 0)));
}
});
return locations;
}
hasRemotes(repoPath: string): boolean {
const remotes = this._remotesCache.get(this.normalizeRepoPath(repoPath));
return remotes !== undefined && remotes.length > 0;
@ -1158,7 +1109,7 @@ export class GitService extends Disposable {
shortSha = GitService.shortenSha(shaOrcommitOrUri);
}
else if (shaOrcommitOrUri instanceof GitCommit) {
data = GitService._toGitUriData(shaOrcommitOrUri, undefined, shaOrcommitOrUri.originalFileName);
data = GitService._toGitUriData(shaOrcommitOrUri, shaOrcommitOrUri.originalFileName);
fileName = shaOrcommitOrUri.fileName;
shortSha = shaOrcommitOrUri.shortSha;
}
@ -1176,37 +1127,12 @@ export class GitService extends Disposable {
return Uri.parse(`${DocumentSchemes.GitLensGit}:${path.basename(fileName!, extension)}:${shortSha}${extension}?${JSON.stringify(data)}`);
}
static toReferenceGitContentUri(commit: GitCommit, index: number, commitCount: number, originalFileName: string | undefined, decoration: string, dateFormat: string | null): Uri {
return GitService._toReferenceGitContentUri(commit, DocumentSchemes.GitLensGit, commitCount, GitService._toGitUriData(commit, index, originalFileName, decoration), dateFormat);
}
private static _toReferenceGitContentUri(commit: GitCommit, scheme: DocumentSchemes, commitCount: number, data: IGitUriData, dateFormat: string | null) {
const pad = (n: number) => ('0000000' + n).slice(-('' + commitCount).length);
const ext = path.extname(data.fileName);
const uriPath = `${path.relative(commit.repoPath, data.fileName.slice(0, -ext.length))}/${commit.shortSha}${ext}`;
let message = commit.message;
if (message.length > 50) {
message = message.substring(0, 49) + GlyphChars.Ellipsis;
}
if (dateFormat === null) {
dateFormat = 'MMMM Do, YYYY h:MMa';
}
// NOTE: Need to specify an index here, since I can't control the sort order -- just alphabetic or by file location
return Uri.parse(`${scheme}:${pad(data.index || 0)} ${GlyphChars.Dot} ${encodeURIComponent(message)} ${GlyphChars.Dot} ${commit.formatDate(dateFormat)} ${GlyphChars.Dot} ${encodeURIComponent(uriPath)}?${JSON.stringify(data)}`);
}
private static _toGitUriData<T extends IGitUriData>(commit: IGitUriData, index?: number, originalFileName?: string, decoration?: string): T {
private static _toGitUriData<T extends IGitUriData>(commit: IGitUriData, originalFileName?: string): T {
const fileName = Git.normalizePath(path.resolve(commit.repoPath, commit.fileName));
const data = { repoPath: commit.repoPath, fileName: fileName, sha: commit.sha, index: index } as T;
const data = { repoPath: commit.repoPath, fileName: fileName, sha: commit.sha } as T;
if (originalFileName) {
data.originalFileName = Git.normalizePath(path.resolve(commit.repoPath, originalFileName));
}
if (decoration) {
data.decoration = decoration;
}
return data;
}

+ 5
- 6
src/logger.ts Просмотреть файл

@ -6,12 +6,11 @@ import { Telemetry } from './telemetry';
const ConsolePrefix = `[${ExtensionOutputChannelName}]`;
export type OutputLevel = 'silent' | 'errors' | 'verbose';
export const OutputLevel = {
Silent: 'silent' as OutputLevel,
Errors: 'errors' as OutputLevel,
Verbose: 'verbose' as OutputLevel
};
export enum OutputLevel {
Silent = 'silent',
Errors = 'errors',
Verbose = 'verbose'
}
let debug = false;
let level: OutputLevel = OutputLevel.Silent;

+ 10
- 18
src/messages.ts Просмотреть файл

@ -4,24 +4,16 @@ import { BuiltInCommands } from './constants';
import { GitCommit } from './gitService';
import { Logger } from './logger';
export type SuppressedKeys = 'suppressCommitHasNoPreviousCommitWarning' |
'suppressCommitNotFoundWarning' |
'suppressFileNotUnderSourceControlWarning' |
'suppressGitVersionWarning' |
'suppressLineUncommittedWarning' |
'suppressNoRepositoryWarning' |
'suppressUpdateNotice' |
'suppressWelcomeNotice';
export const SuppressedKeys = {
CommitHasNoPreviousCommitWarning: 'suppressCommitHasNoPreviousCommitWarning' as SuppressedKeys,
CommitNotFoundWarning: 'suppressCommitNotFoundWarning' as SuppressedKeys,
FileNotUnderSourceControlWarning: 'suppressFileNotUnderSourceControlWarning' as SuppressedKeys,
GitVersionWarning: 'suppressGitVersionWarning' as SuppressedKeys,
LineUncommittedWarning: 'suppressLineUncommittedWarning' as SuppressedKeys,
NoRepositoryWarning: 'suppressNoRepositoryWarning' as SuppressedKeys,
UpdateNotice: 'suppressUpdateNotice' as SuppressedKeys,
WelcomeNotice: 'suppressWelcomeNotice' as SuppressedKeys
};
export enum SuppressedKeys {
CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning',
CommitNotFoundWarning = 'suppressCommitNotFoundWarning',
FileNotUnderSourceControlWarning = 'suppressFileNotUnderSourceControlWarning',
GitVersionWarning = 'suppressGitVersionWarning',
LineUncommittedWarning = 'suppressLineUncommittedWarning',
NoRepositoryWarning = 'suppressNoRepositoryWarning',
UpdateNotice = 'suppressUpdateNotice',
WelcomeNotice = 'suppressWelcomeNotice'
}
export class Messages {

+ 7
- 7
src/quickPicks/remotes.ts Просмотреть файл

@ -4,7 +4,7 @@ import { QuickPickOptions, window } from 'vscode';
import { Commands, OpenInRemoteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
import { GlyphChars } from '../constants';
import { getNameFromRemoteResource, GitLogCommit, GitRemote, GitService, RemoteResource } from '../gitService';
import { getNameFromRemoteResource, GitLogCommit, GitRemote, GitService, RemoteResource, RemoteResourceType } from '../gitService';
import * as path from 'path';
export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
@ -34,28 +34,28 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
let description = '';
switch (resource.type) {
case 'branch':
case RemoteResourceType.Branch:
description = `$(git-branch) ${resource.branch}`;
break;
case 'branches':
case RemoteResourceType.Branches:
description = `$(git-branch) Branches`;
break;
case 'commit':
case RemoteResourceType.Commit:
const shortSha = GitService.shortenSha(resource.sha);
description = `$(git-commit) ${shortSha}`;
break;
case 'file':
case RemoteResourceType.File:
description = `$(file-text) ${path.basename(resource.fileName)}`;
break;
case 'repo':
case RemoteResourceType.Repo:
description = `$(repo) Repository`;
break;
case 'revision':
case RemoteResourceType.Revision:
if (resource.commit !== undefined && resource.commit instanceof GitLogCommit) {
if (resource.commit.status === 'D') {
resource.sha = resource.commit.previousSha;

+ 5
- 9
src/views/gitExplorer.ts Просмотреть файл

@ -10,15 +10,11 @@ import { GitService, GitUri, RepoChangedReasons } from '../gitService';
export * from './explorerNodes';
export type GitExplorerView =
'auto' |
'history' |
'repository';
export const GitExplorerView = {
Auto: 'auto' as GitExplorerView,
History: 'history' as GitExplorerView,
Repository: 'repository' as GitExplorerView
};
export enum GitExplorerView {
Auto = 'auto',
History = 'history',
Repository = 'repository'
}
export interface OpenFileRevisionCommandArgs {
uri?: Uri;

+ 3
- 3
src/views/remoteNode.ts Просмотреть файл

@ -4,7 +4,7 @@ import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { BranchHistoryNode } from './branchHistoryNode';
import { GlyphChars } from '../constants';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitRemote, GitService, GitUri } from '../gitService';
import { GitRemote, GitRemoteType, GitService, GitUri } from '../gitService';
export class RemoteNode extends ExplorerNode {
@ -28,8 +28,8 @@ export class RemoteNode extends ExplorerNode {
}
getTreeItem(): TreeItem {
const fetch = this.remote.types.includes('push');
const push = this.remote.types.includes('push');
const fetch = this.remote.types.includes(GitRemoteType.Push);
const push = this.remote.types.includes(GitRemoteType.Push);
let separator;
if (fetch && push) {

+ 2
- 2
src/views/statusFilesNode.ts Просмотреть файл

@ -4,7 +4,7 @@ import { ExtensionContext, TreeItem, TreeItemCollapsibleState, Uri } from 'vscod
import { GitExplorerFilesLayout } from '../configuration';
import { ExplorerNode, ResourceType, ShowAllNode } from './explorerNode';
import { FolderNode, IFileExplorerNode } from './folderNode';
import { GitBranch, GitLog, GitLogCommit, GitService, GitStatus, GitUri, IGitStatusFileWithCommit } from '../gitService';
import { GitBranch, GitCommitType, GitLog, GitLogCommit, GitService, GitStatus, GitUri, IGitStatusFileWithCommit } from '../gitService';
import { StatusFileCommitsNode } from './statusFileCommitsNode';
import * as path from 'path';
@ -47,7 +47,7 @@ export class StatusFilesNode extends ExplorerNode {
statuses.splice(0, 0, ...this.status.files.map(s => {
return {
...s,
commit: new GitLogCommit('file', repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
commit: new GitLogCommit(GitCommitType.File, repoPath, GitService.uncommittedSha, s.fileName, 'You', new Date(), '', s.status, [s], s.originalFileName, 'HEAD', s.fileName)
} as IGitStatusFileWithCommit;
}));
}

Загрузка…
Отмена
Сохранить