mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Adds icons to quickpick commands
Adds file history choices to commit quickpick Adds repo history choice to file history quickpick Adds commit message to quickpick placeholder in a few places
This commit is contained in:
@@ -5,8 +5,9 @@ import { GitCommit, GitUri } from '../gitProvider';
|
|||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export interface BackQuickPickItem extends QuickPickItem {
|
export interface CommandQuickPickItem extends QuickPickItem {
|
||||||
command: Commands;
|
command: Commands;
|
||||||
|
args?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommitQuickPickItem implements QuickPickItem {
|
export class CommitQuickPickItem implements QuickPickItem {
|
||||||
@@ -22,10 +23,6 @@ export class CommitQuickPickItem implements QuickPickItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CompareQuickPickItem extends QuickPickItem {
|
|
||||||
command: Commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FileQuickPickItem implements QuickPickItem {
|
export class FileQuickPickItem implements QuickPickItem {
|
||||||
|
|
||||||
label: string;
|
label: string;
|
||||||
@@ -48,7 +45,7 @@ export class ShowAllCommitsQuickPickItem implements QuickPickItem {
|
|||||||
detail: string;
|
detail: string;
|
||||||
|
|
||||||
constructor(maxItems: number) {
|
constructor(maxItems: number) {
|
||||||
this.label = `\u21BB Show All Commits`;
|
this.label = `$(sync) Show Full History`;
|
||||||
this.description = `\u2014 Currently only showing the first ${maxItems} commits`;
|
this.description = `\u2014 Currently only showing the first ${maxItems} commits`;
|
||||||
this.detail = `This may take a while`;
|
this.detail = `This may take a while`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { EditorCommand } from './commands';
|
|||||||
import { Commands } from '../constants';
|
import { Commands } from '../constants';
|
||||||
import GitProvider, { GitUri } from '../gitProvider';
|
import GitProvider, { GitUri } from '../gitProvider';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { BackQuickPickItem, CommitQuickPickItem, CompareQuickPickItem, FileQuickPickItem } from './quickPickItems';
|
import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem } from './quickPickItems';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
||||||
@@ -43,10 +43,10 @@ export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const log = await this.git.getLogForRepo(repoPath, sha, 0);
|
let log = await this.git.getLogForRepo(repoPath, sha, 0);
|
||||||
if (!log) return window.showWarningMessage(`Unable to show commit details`);
|
if (!log) return window.showWarningMessage(`Unable to show commit details`);
|
||||||
|
|
||||||
const commit = Iterables.first(log.commits.values());
|
let commit = Iterables.first(log.commits.values());
|
||||||
const commitPick = new CommitQuickPickItem(commit, ` \u2014 ${commit.fileName}`);
|
const commitPick = new CommitQuickPickItem(commit, ` \u2014 ${commit.fileName}`);
|
||||||
const files = commitPick.commit.fileName
|
const files = commitPick.commit.fileName
|
||||||
.split(', ')
|
.split(', ')
|
||||||
@@ -56,52 +56,65 @@ export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
|||||||
const filePick = await window.showQuickPick(files, {
|
const filePick = await window.showQuickPick(files, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
placeHolder: `${commitPick.commit.sha} \u2022 ${commitPick.commit.author}, ${moment(commitPick.commit.date).fromNow()}`
|
placeHolder: `${commitPick.commit.sha} \u2022 ${commitPick.commit.author}, ${moment(commitPick.commit.date).fromNow()} \u2022 ${commitPick.commit.message}`
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
if (filePick) {
|
if (!filePick) return undefined;
|
||||||
// Get the most recent commit -- so that we can find the real working filename if there was a rename
|
|
||||||
const workingCommit = await this.git.findMostRecentCommitForFile(filePick.uri.fsPath, filePick.sha);
|
|
||||||
|
|
||||||
const log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha, undefined, undefined, 2);
|
// Get the most recent commit -- so that we can find the real working filename if there was a rename
|
||||||
if (!log) return window.showWarningMessage(`Unable to open diff`);
|
const workingCommit = await this.git.findMostRecentCommitForFile(filePick.uri.fsPath, filePick.sha);
|
||||||
|
|
||||||
const commit = Iterables.find(log.commits.values(), c => c.sha === commitPick.commit.sha);
|
log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha, undefined, undefined, 2);
|
||||||
|
if (!log) return window.showWarningMessage(`Unable to open diff`);
|
||||||
|
|
||||||
let command: Commands | undefined = Commands.DiffWithWorking;
|
commit = Iterables.find(log.commits.values(), c => c.sha === commitPick.commit.sha);
|
||||||
const items: CompareQuickPickItem[] = [
|
|
||||||
{
|
|
||||||
label: `Compare with Working Tree`,
|
|
||||||
description: `\u2022 ${commit.sha} $(git-compare) ${(workingCommit || commit).fileName}`,
|
|
||||||
command: Commands.DiffWithWorking
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
if (commit.previousSha) {
|
const items: CommandQuickPickItem[] = [
|
||||||
items.push({
|
{
|
||||||
label: `Compare with Previous Commit`,
|
label: `$(diff) Compare with Working Tree`,
|
||||||
description: `\u2022 ${commit.previousSha} $(git-compare) ${commit.sha}`,
|
description: `$(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${(workingCommit || commit).fileName}`,
|
||||||
command: Commands.DiffWithPrevious
|
command: Commands.DiffWithWorking,
|
||||||
});
|
args: [commit.uri, commit]
|
||||||
}
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (commit.previousSha) {
|
||||||
items.push({
|
items.push({
|
||||||
label: `go back \u21A9`,
|
label: `$(diff) Compare with Previous Commit`,
|
||||||
description: null,
|
description: `$(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}`,
|
||||||
command: Commands.ShowQuickCommitDetails
|
command: Commands.DiffWithPrevious,
|
||||||
} as BackQuickPickItem);
|
args: [commit.uri, commit]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const comparePick = await window.showQuickPick(items, {
|
items.push({
|
||||||
matchOnDescription: true,
|
label: `$(versions) Show History of ${commit.fileName}`,
|
||||||
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()}`
|
description: `\u2022 since $(git-commit) ${commit.sha}`,
|
||||||
} as QuickPickOptions);
|
command: Commands.ShowQuickFileHistory,
|
||||||
|
args: [new GitUri(commit.uri, commit)]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
command = comparePick ? comparePick.command : undefined;
|
items.push({
|
||||||
|
label: `$(versions) Show Full History of ${commit.fileName}`,
|
||||||
|
command: Commands.ShowQuickFileHistory,
|
||||||
|
description: `\u2022 this could fail if the file was renamed`,
|
||||||
|
args: [commit.uri] // TODO: This won't work for renames
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
if (command) {
|
items.push({
|
||||||
if (command === Commands.ShowQuickCommitDetails) return commands.executeCommand(command, uri), sha;
|
label: `$(reply) go back \u21A9`,
|
||||||
return commands.executeCommand(command, commit.uri, commit);
|
description: null,
|
||||||
}
|
command: Commands.ShowQuickCommitDetails,
|
||||||
|
args: [uri]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
|
const commandPick = await window.showQuickPick(items, {
|
||||||
|
matchOnDescription: true,
|
||||||
|
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`
|
||||||
|
} as QuickPickOptions);
|
||||||
|
|
||||||
|
if (commandPick) {
|
||||||
|
return commands.executeCommand(commandPick.command, ...(commandPick.args || []));
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { EditorCommand } from './commands';
|
|||||||
import { Commands } from '../constants';
|
import { Commands } from '../constants';
|
||||||
import GitProvider, { GitUri } from '../gitProvider';
|
import GitProvider, { GitUri } from '../gitProvider';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { BackQuickPickItem, CommitQuickPickItem, CompareQuickPickItem, ShowAllCommitsQuickPickItem } from './quickPickItems';
|
import { CommandQuickPickItem, CommitQuickPickItem, ShowAllCommitsQuickPickItem } from './quickPickItems';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export default class ShowQuickFileHistoryCommand extends EditorCommand {
|
export default class ShowQuickFileHistoryCommand extends EditorCommand {
|
||||||
@@ -31,60 +31,72 @@ export default class ShowQuickFileHistoryCommand extends EditorCommand {
|
|||||||
if (!log) return window.showWarningMessage(`Unable to show file history. File is probably not under source control`);
|
if (!log) return window.showWarningMessage(`Unable to show file history. File is probably not under source control`);
|
||||||
|
|
||||||
const commits = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))) as QuickPickItem[];
|
const commits = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))) as QuickPickItem[];
|
||||||
let placeHolderSuffix = '';
|
|
||||||
if (maxCount !== 0 && commits.length === this.git.config.advanced.maxQuickHistory) {
|
if (maxCount !== 0 && commits.length === this.git.config.advanced.maxQuickHistory) {
|
||||||
placeHolderSuffix = ` \u2014 Only showing the first ${this.git.config.advanced.maxQuickHistory} commits`;
|
commits.splice(0, 0, new ShowAllCommitsQuickPickItem(this.git.config.advanced.maxQuickHistory));
|
||||||
commits.push(new ShowAllCommitsQuickPickItem(this.git.config.advanced.maxQuickHistory));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commits.splice(0, 0, {
|
||||||
|
label: `$(repo) Show Repository History`,
|
||||||
|
command: Commands.ShowQuickRepoHistory
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
const pick = await window.showQuickPick(commits, {
|
const pick = await window.showQuickPick(commits, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
placeHolder: `${Iterables.first(log.commits.values()).fileName}${placeHolderSuffix}`
|
placeHolder: `${Iterables.first(log.commits.values()).fileName}`
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
if (!pick) return undefined;
|
if (!pick) return undefined;
|
||||||
|
|
||||||
if (pick instanceof ShowAllCommitsQuickPickItem) {
|
if (pick instanceof ShowAllCommitsQuickPickItem) {
|
||||||
return commands.executeCommand(Commands.ShowQuickFileHistory, uri, 0);
|
return commands.executeCommand(Commands.ShowQuickFileHistory, uri, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(pick instanceof CommitQuickPickItem)) {
|
||||||
|
const commandPick = pick && pick as CommandQuickPickItem;
|
||||||
|
if (commandPick) {
|
||||||
|
return commands.executeCommand(commandPick.command, ...(commandPick.args || []));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const commitPick = pick as CommitQuickPickItem;
|
const commitPick = pick as CommitQuickPickItem;
|
||||||
const commit = commitPick.commit;
|
const commit = commitPick.commit;
|
||||||
|
|
||||||
let command: Commands | undefined = Commands.DiffWithWorking;
|
const items: CommandQuickPickItem[] = [
|
||||||
const items: (CompareQuickPickItem | BackQuickPickItem)[] = [
|
|
||||||
{
|
{
|
||||||
label: `Compare with Working Tree`,
|
label: `$(diff) Compare with Working Tree`,
|
||||||
description: `\u2022 ${commit.sha} $(git-compare) ${commit.fileName}`,
|
description: `$(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${commit.fileName}`,
|
||||||
command: Commands.DiffWithWorking
|
command: Commands.DiffWithWorking,
|
||||||
|
args: [commit.uri, commit]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
if (commit.previousSha) {
|
if (commit.previousSha) {
|
||||||
items.push({
|
items.push({
|
||||||
label: `Compare with Previous Commit`,
|
label: `$(diff) Compare with Previous Commit`,
|
||||||
description: `\u2022 ${commit.previousSha} $(git-compare) ${commit.sha}`,
|
description: `$(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}`,
|
||||||
command: Commands.DiffWithPrevious
|
command: Commands.DiffWithPrevious,
|
||||||
|
args: [commit.uri, commit]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: null,
|
description: null,
|
||||||
command: Commands.ShowQuickFileHistory
|
command: Commands.ShowQuickFileHistory,
|
||||||
} as BackQuickPickItem);
|
args: [uri, maxCount]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
const comparePick = await window.showQuickPick(items, {
|
const commandPick = await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()}`
|
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
command = comparePick ? comparePick.command : undefined;
|
if (commandPick) {
|
||||||
|
return commands.executeCommand(commandPick.command, ...(commandPick.args || []));
|
||||||
if (command) {
|
|
||||||
if (command === Commands.ShowQuickFileHistory) return commands.executeCommand(command, uri, maxCount);
|
|
||||||
return commands.executeCommand(command, uri, commit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error('[GitLens.ShowQuickFileHistoryCommand]', 'getLogLocations', ex);
|
Logger.error('[GitLens.ShowQuickFileHistoryCommand]', 'getLogLocations', ex);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Command } from './commands';
|
|||||||
import { Commands } from '../constants';
|
import { Commands } from '../constants';
|
||||||
import GitProvider, { GitUri } from '../gitProvider';
|
import GitProvider, { GitUri } from '../gitProvider';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { BackQuickPickItem, CommitQuickPickItem, CompareQuickPickItem, FileQuickPickItem, ShowAllCommitsQuickPickItem } from './quickPickItems';
|
import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem, ShowAllCommitsQuickPickItem } from './quickPickItems';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export default class ShowQuickRepoHistoryCommand extends Command {
|
export default class ShowQuickRepoHistoryCommand extends Command {
|
||||||
@@ -43,7 +43,7 @@ export default class ShowQuickRepoHistoryCommand extends Command {
|
|||||||
|
|
||||||
if (!repoPath) return window.showWarningMessage(`Unable to show repository history`);
|
if (!repoPath) return window.showWarningMessage(`Unable to show repository history`);
|
||||||
|
|
||||||
const log = await this.git.getLogForRepo(repoPath, undefined, maxCount);
|
let log = await this.git.getLogForRepo(repoPath, undefined, maxCount);
|
||||||
if (!log) return window.showWarningMessage(`Unable to show repository history`);
|
if (!log) return window.showWarningMessage(`Unable to show repository history`);
|
||||||
|
|
||||||
const commits = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c, ` \u2014 ${c.fileName}`))) as QuickPickItem[];
|
const commits = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c, ` \u2014 ${c.fileName}`))) as QuickPickItem[];
|
||||||
@@ -70,7 +70,7 @@ export default class ShowQuickRepoHistoryCommand extends Command {
|
|||||||
commitPick = pick as CommitQuickPickItem;
|
commitPick = pick as CommitQuickPickItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
const files: (FileQuickPickItem | BackQuickPickItem)[] = commitPick.commit.fileName
|
const files: (FileQuickPickItem | CommandQuickPickItem)[] = commitPick.commit.fileName
|
||||||
.split(', ')
|
.split(', ')
|
||||||
.filter(_ => !!_)
|
.filter(_ => !!_)
|
||||||
.map(f => new FileQuickPickItem(commitPick.commit, f));
|
.map(f => new FileQuickPickItem(commitPick.commit, f));
|
||||||
@@ -78,8 +78,9 @@ export default class ShowQuickRepoHistoryCommand extends Command {
|
|||||||
files.push({
|
files.push({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: null,
|
description: null,
|
||||||
command: Commands.ShowQuickRepoHistory
|
command: Commands.ShowQuickRepoHistory,
|
||||||
} as BackQuickPickItem);
|
args: [uri, maxCount]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
pick = await window.showQuickPick(files, {
|
pick = await window.showQuickPick(files, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
@@ -87,55 +88,70 @@ export default class ShowQuickRepoHistoryCommand extends Command {
|
|||||||
placeHolder: `${commitPick.commit.sha} \u2022 ${commitPick.commit.author}, ${moment(commitPick.commit.date).fromNow()}`
|
placeHolder: `${commitPick.commit.sha} \u2022 ${commitPick.commit.author}, ${moment(commitPick.commit.date).fromNow()}`
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
const command = pick && (pick as BackQuickPickItem).command;
|
if (!pick) return undefined;
|
||||||
if (command) {
|
|
||||||
return commands.executeCommand(command, uri, maxCount);
|
if (!(pick instanceof FileQuickPickItem)) {
|
||||||
|
const commandPick = pick && pick as CommandQuickPickItem;
|
||||||
|
if (commandPick) {
|
||||||
|
return commands.executeCommand(commandPick.command, ...(commandPick.args || []));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filePick = pick as FileQuickPickItem;
|
const filePick = pick as FileQuickPickItem;
|
||||||
if (filePick) {
|
// Get the most recent commit -- so that we can find the real working filename if there was a rename
|
||||||
// Get the most recent commit -- so that we can find the real working filename if there was a rename
|
const workingCommit = await this.git.findMostRecentCommitForFile(filePick.uri.fsPath, filePick.sha);
|
||||||
const workingCommit = await this.git.findMostRecentCommitForFile(filePick.uri.fsPath, filePick.sha);
|
|
||||||
|
|
||||||
const log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha, undefined, undefined, 2);
|
log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha, undefined, undefined, 2);
|
||||||
if (!log) return window.showWarningMessage(`Unable to open diff`);
|
if (!log) return window.showWarningMessage(`Unable to open diff`);
|
||||||
|
|
||||||
const commit = Iterables.find(log.commits.values(), c => c.sha === commitPick.commit.sha);
|
const commit = Iterables.find(log.commits.values(), c => c.sha === commitPick.commit.sha);
|
||||||
|
|
||||||
let command: Commands | undefined = Commands.DiffWithWorking;
|
const items: CommandQuickPickItem[] = [
|
||||||
const items: CompareQuickPickItem[] = [
|
{
|
||||||
{
|
label: `$(diff) Compare with Working Tree`,
|
||||||
label: `Compare with Working Tree`,
|
description: `$(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${(workingCommit || commit).fileName}`,
|
||||||
description: `\u2022 ${commit.sha} $(git-compare) ${(workingCommit || commit).fileName}`,
|
command: Commands.DiffWithWorking,
|
||||||
command: Commands.DiffWithWorking
|
args: [commit.uri, commit]
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
if (commit.previousSha) {
|
|
||||||
items.push({
|
|
||||||
label: `Compare with Previous Commit`,
|
|
||||||
description: `\u2022 ${commit.previousSha} $(git-compare) ${commit.sha}`,
|
|
||||||
command: Commands.DiffWithPrevious
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (commit.previousSha) {
|
||||||
items.push({
|
items.push({
|
||||||
label: `go back \u21A9`,
|
label: `$(diff) Compare with Previous Commit`,
|
||||||
description: null,
|
description: `$(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}`,
|
||||||
command: Commands.ShowQuickRepoHistory
|
command: Commands.DiffWithPrevious,
|
||||||
} as BackQuickPickItem);
|
args: [commit.uri, commit]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const comparePick = await window.showQuickPick(items, {
|
items.push({
|
||||||
matchOnDescription: true,
|
label: `$(versions) Show History of ${commit.fileName}`,
|
||||||
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()}`
|
description: `\u2022 since $(git-commit) ${commit.sha}`,
|
||||||
} as QuickPickOptions);
|
command: Commands.ShowQuickFileHistory,
|
||||||
|
args: [new GitUri(commit.uri, commit)]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
command = comparePick ? comparePick.command : undefined;
|
items.push({
|
||||||
|
label: `$(versions) Show Full History of ${commit.fileName}`,
|
||||||
|
description: `\u2022 this could fail if the file was renamed`,
|
||||||
|
command: Commands.ShowQuickFileHistory,
|
||||||
|
args: [commit.uri] // TODO: This won't work for renames
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
if (command) {
|
items.push({
|
||||||
if (command === Commands.ShowQuickRepoHistory) return commands.executeCommand(command, uri, maxCount, commitPick);
|
label: `go back \u21A9`,
|
||||||
return commands.executeCommand(command, commit.uri, commit);
|
description: null,
|
||||||
}
|
command: Commands.ShowQuickRepoHistory,
|
||||||
|
args: [uri, maxCount, commitPick]
|
||||||
|
} as CommandQuickPickItem);
|
||||||
|
|
||||||
|
const commandPick = await window.showQuickPick(items, {
|
||||||
|
matchOnDescription: true,
|
||||||
|
placeHolder: `${commit.fileName} \u2022 ${commit.sha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`
|
||||||
|
} as QuickPickOptions);
|
||||||
|
|
||||||
|
if (commandPick) {
|
||||||
|
return commands.executeCommand(commandPick.command, ...(commandPick.args || []));
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user