diff --git a/src/commands/quickPickItems.ts b/src/commands/quickPickItems.ts index 0a2d44c..0562eec 100644 --- a/src/commands/quickPickItems.ts +++ b/src/commands/quickPickItems.ts @@ -27,7 +27,7 @@ export class CommitQuickPickItem implements QuickPickItem { constructor(public commit: GitCommit, descriptionSuffix: string = '') { this.label = `${commit.author}, ${moment(commit.date).fromNow()}`; - this.description = `$(git-commit) ${commit.sha}${descriptionSuffix}`; + this.description = `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha}${descriptionSuffix}`; this.detail = commit.message; } } diff --git a/src/commands/quickPicks.ts b/src/commands/quickPicks.ts index 9646604..098b555 100644 --- a/src/commands/quickPicks.ts +++ b/src/commands/quickPicks.ts @@ -5,38 +5,52 @@ import { Commands } from '../constants'; import { GitCommit, GitUri, IGitLog } from '../gitProvider'; import { CommandQuickPickItem, CommitQuickPickItem, FileQuickPickItem } from './quickPickItems'; import * as moment from 'moment'; +import * as path from 'path'; export class CommitQuickPick { static async show(commit: GitCommit, workingFileName: string, uri: Uri, currentCommand?: CommandQuickPickItem, goBackCommand?: CommandQuickPickItem, options: { showFileHistory?: boolean } = {}): Promise { - const items: CommandQuickPickItem[] = [ - new CommandQuickPickItem({ - label: `$(diff) Compare with Working Tree`, - description: `$(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingFileName || commit.fileName}` - }, Commands.DiffWithWorking, [uri, commit]) - ]; + const items: CommandQuickPickItem[] = []; if (commit.previousSha) { items.push(new CommandQuickPickItem({ - label: `$(diff) Compare with Previous Commit`, - description: `$(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}` + label: `$(git-compare) Compare with Previous Commit`, + description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.sha}` }, Commands.DiffWithPrevious, [commit.uri, commit])); } - if (options.showFileHistory) { - items.push(new CommandQuickPickItem({ - label: `$(versions) Show Previous Commit History`, - description: `\u2022 ${commit.fileName}`, - detail: `Shows the previous commit history starting at $(git-commit) ${commit.sha}` - }, Commands.ShowQuickFileHistory, [new GitUri(commit.uri, commit), undefined, undefined, currentCommand])); + items.push(new CommandQuickPickItem({ + label: `$(git-compare) Compare with Working Tree`, + description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingFileName || commit.fileName}` + }, Commands.DiffWithWorking, [uri, commit])); + + items.push(new CommandQuickPickItem({ + label: `$(clippy) Copy Commit Sha to Clipboard`, + description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha}` + }, Commands.CopyShaToClipboard, [uri, commit.sha])); + + items.push(new CommandQuickPickItem({ + label: `$(diff) Show Changed Files`, + description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.sha}`, + detail: `Shows all the changed files in commit $(git-commit) ${commit.sha}` + }, Commands.ShowQuickCommitDetails, [new GitUri(commit.uri, commit), commit.sha, undefined, currentCommand])); + if (options.showFileHistory) { + const fileName = path.basename(commit.fileName); + fileName; if (workingFileName) { items.push(new CommandQuickPickItem({ label: `$(versions) Show Commit History`, - description: `\u2022 ${commit.fileName}`, - detail: `Shows the commit history starting at the most recent commit` + description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.fileName}`, + detail: `Shows the commit history of the file, starting at the most recent commit` }, Commands.ShowQuickFileHistory, [commit.uri, undefined, undefined, currentCommand])); } + + items.push(new CommandQuickPickItem({ + label: `$(versions) Show Previous Commit History`, + description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.fileName}`, + detail: `Shows the previous commit history of the file, starting at $(git-commit) ${commit.sha}` + }, Commands.ShowQuickFileHistory, [new GitUri(commit.uri, commit), undefined, undefined, currentCommand])); } if (goBackCommand) { @@ -78,7 +92,7 @@ export class FileCommitsQuickPick { if (maxCount !== 0 && items.length >= defaultMaxCount) { items.splice(0, 0, new CommandQuickPickItem({ label: `$(sync) Show All Commits`, - description: `\u2014 Currently only showing the first ${defaultMaxCount} commits`, + description: `\u00a0 \u2014 \u00a0\u00a0 Currently only showing the first ${defaultMaxCount} commits`, detail: `This may take a while` }, Commands.ShowQuickFileHistory, [uri, 0, undefined, goBackCommand])); } @@ -115,7 +129,7 @@ export class RepoCommitsQuickPick { if (maxCount !== 0 && items.length >= defaultMaxCount) { items.splice(0, 0, new CommandQuickPickItem({ label: `$(sync) Show All Commits`, - description: `\u2014 Currently only showing the first ${defaultMaxCount} commits`, + description: `\u00a0 \u2014 \u00a0\u00a0 Currently only showing the first ${defaultMaxCount} commits`, detail: `This may take a while` }, Commands.ShowQuickRepoHistory, [uri, 0, undefined, goBackCommand])); }