mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Adds Show Branch History command
Renames Show Repository History to Show Current Branch History Doesn't migrate data yet
This commit is contained in:
11
package.json
11
package.json
@@ -438,9 +438,14 @@
|
|||||||
"title": "Show File History",
|
"title": "Show File History",
|
||||||
"category": "GitLens"
|
"category": "GitLens"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.showQuickBranchHistory",
|
||||||
|
"title": "Show Branch History",
|
||||||
|
"category": "GitLens"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickRepoHistory",
|
"command": "gitlens.showQuickRepoHistory",
|
||||||
"title": "Show Repository History",
|
"title": "Show Current Branch History",
|
||||||
"category": "GitLens"
|
"category": "GitLens"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -535,6 +540,10 @@
|
|||||||
"command": "gitlens.showQuickFileHistory",
|
"command": "gitlens.showQuickFileHistory",
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.showQuickBranchHistory",
|
||||||
|
"when": "gitlens:enabled"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickRepoHistory",
|
"command": "gitlens.showQuickRepoHistory",
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ export * from './commands/showLastQuickPick';
|
|||||||
export * from './commands/showQuickCommitDetails';
|
export * from './commands/showQuickCommitDetails';
|
||||||
export * from './commands/showQuickCommitFileDetails';
|
export * from './commands/showQuickCommitFileDetails';
|
||||||
export * from './commands/showQuickFileHistory';
|
export * from './commands/showQuickFileHistory';
|
||||||
export * from './commands/showQuickRepoHistory';
|
export * from './commands/showQuickBranchHistory';
|
||||||
|
export * from './commands/showQuickCurrentBranchHistory';
|
||||||
export * from './commands/showQuickRepoStatus';
|
export * from './commands/showQuickRepoStatus';
|
||||||
export * from './commands/toggleBlame';
|
export * from './commands/toggleBlame';
|
||||||
export * from './commands/toggleCodeLens';
|
export * from './commands/toggleCodeLens';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { commands, Disposable, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode';
|
import { commands, Disposable, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode';
|
||||||
import { BuiltInCommands } from '../constants';
|
import { BuiltInCommands } from '../constants';
|
||||||
|
|
||||||
export type Commands = 'gitlens.closeUnchangedFiles' | 'gitlens.copyMessageToClipboard' | 'gitlens.copyShaToClipboard' | 'gitlens.diffDirectory' | 'gitlens.diffWithBranch' | 'gitlens.diffWithNext' | 'gitlens.diffWithPrevious' | 'gitlens.diffLineWithPrevious' | 'gitlens.diffWithWorking' | 'gitlens.diffLineWithWorking' | 'gitlens.openChangedFiles' | 'gitlens.showBlame' | 'gitlens.showBlameHistory' | 'gitlens.showFileHistory' | 'gitlens.showLastQuickPick' | 'gitlens.showQuickCommitDetails' | 'gitlens.showQuickCommitFileDetails' | 'gitlens.showQuickFileHistory' | 'gitlens.showQuickRepoHistory' | 'gitlens.showQuickRepoStatus' | 'gitlens.toggleBlame' | 'gitlens.toggleCodeLens';
|
export type Commands = 'gitlens.closeUnchangedFiles' | 'gitlens.copyMessageToClipboard' | 'gitlens.copyShaToClipboard' | 'gitlens.diffDirectory' | 'gitlens.diffWithBranch' | 'gitlens.diffWithNext' | 'gitlens.diffWithPrevious' | 'gitlens.diffLineWithPrevious' | 'gitlens.diffWithWorking' | 'gitlens.diffLineWithWorking' | 'gitlens.openChangedFiles' | 'gitlens.showBlame' | 'gitlens.showBlameHistory' | 'gitlens.showFileHistory' | 'gitlens.showLastQuickPick' | 'gitlens.showQuickBranchHistory' | 'gitlens.showQuickCommitDetails' | 'gitlens.showQuickCommitFileDetails' | 'gitlens.showQuickFileHistory' | 'gitlens.showQuickRepoHistory' | 'gitlens.showQuickRepoStatus' | 'gitlens.toggleBlame' | 'gitlens.toggleCodeLens';
|
||||||
export const Commands = {
|
export const Commands = {
|
||||||
CloseUnchangedFiles: 'gitlens.closeUnchangedFiles' as Commands,
|
CloseUnchangedFiles: 'gitlens.closeUnchangedFiles' as Commands,
|
||||||
CopyMessageToClipboard: 'gitlens.copyMessageToClipboard' as Commands,
|
CopyMessageToClipboard: 'gitlens.copyMessageToClipboard' as Commands,
|
||||||
@@ -22,7 +22,8 @@ export const Commands = {
|
|||||||
ShowQuickCommitDetails: 'gitlens.showQuickCommitDetails' as Commands,
|
ShowQuickCommitDetails: 'gitlens.showQuickCommitDetails' as Commands,
|
||||||
ShowQuickCommitFileDetails: 'gitlens.showQuickCommitFileDetails' as Commands,
|
ShowQuickCommitFileDetails: 'gitlens.showQuickCommitFileDetails' as Commands,
|
||||||
ShowQuickFileHistory: 'gitlens.showQuickFileHistory' as Commands,
|
ShowQuickFileHistory: 'gitlens.showQuickFileHistory' as Commands,
|
||||||
ShowQuickRepoHistory: 'gitlens.showQuickRepoHistory' as Commands,
|
ShowQuickBranchHistory: 'gitlens.showQuickBranchHistory' as Commands,
|
||||||
|
ShowQuickCurrentBranchHistory: 'gitlens.showQuickRepoHistory' as Commands,
|
||||||
ShowQuickRepoStatus: 'gitlens.showQuickRepoStatus' as Commands,
|
ShowQuickRepoStatus: 'gitlens.showQuickRepoStatus' as Commands,
|
||||||
ToggleBlame: 'gitlens.toggleBlame' as Commands,
|
ToggleBlame: 'gitlens.toggleBlame' as Commands,
|
||||||
ToggleCodeLens: 'gitlens.toggleCodeLens' as Commands
|
ToggleCodeLens: 'gitlens.toggleCodeLens' as Commands
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { commands, TextEditor, Uri, window } from 'vscode';
|
|||||||
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
||||||
import { GitService, GitUri, IGitLog } from '../gitService';
|
import { GitService, GitUri, IGitLog } from '../gitService';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { CommandQuickPickItem, RepoHistoryQuickPick } from '../quickPicks';
|
import { BranchesQuickPick, BranchHistoryQuickPick, CommandQuickPickItem } from '../quickPicks';
|
||||||
|
|
||||||
export class ShowQuickRepoHistoryCommand extends ActiveEditorCachedCommand {
|
export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
|
||||||
|
|
||||||
constructor(private git: GitService, private repoPath: string) {
|
constructor(private git: GitService, private repoPath: string) {
|
||||||
super(Commands.ShowQuickRepoHistory);
|
super(Commands.ShowQuickBranchHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(editor: TextEditor, uri?: Uri, branch?: string, maxCount?: number, goBackCommand?: CommandQuickPickItem, log?: IGitLog, nextPageCommand?: CommandQuickPickItem) {
|
async execute(editor: TextEditor, uri?: Uri, branch?: string, maxCount?: number, goBackCommand?: CommandQuickPickItem, log?: IGitLog, nextPageCommand?: CommandQuickPickItem) {
|
||||||
@@ -22,23 +22,35 @@ export class ShowQuickRepoHistoryCommand extends ActiveEditorCachedCommand {
|
|||||||
maxCount = this.git.config.advanced.maxQuickHistory;
|
maxCount = this.git.config.advanced.maxQuickHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
branch = branch || (await this.git.getBranch(this.git.repoPath)).name;
|
let progressCancellation = branch && BranchHistoryQuickPick.showProgress(branch);
|
||||||
|
|
||||||
const progressCancellation = RepoHistoryQuickPick.showProgress(branch);
|
|
||||||
try {
|
try {
|
||||||
const repoPath = (gitUri && gitUri.repoPath) || await this.git.getRepoPathFromUri(uri, this.repoPath);
|
const repoPath = (gitUri && gitUri.repoPath) || await this.git.getRepoPathFromUri(uri, this.repoPath);
|
||||||
if (!repoPath) return window.showWarningMessage(`Unable to show history`);
|
if (!repoPath) return window.showWarningMessage(`Unable to show branch history`);
|
||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (!branch) {
|
||||||
|
const branches = await this.git.getBranches(repoPath);
|
||||||
|
|
||||||
|
const pick = await BranchesQuickPick.show(branches, `pick a branch to show history`);
|
||||||
|
if (!pick) return undefined;
|
||||||
|
|
||||||
|
if (pick instanceof CommandQuickPickItem) {
|
||||||
|
return pick.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
branch = pick.branch.name;
|
||||||
|
if (!branch) return undefined;
|
||||||
|
|
||||||
|
progressCancellation = BranchHistoryQuickPick.showProgress(branch);
|
||||||
|
}
|
||||||
|
|
||||||
if (!log) {
|
if (!log) {
|
||||||
log = await this.git.getLogForRepo(repoPath, (gitUri && gitUri.sha) || branch, maxCount);
|
log = await this.git.getLogForRepo(repoPath, (gitUri && gitUri.sha) || branch, maxCount);
|
||||||
if (!log) return window.showWarningMessage(`Unable to show history`);
|
if (!log) return window.showWarningMessage(`Unable to show branch history`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
const pick = await RepoHistoryQuickPick.show(log, gitUri, branch, progressCancellation, goBackCommand, nextPageCommand);
|
const pick = await BranchHistoryQuickPick.show(log, gitUri, branch, progressCancellation, goBackCommand, nextPageCommand);
|
||||||
if (!pick) return undefined;
|
if (!pick) return undefined;
|
||||||
|
|
||||||
if (pick instanceof CommandQuickPickItem) {
|
if (pick instanceof CommandQuickPickItem) {
|
||||||
@@ -49,15 +61,15 @@ export class ShowQuickRepoHistoryCommand extends ActiveEditorCachedCommand {
|
|||||||
new CommandQuickPickItem({
|
new CommandQuickPickItem({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, branch, maxCount, goBackCommand, log]),
|
}, Commands.ShowQuickBranchHistory, [uri, branch, maxCount, goBackCommand, log]),
|
||||||
log);
|
log);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error('[GitLens.ShowQuickRepoHistoryCommand]', ex);
|
Logger.error('[GitLens.ShowQuickBranchHistoryCommand]', ex);
|
||||||
return window.showErrorMessage(`Unable to show history. See output channel for more details`);
|
return window.showErrorMessage(`Unable to show branch history. See output channel for more details`);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
progressCancellation.dispose();
|
progressCancellation && progressCancellation.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
|
|||||||
goBackCommand = new CommandQuickPickItem({
|
goBackCommand = new CommandQuickPickItem({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 to branch history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 to branch history`
|
||||||
}, Commands.ShowQuickRepoHistory, [new GitUri(commit.uri, commit)]);
|
}, Commands.ShowQuickCurrentBranchHistory, [new GitUri(commit.uri, commit)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pick = await CommitDetailsQuickPick.show(this.git, commit as GitLogCommit, uri, goBackCommand, repoLog);
|
const pick = await CommitDetailsQuickPick.show(this.git, commit as GitLogCommit, uri, goBackCommand, repoLog);
|
||||||
|
|||||||
29
src/commands/showQuickCurrentBranchHistory.ts
Normal file
29
src/commands/showQuickCurrentBranchHistory.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
|
import { ActiveEditorCachedCommand, Commands } from '../commands';
|
||||||
|
import { GitService } from '../gitService';
|
||||||
|
import { Logger } from '../logger';
|
||||||
|
import { CommandQuickPickItem } from '../quickPicks';
|
||||||
|
|
||||||
|
export class ShowQuickCurrentBranchHistoryCommand extends ActiveEditorCachedCommand {
|
||||||
|
|
||||||
|
constructor(private git: GitService) {
|
||||||
|
super(Commands.ShowQuickCurrentBranchHistory);
|
||||||
|
}
|
||||||
|
|
||||||
|
async execute(editor: TextEditor, uri?: Uri, goBackCommand?: CommandQuickPickItem) {
|
||||||
|
if (!(uri instanceof Uri)) {
|
||||||
|
uri = editor && editor.document && editor.document.uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const branch = (await this.git.getBranch(this.git.repoPath)).name;
|
||||||
|
|
||||||
|
return commands.executeCommand(Commands.ShowQuickBranchHistory, uri, branch, undefined, goBackCommand);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
Logger.error('[GitLens.ShowQuickCurrentBranchHistoryCommand]', ex);
|
||||||
|
return window.showErrorMessage(`Unable to show branch history. See output channel for more details`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
|
|||||||
uri = editor && editor.document && editor.document.uri;
|
uri = editor && editor.document && editor.document.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uri) return commands.executeCommand(Commands.ShowQuickRepoHistory);
|
if (!uri) return commands.executeCommand(Commands.ShowQuickCurrentBranchHistory);
|
||||||
|
|
||||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const CodeLensCommand = {
|
|||||||
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as CodeLensCommand,
|
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as CodeLensCommand,
|
||||||
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as CodeLensCommand,
|
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as CodeLensCommand,
|
||||||
ShowQuickFileHistory: Commands.ShowQuickFileHistory as CodeLensCommand,
|
ShowQuickFileHistory: Commands.ShowQuickFileHistory as CodeLensCommand,
|
||||||
ShowQuickRepoHistory: Commands.ShowQuickRepoHistory as CodeLensCommand
|
ShowQuickCurrentBranchHistory: Commands.ShowQuickCurrentBranchHistory as CodeLensCommand
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CodeLensLocation = 'all' | 'document+containers' | 'document' | 'custom' | 'none';
|
export type CodeLensLocation = 'all' | 'document+containers' | 'document' | 'custom' | 'none';
|
||||||
@@ -86,7 +86,7 @@ export const StatusBarCommand = {
|
|||||||
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as StatusBarCommand,
|
ShowQuickCommitDetails: Commands.ShowQuickCommitDetails as StatusBarCommand,
|
||||||
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as StatusBarCommand,
|
ShowQuickCommitFileDetails: Commands.ShowQuickCommitFileDetails as StatusBarCommand,
|
||||||
ShowQuickFileHistory: Commands.ShowQuickFileHistory as StatusBarCommand,
|
ShowQuickFileHistory: Commands.ShowQuickFileHistory as StatusBarCommand,
|
||||||
ShowQuickRepoHistory: Commands.ShowQuickRepoHistory as StatusBarCommand
|
ShowQuickCurrentBranchHistory: Commands.ShowQuickCurrentBranchHistory as StatusBarCommand
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IStatusBarConfig {
|
export interface IStatusBarConfig {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { CopyMessageToClipboardCommand, CopyShaToClipboardCommand } from './comm
|
|||||||
import { DiffDirectoryCommand, DiffLineWithPreviousCommand, DiffLineWithWorkingCommand, DiffWithBranchCommand, DiffWithNextCommand, DiffWithPreviousCommand, DiffWithWorkingCommand} from './commands';
|
import { DiffDirectoryCommand, DiffLineWithPreviousCommand, DiffLineWithWorkingCommand, DiffWithBranchCommand, DiffWithNextCommand, DiffWithPreviousCommand, DiffWithWorkingCommand} from './commands';
|
||||||
import { ShowBlameCommand, ToggleBlameCommand } from './commands';
|
import { ShowBlameCommand, ToggleBlameCommand } from './commands';
|
||||||
import { ShowBlameHistoryCommand, ShowFileHistoryCommand } from './commands';
|
import { ShowBlameHistoryCommand, ShowFileHistoryCommand } from './commands';
|
||||||
import { ShowLastQuickPickCommand, ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand, ShowQuickFileHistoryCommand, ShowQuickRepoHistoryCommand, ShowQuickRepoStatusCommand} from './commands';
|
import { ShowLastQuickPickCommand, ShowQuickBranchHistoryCommand, ShowQuickCurrentBranchHistoryCommand, ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand, ShowQuickFileHistoryCommand, ShowQuickRepoStatusCommand} from './commands';
|
||||||
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';
|
||||||
@@ -104,10 +104,11 @@ export async function activate(context: ExtensionContext) {
|
|||||||
context.subscriptions.push(new ShowBlameHistoryCommand(git));
|
context.subscriptions.push(new ShowBlameHistoryCommand(git));
|
||||||
context.subscriptions.push(new ShowFileHistoryCommand(git));
|
context.subscriptions.push(new ShowFileHistoryCommand(git));
|
||||||
context.subscriptions.push(new ShowLastQuickPickCommand());
|
context.subscriptions.push(new ShowLastQuickPickCommand());
|
||||||
|
context.subscriptions.push(new ShowQuickBranchHistoryCommand(git, repoPath));
|
||||||
|
context.subscriptions.push(new ShowQuickCurrentBranchHistoryCommand(git));
|
||||||
context.subscriptions.push(new ShowQuickCommitDetailsCommand(git, repoPath));
|
context.subscriptions.push(new ShowQuickCommitDetailsCommand(git, repoPath));
|
||||||
context.subscriptions.push(new ShowQuickCommitFileDetailsCommand(git));
|
context.subscriptions.push(new ShowQuickCommitFileDetailsCommand(git));
|
||||||
context.subscriptions.push(new ShowQuickFileHistoryCommand(git));
|
context.subscriptions.push(new ShowQuickFileHistoryCommand(git));
|
||||||
context.subscriptions.push(new ShowQuickRepoHistoryCommand(git, repoPath));
|
|
||||||
context.subscriptions.push(new ShowQuickRepoStatusCommand(git, repoPath));
|
context.subscriptions.push(new ShowQuickRepoStatusCommand(git, repoPath));
|
||||||
context.subscriptions.push(new ToggleCodeLensCommand(git));
|
context.subscriptions.push(new ToggleCodeLensCommand(git));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
case CodeLensCommand.ShowQuickCommitDetails: return this._applyShowQuickCommitDetailsCommand<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.ShowQuickCommitFileDetails: return this._applyShowQuickCommitFileDetailsCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
|
||||||
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
|
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
|
||||||
case CodeLensCommand.ShowQuickRepoHistory: return this._applyShowQuickRepoHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
|
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickBranchHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
|
||||||
default: return lens;
|
default: return lens;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
case CodeLensCommand.ShowQuickCommitDetails: return this._applyShowQuickCommitDetailsCommand<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.ShowQuickCommitFileDetails: return this._applyShowQuickCommitFileDetailsCommand<GitAuthorsCodeLens>(title, lens, blame);
|
||||||
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
|
case CodeLensCommand.ShowQuickFileHistory: return this._applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
|
||||||
case CodeLensCommand.ShowQuickRepoHistory: return this._applyShowQuickRepoHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
|
case CodeLensCommand.ShowQuickCurrentBranchHistory: return this._applyShowQuickBranchHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
|
||||||
default: return lens;
|
default: return lens;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,10 +389,10 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
return lens;
|
return lens;
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyShowQuickRepoHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines, commit?: GitCommit): T {
|
_applyShowQuickBranchHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines, commit?: GitCommit): T {
|
||||||
lens.command = {
|
lens.command = {
|
||||||
title: title,
|
title: title,
|
||||||
command: CodeLensCommand.ShowQuickRepoHistory,
|
command: CodeLensCommand.ShowQuickCurrentBranchHistory,
|
||||||
arguments: [Uri.file(lens.uri.fsPath)]
|
arguments: [Uri.file(lens.uri.fsPath)]
|
||||||
};
|
};
|
||||||
return lens;
|
return lens;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
export { BranchQuickPickItem, BranchesQuickPick } from './quickPicks/branches';
|
export * from './quickPicks/branches';
|
||||||
export { CommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, showQuickPickProgress } from './quickPicks/quickPicks';
|
export * from './quickPicks/quickPicks';
|
||||||
export { CommitQuickPickItem, CommitWithFileStatusQuickPickItem } from './quickPicks/gitQuickPicks';
|
export * from './quickPicks/gitQuickPicks';
|
||||||
export { OpenCommitFilesCommandQuickPickItem, OpenCommitWorkingTreeFilesCommandQuickPickItem, CommitDetailsQuickPick } from './quickPicks/commitDetails';
|
export * from './quickPicks/commitDetails';
|
||||||
export { OpenCommitFileCommandQuickPickItem, OpenCommitWorkingTreeFileCommandQuickPickItem, CommitFileDetailsQuickPick } from './quickPicks/commitFileDetails';
|
export * from './quickPicks/commitFileDetails';
|
||||||
export { FileHistoryQuickPick } from './quickPicks/fileHistory';
|
export * from './quickPicks/branchHistory';
|
||||||
export { RepoHistoryQuickPick } from './quickPicks/repoHistory';
|
export * from './quickPicks/fileHistory';
|
||||||
export { OpenStatusFileCommandQuickPickItem, OpenStatusFilesCommandQuickPickItem, RepoStatusQuickPick } from './quickPicks/repoStatus';
|
export * from './quickPicks/repoStatus';
|
||||||
@@ -6,7 +6,7 @@ import { GitUri, IGitLog } from '../gitService';
|
|||||||
import { CommitQuickPickItem } from './gitQuickPicks';
|
import { CommitQuickPickItem } from './gitQuickPicks';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';
|
||||||
|
|
||||||
export class RepoHistoryQuickPick {
|
export class BranchHistoryQuickPick {
|
||||||
|
|
||||||
static showProgress(branch: string) {
|
static showProgress(branch: string) {
|
||||||
return showQuickPickProgress(`${branch} history \u2014 search by commit message, filename, or sha`,
|
return showQuickPickProgress(`${branch} history \u2014 search by commit message, filename, or sha`,
|
||||||
@@ -27,7 +27,7 @@ export class RepoHistoryQuickPick {
|
|||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(sync) Show All Commits`,
|
label: `$(sync) Show All Commits`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
|
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
|
||||||
}, Commands.ShowQuickRepoHistory, [
|
}, Commands.ShowQuickBranchHistory, [
|
||||||
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
|
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
|
||||||
branch,
|
branch,
|
||||||
0,
|
0,
|
||||||
@@ -38,14 +38,14 @@ export class RepoHistoryQuickPick {
|
|||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(history) Show Branch History`,
|
label: `$(history) Show Branch History`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch} history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch} history`
|
||||||
}, Commands.ShowQuickRepoHistory, [
|
}, Commands.ShowQuickBranchHistory, [
|
||||||
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
|
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
|
||||||
branch,
|
branch,
|
||||||
undefined,
|
undefined,
|
||||||
new CommandQuickPickItem({
|
new CommandQuickPickItem({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, branch, log.maxCount, goBackCommand, log])
|
}, Commands.ShowQuickBranchHistory, [uri, branch, log.maxCount, goBackCommand, log])
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,14 +57,14 @@ export class RepoHistoryQuickPick {
|
|||||||
const npc = new CommandQuickPickItem({
|
const npc = new CommandQuickPickItem({
|
||||||
label: `$(arrow-right) Show Next Commits`,
|
label: `$(arrow-right) Show Next Commits`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, branch, log.maxCount, goBackCommand, undefined, nextPageCommand]);
|
}, Commands.ShowQuickBranchHistory, [uri, branch, log.maxCount, goBackCommand, undefined, nextPageCommand]);
|
||||||
|
|
||||||
const last = Iterables.last(log.commits.values());
|
const last = Iterables.last(log.commits.values());
|
||||||
|
|
||||||
previousPageCommand = new CommandQuickPickItem({
|
previousPageCommand = new CommandQuickPickItem({
|
||||||
label: `$(arrow-left) Show Previous Commits`,
|
label: `$(arrow-left) Show Previous Commits`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
|
||||||
}, Commands.ShowQuickRepoHistory, [new GitUri(uri ? uri : last.uri, last), branch, log.maxCount, goBackCommand, undefined, npc]);
|
}, Commands.ShowQuickBranchHistory, [new GitUri(uri ? uri : last.uri, last), branch, log.maxCount, goBackCommand, undefined, npc]);
|
||||||
|
|
||||||
items.splice(0, 0, previousPageCommand);
|
items.splice(0, 0, previousPageCommand);
|
||||||
}
|
}
|
||||||
@@ -79,10 +79,8 @@ export class FileHistoryQuickPick {
|
|||||||
items.splice(index, 0, new CommandQuickPickItem({
|
items.splice(index, 0, new CommandQuickPickItem({
|
||||||
label: `$(history) Show Branch History`,
|
label: `$(history) Show Branch History`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows the current branch history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows the current branch history`
|
||||||
}, Commands.ShowQuickRepoHistory,
|
}, Commands.ShowQuickCurrentBranchHistory,
|
||||||
[
|
[
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
undefined,
|
||||||
new CommandQuickPickItem({
|
new CommandQuickPickItem({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export class RepoStatusQuickPick {
|
|||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(cloud-upload)\u00a0 ${status.state.ahead} Commits ahead of \u00a0$(git-branch) ${status.upstream}`,
|
label: `$(cloud-upload)\u00a0 ${status.state.ahead} Commits ahead of \u00a0$(git-branch) ${status.upstream}`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.branch} but not \u00a0$(git-branch) ${status.upstream}`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.branch} but not \u00a0$(git-branch) ${status.upstream}`
|
||||||
}, Commands.ShowQuickRepoHistory, [
|
}, Commands.ShowQuickBranchHistory, [
|
||||||
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.upstream}..${status.branch}` }),
|
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.upstream}..${status.branch}` }),
|
||||||
status.branch,
|
status.branch,
|
||||||
0,
|
0,
|
||||||
@@ -133,7 +133,7 @@ export class RepoStatusQuickPick {
|
|||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(cloud-download)\u00a0 ${status.state.behind} Commits behind \u00a0$(git-branch) ${status.upstream}`,
|
label: `$(cloud-download)\u00a0 ${status.state.behind} Commits behind \u00a0$(git-branch) ${status.upstream}`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.upstream} but not \u00a0$(git-branch) ${status.branch} (since \u00a0$(git-commit) ${status.sha.substring(0, 8)})`
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.upstream} but not \u00a0$(git-branch) ${status.branch} (since \u00a0$(git-commit) ${status.sha.substring(0, 8)})`
|
||||||
}, Commands.ShowQuickRepoHistory, [
|
}, Commands.ShowQuickBranchHistory, [
|
||||||
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.sha}..${status.upstream}` }),
|
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.sha}..${status.upstream}` }),
|
||||||
status.upstream,
|
status.upstream,
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user