ソースを参照

Aligns commands between quickpicks and view

main
Eric Amodio 7年前
コミット
9a85f2152a
3個のファイルの変更102行の追加90行の削除
  1. +1
    -0
      CHANGELOG.md
  2. +48
    -42
      src/quickPicks/commitDetails.ts
  3. +53
    -48
      src/quickPicks/commitFileDetails.ts

+ 1
- 0
CHANGELOG.md ファイルの表示

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Changed
- Overhauls the internal way GitLens deals with Uris and revisions should be far more robust and lead to many fewer edge-case issues
- Aligns quick pick menu commands more with the `GitLens` view context menus
### Fixed
- Fixes [#220](https://github.com/eamodio/vscode-gitlens/issues/220) - Open Revision quick pick results in empty file

+ 48
- 42
src/quickPicks/commitDetails.ts ファイルの表示

@ -62,7 +62,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
f => GitUri.fromFileStatus(f, repoPath));
super(uris, item || {
label: `$(file-symlink-file) Open Changed Files`,
label: `$(file-symlink-file) Open Files`,
description: ''
// detail: `Opens all of the changed file in the working tree`
});
@ -79,7 +79,7 @@ export class OpenCommitFileRevisionsCommandQuickPickItem extends OpenFilesComman
f => GitUri.toRevisionUri(f.status === 'D' ? commit.previousFileSha : commit.sha, f, commit.repoPath));
super(uris, item || {
label: `$(file-symlink-file) Open Changed Revisions`,
label: `$(file-symlink-file) Open Revisions`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} in ${GlyphChars.Space}$(git-commit) ${commit.shortSha}`
// detail: `Opens all of the changed files in $(git-commit) ${commit.shortSha}`
});
@ -108,7 +108,8 @@ export class CommitDetailsQuickPick {
stashItem: commit as GitStashCommit,
goBackCommand: currentCommand
} as StashApplyCommandArgs
]));
])
);
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(x) Delete Stashed Changes`,
@ -119,8 +120,44 @@ export class CommitDetailsQuickPick {
stashItem: commit as GitStashCommit,
goBackCommand: currentCommand
} as StashDeleteCommandArgs
]));
])
);
}
else {
const remotes = (await git.getRemotes(commit.repoPath)).filter(r => r.provider !== undefined);
if (remotes.length) {
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
type: 'commit',
sha: commit.sha
} as RemoteResource, currentCommand));
}
}
items.splice(index++, 0, new OpenCommitFilesCommandQuickPickItem(commit));
items.splice(index++, 0, new OpenCommitFileRevisionsCommandQuickPickItem(commit));
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Compare Directory with Previous Revision`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousFileShortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffDirectory, [
commit.uri,
{
shaOrBranch1: commit.previousFileSha,
shaOrBranch2: commit.sha
} as DiffDirectoryCommandCommandArgs
])
);
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Compare Directory with Working Tree`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(file-directory) Working Tree`
}, Commands.DiffDirectory, [
uri,
{
shaOrBranch1: commit.sha
} as DiffDirectoryCommandCommandArgs
])
);
if (!stash) {
items.splice(index++, 0, new CommandQuickPickItem({
@ -131,11 +168,12 @@ export class CommitDetailsQuickPick {
{
sha: commit.sha
} as CopyShaToClipboardCommandArgs
]));
])
);
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
label: `$(clippy) Copy Commit Message to Clipboard`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.CopyMessageToClipboard, [
uri,
@ -143,38 +181,8 @@ export class CommitDetailsQuickPick {
message: commit.message,
sha: commit.sha
} as CopyMessageToClipboardCommandArgs
]));
if (!stash) {
const remotes = (await git.getRemotes(commit.repoPath)).filter(r => r.provider !== undefined);
if (remotes.length) {
items.splice(index++, 0, new OpenRemotesCommandQuickPickItem(remotes, {
type: 'commit',
sha: commit.sha
} as RemoteResource, currentCommand));
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Compare Directory with Previous Commit`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousFileShortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffDirectory, [
commit.uri,
{
shaOrBranch1: commit.previousFileSha,
shaOrBranch2: commit.sha
} as DiffDirectoryCommandCommandArgs
]));
}
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Compare Directory with Working Tree`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(file-directory) Working Tree`
}, Commands.DiffDirectory, [
uri,
{
shaOrBranch1: commit.sha
} as DiffDirectoryCommandCommandArgs
]));
])
);
items.splice(index++, 0, new CommandQuickPickItem({
label: `Changed Files`,
@ -187,10 +195,8 @@ export class CommitDetailsQuickPick {
sha: commit.sha,
goBackCommand
} as ShowQuickCommitDetailsCommandArgs
]));
items.push(new OpenCommitFilesCommandQuickPickItem(commit));
items.push(new OpenCommitFileRevisionsCommandQuickPickItem(commit));
])
);
if (goBackCommand) {
items.splice(0, 0, goBackCommand);

+ 53
- 48
src/quickPicks/commitFileDetails.ts ファイルの表示

@ -66,65 +66,30 @@ export class CommitFileDetailsQuickPick {
await commit.resolvePreviousFileSha(git);
if (!stash) {
if (commit.previousFileShortSha) {
items.push(new CommandQuickPickItem({
label: `$(git-commit) Show Commit Details`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickCommitDetails, [
commit.toGitUri(),
label: `$(git-compare) Open Changes`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousFileShortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffWithPrevious, [
commit.uri,
{
commit,
sha: commit.sha,
goBackCommand: currentCommand
} as ShowQuickCommitDetailsCommandArgs
]));
if (commit.previousFileShortSha) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare File with Previous Revision`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousFileShortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffWithPrevious, [
commit.uri,
{
commit
} as DiffWithPreviousCommandArgs
]));
}
commit
} as DiffWithPreviousCommandArgs
])
);
}
if (commit.workingFileName) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare File with Working Revision`,
label: `$(git-compare) Open Changes with Working Tree`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(file-text) ${workingName}`
}, Commands.DiffWithWorking, [
Uri.file(path.resolve(commit.repoPath, commit.workingFileName)),
{
commit
} as DiffWithWorkingCommandArgs
]));
}
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [
uri,
{
sha: commit.sha
} as CopyShaToClipboardCommandArgs
]));
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.CopyMessageToClipboard, [
uri,
{
message: commit.message,
sha: commit.sha
} as CopyMessageToClipboardCommandArgs
]));
])
);
}
if (commit.workingFileName && commit.status !== 'D') {
@ -142,6 +107,7 @@ export class CommitFileDetailsQuickPick {
branch: branch!.name
} as RemoteResource, currentCommand));
}
if (!stash) {
items.push(new OpenRemotesCommandQuickPickItem(remotes, {
type: 'revision',
@ -151,6 +117,45 @@ export class CommitFileDetailsQuickPick {
}
}
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [
uri,
{
sha: commit.sha
} as CopyShaToClipboardCommandArgs
])
);
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit Message to Clipboard`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.CopyMessageToClipboard, [
uri,
{
message: commit.message,
sha: commit.sha
} as CopyMessageToClipboardCommandArgs
]));
}
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(git-commit) Show Commit Details`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickCommitDetails, [
commit.toGitUri(),
{
commit,
sha: commit.sha,
goBackCommand: currentCommand
} as ShowQuickCommitDetailsCommandArgs
])
);
}
if (commit.workingFileName) {
items.push(new CommandQuickPickItem({
label: `$(history) Show File History`,
@ -282,7 +287,7 @@ export class CommitFileDetailsQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: `${commit.getFormattedPath()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${isUncommitted ? `Uncommitted ${GlyphChars.ArrowRightHollow} ` : '' }${commit.shortSha} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.author}, ${commit.fromNow()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.message}`,
placeHolder: `${commit.getFormattedPath()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${isUncommitted ? `Uncommitted ${GlyphChars.ArrowRightHollow} ` : ''}${commit.shortSha} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.author}, ${commit.fromNow()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.message}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item as KeyCommand);

読み込み中…
キャンセル
保存