mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Adds update notification
Adds don't show again option to invalid git version notification
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
### 2.13.0
|
### 2.13.0
|
||||||
|
- Adds an update notification (for feature releases) -- please file an issue if this it too much
|
||||||
- Adds `Show Branch History` command (`gitlens.showQuickBranchHistory`) to show the history of the selected branch
|
- Adds `Show Branch History` command (`gitlens.showQuickBranchHistory`) to show the history of the selected branch
|
||||||
- Adds `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`) to re-open the previously opened quick pick - helps to get back to previous context
|
- Adds `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`) to re-open the previously opened quick pick - helps to get back to previous context
|
||||||
- Adds `alt+-` shortcut for the `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`)
|
- Adds `alt+-` shortcut for the `Show Last Opened Quick Pick` command (`gitlens.showLastQuickPick`)
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
- Adds current branch to branch quick pick placeholder
|
- Adds current branch to branch quick pick placeholder
|
||||||
- Adds `Show Branch History` command to the branch history quick pick when showing only limited commits (e.g. starting at a specified commit)
|
- Adds `Show Branch History` command to the branch history quick pick when showing only limited commits (e.g. starting at a specified commit)
|
||||||
- Adds `Show File History` command to the file history quick pick when showing only limited commits (e.g. starting at a specified commit)
|
- Adds `Show File History` command to the file history quick pick when showing only limited commits (e.g. starting at a specified commit)
|
||||||
|
- Adds `Don't Show Again` option to the unsupported git version notification
|
||||||
- Changes `Show Repository History` command to `Show Current Branch History`
|
- Changes `Show Repository History` command to `Show Current Branch History`
|
||||||
- Changes `Repository History` terminology to `Branch History`
|
- Changes `Repository History` terminology to `Branch History`
|
||||||
- Fixes issue with `gitlens.diffWithPrevious` command execution via CodeLens when the CodeLens was not at the document/file level
|
- Fixes issue with `gitlens.diffWithPrevious` command execution via CodeLens when the CodeLens was not at the document/file level
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
export const RepoPath = 'repoPath';
|
export const RepoPath = 'repoPath';
|
||||||
|
|
||||||
export type BuiltInCommands = 'cursorMove' | 'editor.action.showReferences' | 'editor.action.toggleRenderWhitespace' | 'editorScroll' | 'revealLine' | 'setContext' | 'vscode.diff' | 'vscode.executeDocumentSymbolProvider' | 'vscode.executeCodeLensProvider' | 'vscode.open' | 'workbench.action.closeActiveEditor' | 'workbench.action.nextEditor';
|
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.nextEditor';
|
||||||
export const BuiltInCommands = {
|
export const BuiltInCommands = {
|
||||||
CloseActiveEditor: 'workbench.action.closeActiveEditor' as BuiltInCommands,
|
CloseActiveEditor: 'workbench.action.closeActiveEditor' as BuiltInCommands,
|
||||||
CursorMove: 'cursorMove' as BuiltInCommands,
|
CursorMove: 'cursorMove' as BuiltInCommands,
|
||||||
@@ -12,6 +12,7 @@ export const BuiltInCommands = {
|
|||||||
ExecuteCodeLensProvider: 'vscode.executeCodeLensProvider' as BuiltInCommands,
|
ExecuteCodeLensProvider: 'vscode.executeCodeLensProvider' as BuiltInCommands,
|
||||||
Open: 'vscode.open' as BuiltInCommands,
|
Open: 'vscode.open' as BuiltInCommands,
|
||||||
NextEditor: 'workbench.action.nextEditor' as BuiltInCommands,
|
NextEditor: 'workbench.action.nextEditor' as BuiltInCommands,
|
||||||
|
PreviewHtml: 'vscode.previewHtml' as BuiltInCommands,
|
||||||
RevealLine: 'revealLine' as BuiltInCommands,
|
RevealLine: 'revealLine' as BuiltInCommands,
|
||||||
SetContext: 'setContext' as BuiltInCommands,
|
SetContext: 'setContext' as BuiltInCommands,
|
||||||
ShowReferences: 'editor.action.showReferences' as BuiltInCommands,
|
ShowReferences: 'editor.action.showReferences' as BuiltInCommands,
|
||||||
@@ -27,5 +28,7 @@ export const DocumentSchemes = {
|
|||||||
|
|
||||||
export type WorkspaceState = 'repoPath';
|
export type WorkspaceState = 'repoPath';
|
||||||
export const WorkspaceState = {
|
export const WorkspaceState = {
|
||||||
RepoPath: 'repoPath' as WorkspaceState
|
GitLensVersion: 'gitlensVersion' as WorkspaceState,
|
||||||
|
RepoPath: 'repoPath' as WorkspaceState,
|
||||||
|
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { ExtensionContext, languages, window, workspace } from 'vscode';
|
import { commands, ExtensionContext, extensions, languages, Uri, window, workspace } from 'vscode';
|
||||||
import { BlameabilityTracker } from './blameabilityTracker';
|
import { BlameabilityTracker } from './blameabilityTracker';
|
||||||
import { BlameActiveLineController } from './blameActiveLineController';
|
import { BlameActiveLineController } from './blameActiveLineController';
|
||||||
import { BlameAnnotationController } from './blameAnnotationController';
|
import { BlameAnnotationController } from './blameAnnotationController';
|
||||||
@@ -14,7 +14,7 @@ import { ShowLastQuickPickCommand, ShowQuickBranchHistoryCommand, ShowQuickCurre
|
|||||||
import { ToggleCodeLensCommand } from './commands';
|
import { ToggleCodeLensCommand } from './commands';
|
||||||
import { Keyboard } from './commands';
|
import { Keyboard } from './commands';
|
||||||
import { IAdvancedConfig, IBlameConfig } from './configuration';
|
import { IAdvancedConfig, IBlameConfig } from './configuration';
|
||||||
import { WorkspaceState } from './constants';
|
import { BuiltInCommands, WorkspaceState } from './constants';
|
||||||
import { GitContentProvider } from './gitContentProvider';
|
import { GitContentProvider } from './gitContentProvider';
|
||||||
import { Git, GitService } from './gitService';
|
import { Git, GitService } from './gitService';
|
||||||
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
|
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
|
||||||
@@ -24,15 +24,18 @@ import { Logger } from './logger';
|
|||||||
export async function activate(context: ExtensionContext) {
|
export async function activate(context: ExtensionContext) {
|
||||||
Logger.configure(context);
|
Logger.configure(context);
|
||||||
|
|
||||||
|
const gitlens = extensions.getExtension('eamodio.gitlens');
|
||||||
|
const gitlensVersion = gitlens.packageJSON.version;
|
||||||
|
|
||||||
// Workspace not using a folder. No access to git repo.
|
// Workspace not using a folder. No access to git repo.
|
||||||
if (!workspace.rootPath) {
|
if (!workspace.rootPath) {
|
||||||
Logger.warn('GitLens inactive: no rootPath');
|
Logger.warn(`GitLens(v${gitlensVersion}) inactive: no rootPath`);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootPath = workspace.rootPath.replace(/\\/g, '/');
|
const rootPath = workspace.rootPath.replace(/\\/g, '/');
|
||||||
Logger.log(`GitLens active: ${rootPath}`);
|
Logger.log(`GitLens(v${gitlensVersion}) active: ${rootPath}`);
|
||||||
|
|
||||||
const config = workspace.getConfiguration('gitlens');
|
const config = workspace.getConfiguration('gitlens');
|
||||||
const gitPath = config.get<IAdvancedConfig>('advanced').git;
|
const gitPath = config.get<IAdvancedConfig>('advanced').git;
|
||||||
@@ -52,12 +55,11 @@ export async function activate(context: ExtensionContext) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = Git.gitInfo().version;
|
const gitVersion = Git.gitInfo().version;
|
||||||
const [major, minor] = version.split('.');
|
Logger.log(`Git version: ${gitVersion}`);
|
||||||
// If git is less than v2.2.0
|
|
||||||
if (parseInt(major, 10) < 2 || parseInt(minor, 10) < 2) {
|
notifyOnUnsupportedGitVersion(context, gitVersion);
|
||||||
await window.showErrorMessage(`GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git.`);
|
notifyOnNewGitLensVersion(context, gitlensVersion);
|
||||||
}
|
|
||||||
|
|
||||||
let gitEnabled = workspace.getConfiguration('git').get<boolean>('enabled');
|
let gitEnabled = workspace.getConfiguration('git').get<boolean>('enabled');
|
||||||
setCommandContext(CommandContext.Enabled, gitEnabled);
|
setCommandContext(CommandContext.Enabled, gitEnabled);
|
||||||
@@ -114,4 +116,34 @@ export async function activate(context: ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this method is called when your extension is deactivated
|
// this method is called when your extension is deactivated
|
||||||
export function deactivate() { }
|
export function deactivate() { }
|
||||||
|
|
||||||
|
async function notifyOnNewGitLensVersion(context: ExtensionContext, version: string) {
|
||||||
|
const previousVersion = context.globalState.get<string>(WorkspaceState.GitLensVersion);
|
||||||
|
|
||||||
|
await context.globalState.update(WorkspaceState.GitLensVersion, version);
|
||||||
|
|
||||||
|
if (previousVersion) {
|
||||||
|
const [major, minor] = version.split('.');
|
||||||
|
const [prevMajor, prevMinor] = previousVersion.split('.');
|
||||||
|
if (major === prevMajor && minor === prevMinor) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await window.showInformationMessage(`GitLens has been updated to v${version}`, 'View Release Notes');
|
||||||
|
if (result === 'View Release Notes') {
|
||||||
|
commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function notifyOnUnsupportedGitVersion(context: ExtensionContext, version: string) {
|
||||||
|
if (context.globalState.get(WorkspaceState.SuppressGitVersionWarning, false)) return;
|
||||||
|
|
||||||
|
const [major, minor] = version.split('.');
|
||||||
|
// If git is less than v2.2.0
|
||||||
|
if (parseInt(major, 10) < 2 || parseInt(minor, 10) < 2) {
|
||||||
|
const result = await window.showErrorMessage(`GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git.`, `Don't Show Again`);
|
||||||
|
if (result === `Don't Show Again`) {
|
||||||
|
context.globalState.update(WorkspaceState.SuppressGitVersionWarning, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user