Browse Source

Adds new showCommitsInView command

Adds new reveal commit in Repositories view code lens command option
Adds new show commits in Search Commits view code lens command option
main
Eric Amodio 5 years ago
parent
commit
b895adbc80
9 changed files with 203 additions and 73 deletions
  1. +22
    -0
      package.json
  2. +76
    -48
      src/codelens/codeLensProvider.ts
  3. +1
    -0
      src/commands.ts
  4. +2
    -1
      src/commands/common.ts
  5. +70
    -0
      src/commands/showCommitsInView.ts
  6. +10
    -23
      src/commands/showQuickCommitDetails.ts
  7. +2
    -0
      src/config.ts
  8. +7
    -1
      src/git/gitService.ts
  9. +13
    -0
      src/webviews/apps/settings/index.html

+ 22
- 0
package.json View File

@ -161,6 +161,8 @@
"enum": [ "enum": [
"gitlens.toggleFileBlame", "gitlens.toggleFileBlame",
"gitlens.diffWithPrevious", "gitlens.diffWithPrevious",
"gitlens.revealCommitInView",
"gitlens.showCommitsInView",
"gitlens.showQuickCommitDetails", "gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails", "gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory", "gitlens.showQuickFileHistory",
@ -169,6 +171,8 @@
"enumDescriptions": [ "enumDescriptions": [
"Toggles file blame annotations", "Toggles file blame annotations",
"Compares the current committed file with the previous commit", "Compares the current committed file with the previous commit",
"Reveals the commit in the Repositories view",
"Shows the commits within the range in the Search Commits view",
"Shows a commit details quick pick", "Shows a commit details quick pick",
"Shows a commit file details quick pick", "Shows a commit file details quick pick",
"Shows a file history quick pick", "Shows a file history quick pick",
@ -201,6 +205,8 @@
"enum": [ "enum": [
"gitlens.toggleFileBlame", "gitlens.toggleFileBlame",
"gitlens.diffWithPrevious", "gitlens.diffWithPrevious",
"gitlens.revealCommitInView",
"gitlens.showCommitsInView",
"gitlens.showQuickCommitDetails", "gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails", "gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory", "gitlens.showQuickFileHistory",
@ -209,6 +215,8 @@
"enumDescriptions": [ "enumDescriptions": [
"Toggles file blame annotations", "Toggles file blame annotations",
"Compares the current committed file with the previous commit", "Compares the current committed file with the previous commit",
"Reveals the commit in the Repositories view",
"Shows the commit in the Search Commits view",
"Shows a commit details quick pick", "Shows a commit details quick pick",
"Shows a commit file details quick pick", "Shows a commit file details quick pick",
"Shows a file history quick pick", "Shows a file history quick pick",
@ -2237,6 +2245,16 @@
"category": "GitLens" "category": "GitLens"
}, },
{ {
"command": "gitlens.showCommitInView",
"title": "Show Commit in Search Commits View",
"category": "GitLens"
},
{
"command": "gitlens.showCommitsInView",
"title": "Show Commits within Selection in Search Commits View",
"category": "GitLens"
},
{
"command": "gitlens.showFileHistoryInView", "command": "gitlens.showFileHistoryInView",
"title": "Show in File History View", "title": "Show in File History View",
"category": "GitLens" "category": "GitLens"
@ -3422,6 +3440,10 @@
"when": "gitlens:activeFileStatus =~ /blameable/" "when": "gitlens:activeFileStatus =~ /blameable/"
}, },
{ {
"command": "gitlens.showCommitsInView",
"when": "gitlens:activeFileStatus =~ /blameable/"
},
{
"command": "gitlens.showFileHistoryInView", "command": "gitlens.showFileHistoryInView",
"when": "gitlens:activeFileStatus =~ /tracked/" "when": "gitlens:activeFileStatus =~ /tracked/"
}, },

+ 76
- 48
src/codelens/codeLensProvider.ts View File

@ -20,6 +20,7 @@ import {
import { import {
Commands, Commands,
DiffWithPreviousCommandArgs, DiffWithPreviousCommandArgs,
ShowCommitsInViewCommandArgs,
ShowQuickCommitDetailsCommandArgs, ShowQuickCommitDetailsCommandArgs,
ShowQuickCommitFileDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs,
ShowQuickFileHistoryCommandArgs ShowQuickFileHistoryCommandArgs
@ -476,6 +477,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (blame === undefined) return lens; if (blame === undefined) return lens;
const recentCommit = Iterables.first(blame.commits.values()); const recentCommit = Iterables.first(blame.commits.values());
let title = `${recentCommit.author}, ${recentCommit.formattedDate}`; let title = `${recentCommit.author}, ${recentCommit.formattedDate}`;
if (Container.config.debug) { if (Container.config.debug) {
title += ` [${lens.languageId}: ${SymbolKind[lens.symbol.kind]}(${lens.range.start.character}-${ title += ` [${lens.languageId}: ${SymbolKind[lens.symbol.kind]}(${lens.range.start.character}-${
@ -491,32 +493,21 @@ export class GitCodeLensProvider implements CodeLensProvider {
switch (lens.desiredCommand) { switch (lens.desiredCommand) {
case CodeLensCommand.DiffWithPrevious: case CodeLensCommand.DiffWithPrevious:
return this.applyDiffWithPreviousCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
return this.applyDiffWithPreviousCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
case CodeLensCommand.RevealCommitInView:
return this.applyRevealCommitInViewCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
case CodeLensCommand.ShowCommitsInView:
return this.applyShowCommitsInViewCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
case CodeLensCommand.ShowQuickCommitDetails: case CodeLensCommand.ShowQuickCommitDetails:
return this.applyShowQuickCommitDetailsCommand<GitRecentChangeCodeLens>(
title,
lens,
blame,
recentCommit
);
return this.applyShowQuickCommitDetailsCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
case CodeLensCommand.ShowQuickCommitFileDetails: case CodeLensCommand.ShowQuickCommitFileDetails:
return this.applyShowQuickCommitFileDetailsCommand<GitRecentChangeCodeLens>(
title,
lens,
blame,
recentCommit
);
return this.applyShowQuickCommitFileDetailsCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
case CodeLensCommand.ShowQuickCurrentBranchHistory: case CodeLensCommand.ShowQuickCurrentBranchHistory:
return this.applyShowQuickCurrentBranchHistoryCommand<GitRecentChangeCodeLens>(
title,
lens,
blame,
recentCommit
);
return this.applyShowQuickCurrentBranchHistoryCommand<GitRecentChangeCodeLens>(title, lens);
case CodeLensCommand.ShowQuickFileHistory: case CodeLensCommand.ShowQuickFileHistory:
return this.applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
return this.applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens);
case CodeLensCommand.ToggleFileBlame: case CodeLensCommand.ToggleFileBlame:
return this.applyToggleFileBlameCommand<GitRecentChangeCodeLens>(title, lens, blame);
return this.applyToggleFileBlameCommand<GitRecentChangeCodeLens>(title, lens);
default: default:
return lens; return lens;
} }
@ -527,9 +518,10 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (blame === undefined) return lens; if (blame === undefined) return lens;
const count = blame.authors.size; const count = blame.authors.size;
let title = `${count} ${count > 1 ? 'authors' : 'author'} (${Iterables.first(blame.authors.values()).name}${
count > 1 ? ' and others' : ''
})`;
const author = Iterables.first(blame.authors.values()).name;
let title = `${count} ${count > 1 ? 'authors' : 'author'} (${author}${count > 1 ? ' and others' : ''})`;
if (Container.config.debug) { if (Container.config.debug) {
title += ` [${lens.languageId}: ${SymbolKind[lens.symbol.kind]}(${lens.range.start.character}-${ title += ` [${lens.languageId}: ${SymbolKind[lens.symbol.kind]}(${lens.range.start.character}-${
lens.range.end.character lens.range.end.character
@ -543,19 +535,26 @@ export class GitCodeLensProvider implements CodeLensProvider {
)})]`; )})]`;
} }
const commit =
Iterables.find(blame.commits.values(), c => c.author === author) || Iterables.first(blame.commits.values());
switch (lens.desiredCommand) { switch (lens.desiredCommand) {
case CodeLensCommand.DiffWithPrevious: case CodeLensCommand.DiffWithPrevious:
return this.applyDiffWithPreviousCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyDiffWithPreviousCommand<GitAuthorsCodeLens>(title, lens, commit);
case CodeLensCommand.RevealCommitInView:
return this.applyRevealCommitInViewCommand<GitAuthorsCodeLens>(title, lens, commit);
case CodeLensCommand.ShowCommitsInView:
return this.applyShowCommitsInViewCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.ShowQuickCommitDetails: case CodeLensCommand.ShowQuickCommitDetails:
return this.applyShowQuickCommitDetailsCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyShowQuickCommitDetailsCommand<GitAuthorsCodeLens>(title, lens, commit);
case CodeLensCommand.ShowQuickCommitFileDetails: case CodeLensCommand.ShowQuickCommitFileDetails:
return this.applyShowQuickCommitFileDetailsCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyShowQuickCommitFileDetailsCommand<GitAuthorsCodeLens>(title, lens, commit);
case CodeLensCommand.ShowQuickCurrentBranchHistory: case CodeLensCommand.ShowQuickCurrentBranchHistory:
return this.applyShowQuickCurrentBranchHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyShowQuickCurrentBranchHistoryCommand<GitAuthorsCodeLens>(title, lens);
case CodeLensCommand.ShowQuickFileHistory: case CodeLensCommand.ShowQuickFileHistory:
return this.applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens);
case CodeLensCommand.ToggleFileBlame: case CodeLensCommand.ToggleFileBlame:
return this.applyToggleFileBlameCommand<GitAuthorsCodeLens>(title, lens, blame);
return this.applyToggleFileBlameCommand<GitAuthorsCodeLens>(title, lens);
default: default:
return lens; return lens;
} }
@ -564,14 +563,8 @@ export class GitCodeLensProvider implements CodeLensProvider {
private applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>( private applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T, lens: T,
blame: GitBlameLines,
commit?: GitBlameCommit
commit: GitBlameCommit | undefined
): T { ): T {
if (commit === undefined) {
const blameLine = blame.allLines[lens.range.start.line];
commit = blame.commits.get(blameLine.sha);
}
const commandArgs: DiffWithPreviousCommandArgs = { const commandArgs: DiffWithPreviousCommandArgs = {
commit: commit commit: commit
}; };
@ -583,12 +576,53 @@ export class GitCodeLensProvider implements CodeLensProvider {
return lens; return lens;
} }
private applyShowQuickCommitDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
private applyRevealCommitInViewCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string,
lens: T,
commit: GitBlameCommit | undefined
): T {
const commandArgs: ShowQuickCommitDetailsCommandArgs = {
commit: commit,
sha: commit === undefined ? undefined : commit.sha
};
lens.command = {
title: title,
command: commit !== undefined && commit.isUncommitted ? '' : CodeLensCommand.RevealCommitInView,
arguments: [lens.uri!.toFileUri(), commandArgs]
};
return lens;
}
private applyShowCommitsInViewCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T, lens: T,
blame: GitBlameLines, blame: GitBlameLines,
commit?: GitBlameCommit commit?: GitBlameCommit
): T { ): T {
let refs;
if (commit === undefined) {
refs = [...Iterables.filterMap(blame.commits.values(), c => (c.isUncommitted ? undefined : c.ref))];
} else {
refs = [commit.ref];
}
const commandArgs: ShowCommitsInViewCommandArgs = {
repoPath: blame.repoPath,
refs: refs
};
lens.command = {
title: title,
command: Commands.ShowCommitsInView,
arguments: [commandArgs]
};
return lens;
}
private applyShowQuickCommitDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string,
lens: T,
commit: GitBlameCommit | undefined
): T {
const commandArgs: ShowQuickCommitDetailsCommandArgs = { const commandArgs: ShowQuickCommitDetailsCommandArgs = {
commit: commit, commit: commit,
sha: commit === undefined ? undefined : commit.sha sha: commit === undefined ? undefined : commit.sha
@ -604,8 +638,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
private applyShowQuickCommitFileDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>( private applyShowQuickCommitFileDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T, lens: T,
blame: GitBlameLines,
commit?: GitBlameCommit
commit: GitBlameCommit | undefined
): T { ): T {
const commandArgs: ShowQuickCommitFileDetailsCommandArgs = { const commandArgs: ShowQuickCommitFileDetailsCommandArgs = {
commit: commit, commit: commit,
@ -621,9 +654,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
private applyShowQuickCurrentBranchHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>( private applyShowQuickCurrentBranchHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T,
blame: GitBlameLines,
commit?: GitBlameCommit
lens: T
): T { ): T {
lens.command = { lens.command = {
title: title, title: title,
@ -635,9 +666,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
private applyShowQuickFileHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>( private applyShowQuickFileHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T,
blame: GitBlameLines,
commit?: GitBlameCommit
lens: T
): T { ): T {
const commandArgs: ShowQuickFileHistoryCommandArgs = { const commandArgs: ShowQuickFileHistoryCommandArgs = {
range: lens.isFullRange ? undefined : lens.blameRange range: lens.isFullRange ? undefined : lens.blameRange
@ -652,8 +681,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
private applyToggleFileBlameCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>( private applyToggleFileBlameCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(
title: string, title: string,
lens: T,
blame: GitBlameLines
lens: T
): T { ): T {
lens.command = { lens.command = {
title: title, title: title,

+ 1
- 0
src/commands.ts View File

@ -34,6 +34,7 @@ export * from './commands/gitCommands';
export * from './commands/repositories'; export * from './commands/repositories';
export * from './commands/resetSuppressedWarnings'; export * from './commands/resetSuppressedWarnings';
export * from './commands/searchCommits'; export * from './commands/searchCommits';
export * from './commands/showCommitsInView';
export * from './commands/showLastQuickPick'; export * from './commands/showLastQuickPick';
export * from './commands/showQuickBranchHistory'; export * from './commands/showQuickBranchHistory';
export * from './commands/showQuickCommitDetails'; export * from './commands/showQuickCommitDetails';

+ 2
- 1
src/commands/common.ts View File

@ -72,9 +72,10 @@ export enum Commands {
GitCommands = 'gitlens.gitCommands', GitCommands = 'gitlens.gitCommands',
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings', ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings',
RevealCommitInView = 'gitlens.revealCommitInView', RevealCommitInView = 'gitlens.revealCommitInView',
ShowCommitInView = 'gitlens.showCommitInView',
SearchCommits = 'gitlens.showCommitSearch', SearchCommits = 'gitlens.showCommitSearch',
SearchCommitsInView = 'gitlens.views.search.searchCommits', SearchCommitsInView = 'gitlens.views.search.searchCommits',
ShowCommitInView = 'gitlens.showCommitInView',
ShowCommitsInView = 'gitlens.showCommitsInView',
ShowCompareView = 'gitlens.showCompareView', ShowCompareView = 'gitlens.showCompareView',
ShowFileHistoryView = 'gitlens.showFileHistoryView', ShowFileHistoryView = 'gitlens.showFileHistoryView',
ShowFileHistoryInView = 'gitlens.showFileHistoryInView', ShowFileHistoryInView = 'gitlens.showFileHistoryInView',

+ 70
- 0
src/commands/showCommitsInView.ts View File

@ -0,0 +1,70 @@
'use strict';
import { commands, TextEditor, Uri } from 'vscode';
import { Container } from '../container';
import { ActiveEditorCommand, command, Commands, getCommandUri } from './common';
import { GitUri, SearchPattern } from '../git/gitService';
import { GitCommandsCommandArgs } from '../commands';
import { Messages } from '../messages';
import { Iterables } from '../system';
import { Logger } from '../logger';
export interface ShowCommitsInViewCommandArgs {
refs?: string[];
repoPath?: string;
}
@command()
export class ShowCommitsInViewCommand extends ActiveEditorCommand {
constructor() {
super([Commands.ShowCommitInView, Commands.ShowCommitsInView]);
}
async execute(editor?: TextEditor, uri?: Uri, args?: ShowCommitsInViewCommandArgs) {
args = { ...args };
if (args.refs === undefined) {
if (editor == null) return undefined;
uri = getCommandUri(uri, editor);
if (uri == null) return undefined;
const gitUri = await GitUri.fromUri(uri);
args.repoPath = gitUri.repoPath;
try {
// Check for any uncommitted changes in the range
const blame = editor.document.isDirty
? await Container.git.getBlameForRangeContents(gitUri, editor.selection, editor.document.getText())
: await Container.git.getBlameForRange(gitUri, editor.selection);
if (blame === undefined) {
return Messages.showFileNotUnderSourceControlWarningMessage(
'Unable to show commits in Search Commits view'
);
}
args.refs = [
...Iterables.filterMap(blame.commits.values(), c => (c.isUncommitted ? undefined : c.ref))
];
} catch (ex) {
Logger.error(ex, 'ShowCommitsInViewCommand', 'getBlameForRange');
return Messages.showGenericErrorMessage('Unable to show commits in Search Commits view');
}
}
let repo;
if (args.repoPath !== undefined) {
repo = await Container.git.getRepository(args.repoPath);
}
const gitCommandArgs: GitCommandsCommandArgs = {
command: 'search',
state: {
repo: repo,
pattern: SearchPattern.fromCommits(args.refs),
showResultsInView: true
}
};
return commands.executeCommand(Commands.GitCommands, gitCommandArgs);
}
}

+ 10
- 23
src/commands/showQuickCommitDetails.ts View File

@ -2,7 +2,7 @@
import { commands, TextEditor, Uri } from 'vscode'; import { commands, TextEditor, Uri } from 'vscode';
import { GlyphChars } from '../constants'; import { GlyphChars } from '../constants';
import { Container } from '../container'; import { Container } from '../container';
import { GitCommit, GitLog, GitLogCommit, GitUri, SearchPattern } from '../git/gitService';
import { GitCommit, GitLog, GitLogCommit, GitUri } from '../git/gitService';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { Messages } from '../messages'; import { Messages } from '../messages';
import { CommandQuickPickItem, CommitQuickPick, CommitWithFileStatusQuickPickItem } from '../quickpicks'; import { CommandQuickPickItem, CommitQuickPick, CommitWithFileStatusQuickPickItem } from '../quickpicks';
@ -20,7 +20,7 @@ export interface ShowQuickCommitDetailsCommandArgs {
sha?: string; sha?: string;
commit?: GitCommit | GitLogCommit; commit?: GitCommit | GitLogCommit;
repoLog?: GitLog; repoLog?: GitLog;
showInView?: 'reveal' | 'show';
revealInView?: boolean;
goBackCommand?: CommandQuickPickItem; goBackCommand?: CommandQuickPickItem;
} }
@ -38,16 +38,13 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
} }
constructor() { constructor() {
super([Commands.RevealCommitInView, Commands.ShowCommitInView, Commands.ShowQuickCommitDetails]);
super([Commands.RevealCommitInView, Commands.ShowQuickCommitDetails]);
} }
protected preExecute(context: CommandContext, args?: ShowQuickCommitDetailsCommandArgs) { protected preExecute(context: CommandContext, args?: ShowQuickCommitDetailsCommandArgs) {
if (context.command === Commands.RevealCommitInView) { if (context.command === Commands.RevealCommitInView) {
args = { ...args }; args = { ...args };
args.showInView = 'reveal';
} else if (context.command === Commands.ShowCommitInView) {
args = { ...args };
args.showInView = 'show';
args.revealInView = true;
} }
if (context.type === 'viewItem') { if (context.type === 'viewItem') {
@ -122,22 +119,12 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
return Messages.showCommitNotFoundWarningMessage('Unable to show commit details'); return Messages.showCommitNotFoundWarningMessage('Unable to show commit details');
} }
if (args.showInView) {
if (args.showInView === 'reveal') {
void (await Container.repositoriesView.revealCommit(args.commit, {
select: true,
focus: true,
expand: true
}));
} else {
void (await Container.searchView.search(
repoPath!,
{ pattern: SearchPattern.fromCommit(args.commit) },
{
label: { label: `for commit id ${args.commit.shortSha}` }
}
));
}
if (args.revealInView) {
void (await Container.repositoriesView.revealCommit(args.commit, {
select: true,
focus: true,
expand: true
}));
return undefined; return undefined;
} }

+ 2
- 0
src/config.ts View File

@ -126,6 +126,8 @@ export enum BranchSorting {
export enum CodeLensCommand { export enum CodeLensCommand {
DiffWithPrevious = 'gitlens.diffWithPrevious', DiffWithPrevious = 'gitlens.diffWithPrevious',
RevealCommitInView = 'gitlens.revealCommitInView',
ShowCommitsInView = 'gitlens.showCommitsInView',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails', ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails', ShowQuickCommitFileDetails = 'gitlens.showQuickCommitFileDetails',
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory',

+ 7
- 1
src/git/gitService.ts View File

@ -133,7 +133,13 @@ export namespace SearchPattern {
export function fromCommit(ref: string): string; export function fromCommit(ref: string): string;
export function fromCommit(commit: GitCommit): string; export function fromCommit(commit: GitCommit): string;
export function fromCommit(refOrCommit: string | GitCommit) { export function fromCommit(refOrCommit: string | GitCommit) {
return `commit:${GitService.shortenSha(typeof refOrCommit === 'string' ? refOrCommit : refOrCommit.sha)}`;
return `#:${GitService.shortenSha(typeof refOrCommit === 'string' ? refOrCommit : refOrCommit.sha)}`;
}
export function fromCommits(refs: string[]): string;
export function fromCommits(commits: GitCommit[]): string;
export function fromCommits(refsOrCommits: (string | GitCommit)[]) {
return refsOrCommits.map(r => `#:${GitService.shortenSha(typeof r === 'string' ? r : r.sha)}`).join(' ');
} }
export function toKey(search: SearchPattern) { export function toKey(search: SearchPattern) {

+ 13
- 0
src/webviews/apps/settings/index.html View File

@ -349,6 +349,12 @@
<option value="gitlens.diffWithPrevious" <option value="gitlens.diffWithPrevious"
>compares the commit with the previous</option >compares the commit with the previous</option
> >
<option value="gitlens.revealCommitInView"
>reveals the commit in the Repositories view</option
>
<option value="gitlens.showCommitsInView"
>shows the commit in the Search Commits view</option
>
<option value="gitlens.showQuickCommitDetails" <option value="gitlens.showQuickCommitDetails"
>shows details of the commit</option >shows details of the commit</option
> >
@ -403,6 +409,13 @@
<option value="gitlens.diffWithPrevious" <option value="gitlens.diffWithPrevious"
>compares the commit with the previous</option >compares the commit with the previous</option
> >
<option value="gitlens.revealCommitInView"
>reveals the commit in the Repositories view</option
>
<option value="gitlens.showCommitsInView"
>shows the commits within the range in the Search Commits
view</option
>
<option value="gitlens.showQuickCommitDetails" <option value="gitlens.showQuickCommitDetails"
>shows details of the commit</option >shows details of the commit</option
> >

Loading…
Cancel
Save