diff --git a/package.json b/package.json index 4cd7f62..128b92b 100644 --- a/package.json +++ b/package.json @@ -3150,27 +3150,27 @@ }, { "command": "gitlens.browseRepoAtRevision", - "title": "Browse Repository at Revision", + "title": "Browse from Revision", "category": "GitLens", "icon": "$(folder-opened)", "enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git" }, { "command": "gitlens.browseRepoAtRevisionInNewWindow", - "title": "Browse Repository at Revision in New Window", + "title": "Browse from Revision in New Window", "category": "GitLens", "icon": "$(folder-opened)", "enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git" }, { "command": "gitlens.views.browseRepoAtRevision", - "title": "Browse Repository from Here", + "title": "Browse from Here", "category": "GitLens", "icon": "$(folder-opened)" }, { "command": "gitlens.views.browseRepoAtRevisionInNewWindow", - "title": "Browse Repository from Here in New Window", + "title": "Browse from Here in New Window", "category": "GitLens", "icon": "$(folder-opened)" }, @@ -6411,7 +6411,7 @@ { "command": "gitlens.views.openDirectoryDiffWithWorking", "when": "viewItem =~ /gitlens:(branch|tag)\\b/", - "group": "2_gitlens_quickopen@2" + "group": "3_gitlens_explore@2" }, { "command": "gitlens.views.compareWithUpstream", @@ -6561,62 +6561,32 @@ "group": "1_gitlens_actions_1@2" }, { - "command": "gitlens.views.openChangedFileDiffs", + "submenu": "gitlens/commit/openChanges", "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", "group": "2_gitlens_quickopen@1" }, { - "command": "gitlens.views.openChangedFileDiffsWithWorking", - "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", - "group": "2_gitlens_quickopen@2" - }, - { - "command": "gitlens.views.openChangedFiles", - "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", - "group": "2_gitlens_quickopen_1@1" - }, - { - "command": "gitlens.views.openChangedFileRevisions", - "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", - "group": "2_gitlens_quickopen_1@2" - }, - { "command": "gitlens.openCommitInRemote", "when": "viewItem =~ /gitlens:commit\\b/ && gitlens:hasRemotes", - "group": "2_gitlens_quickopen_2@1", + "group": "3_gitlens_explore@0", "alt": "gitlens.copyRemoteCommitUrl" }, { - "command": "gitlens.revealCommitInView", - "when": "viewItem =~ /gitlens:commit\\b/", - "group": "3_gitlens_explore@1" - }, - { "command": "gitlens.showCommitInView", "when": "viewItem =~ /gitlens:commit\\b/", "group": "3_gitlens_explore@2" }, { - "command": "gitlens.copyShaToClipboard", - "when": "viewItem =~ /gitlens:(commit|file\\b(?=.*?\\b\\+committed\\b))\\b/", - "group": "7_gitlens_cutcopypaste@2" - }, - { - "command": "gitlens.copyShaToClipboard", - "when": "viewItem =~ /gitlens:branch\\b/", - "group": "7_gitlens_cutcopypaste@2" + "command": "gitlens.revealCommitInView", + "when": "viewItem =~ /gitlens:commit\\b/", + "group": "3_gitlens_explore@3" }, { - "command": "gitlens.copyShaToClipboard", - "when": "viewItem =~ /gitlens:tag\\b/", + "submenu": "gitlens/commit/copy", + "when": "viewItem =~ /gitlens:(branch|commit|stash|tag|file\\b(?=.*?\\b\\+committed\\b))\\b/", "group": "7_gitlens_cutcopypaste@2" }, { - "command": "gitlens.copyMessageToClipboard", - "when": "viewItem =~ /gitlens:(commit|stash|file\\b(?=.*?\\b\\+committed\\b))\\b/", - "group": "7_gitlens_cutcopypaste@3" - }, - { "command": "gitlens.views.openFile", "when": "viewItem =~ /gitlens:(history:(file|line)|status:file)\\b/", "group": "inline@1" @@ -6686,73 +6656,48 @@ "group": "2_gitlens_quickopen@1" }, { - "command": "gitlens.externalDiff", + "submenu": "gitlens/commit/file/openChanges", "when": "viewItem =~ /gitlens:file\\b/", "group": "2_gitlens_quickopen@2" }, { - "command": "gitlens.views.openChangesWithWorking", - "when": "viewItem =~ /gitlens:file\\b/", - "group": "2_gitlens_quickopen@3" - }, - { "command": "gitlens.views.openFile", "when": "viewItem =~ /gitlens:(file|history:(file|line)|status:file)\\b/", - "group": "2_gitlens_quickopen_1@1" + "group": "2_gitlens_quickopen@3" }, { "command": "gitlens.views.openFileRevision", "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/", - "group": "2_gitlens_quickopen_1@2" + "group": "2_gitlens_quickopen@4" }, { "command": "gitlens.openFileInRemote", "when": "viewItem =~ /gitlens:file\\b/ && gitlens:hasRemotes", - "group": "2_gitlens_quickopen_2@1", + "group": "2_gitlens_quickopen@5", "alt": "gitlens.copyRemoteFileUrlToClipboard" }, { + "command": "gitlens.showFileHistoryInView", + "when": "view != gitlens.views.fileHistory && viewItem =~ /gitlens:file\\b/", + "group": "2_gitlens_quickopen@6" + }, + { "command": "gitlens.openCommitInRemote", "when": "viewItem =~ /gitlens:file\\b(?=.*?\\b\\+committed\\b)/ && gitlens:hasRemotes", - "group": "2_gitlens_quickopen_2@3", + "group": "3_gitlens_explore@0", "alt": "gitlens.copyRemoteCommitUrl" }, { - "command": "gitlens.views.highlightChanges", - "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/", - "group": "2_gitlens_quickopen_3@1" - }, - { - "command": "gitlens.views.highlightRevisionChanges", - "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/", - "group": "2_gitlens_quickopen_3@2" - }, - { - "command": "gitlens.showFileHistoryInView", - "when": "viewItem =~ /gitlens:file\\b/", - "group": "3_gitlens_explore@4" - }, - { - "command": "gitlens.revealCommitInView", + "command": "gitlens.showCommitInView", "when": "viewItem =~ /gitlens:file\\b(?!(:stash|:status))/", "group": "3_gitlens_explore@3" }, { - "command": "gitlens.showCommitInView", + "command": "gitlens.revealCommitInView", "when": "viewItem =~ /gitlens:file\\b(?!(:stash|:status))/", "group": "3_gitlens_explore@4" }, { - "command": "gitlens.copyRemoteCommitUrl", - "when": "viewItem =~ /gitlens:file\\b(?=.*?\\b\\+committed\\b)/ && gitlens:hasRemotes", - "group": "7_gitlens_cutcopypaste@3" - }, - { - "command": "gitlens.copyRemoteFileUrlToClipboard", - "when": "viewItem =~ /gitlens:(file\\b(?=.*?\\b\\+committed\\b)|history:(file|line)|status:file)\\b/ && gitlens:hasRemotes", - "group": "7_gitlens_cutcopypaste@4" - }, - { "command": "gitlens.views.applyChanges", "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results\\b)/", "group": "8_gitlens_actions@1" @@ -6862,14 +6807,9 @@ "group": "8_gitlens_actions@2" }, { - "command": "gitlens.views.browseRepoAtRevision", - "when": "viewItem =~ /gitlens:(branch|commit|file\\b((?=.*?\\b\\+committed\\b)|:results)|stash|tag)\\b/", - "group": "3_gitlens_explore@10" - }, - { - "command": "gitlens.views.browseRepoAtRevisionInNewWindow", + "submenu": "gitlens/commit/browse", "when": "viewItem =~ /gitlens:(branch|commit|file\\b((?=.*?\\b\\+committed\\b)|:results)|stash|tag)\\b/", - "group": "3_gitlens_explore@11" + "group": "3_gitlens_explore@1" }, { "command": "gitlens.views.push", @@ -7231,23 +7171,92 @@ "group": "1_gitlens@0" } ], - "gitlens/view/searchAndCompare/new": [ + "gitlens/commit/browse": [ { - "command": "gitlens.views.searchAndCompare.searchCommits", - "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", - "group": "navigation@10" + "command": "gitlens.views.browseRepoAtRevision", + "group": "1_gitlens@1" }, { - "command": "gitlens.views.searchAndCompare.selectForCompare", - "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", - "group": "navigation@11" + "command": "gitlens.views.browseRepoAtRevisionInNewWindow", + "group": "1_gitlens@2" + } + ], + "gitlens/commit/copy": [ + { + "command": "gitlens.copyShaToClipboard", + "when": "viewItem =~ /gitlens:(?!stash\\b)/", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.copyMessageToClipboard", + "group": "1_gitlens@2" + }, + { + "command": "gitlens.copyRemoteCommitUrl", + "when": "viewItem =~ /gitlens:(commit|file\\b(?=.*?\\b\\+committed\\b))/ && gitlens:hasRemotes", + "group": "2_gitlens@1" + }, + { + "command": "gitlens.copyRemoteFileUrlToClipboard", + "when": "viewItem =~ /gitlens:(file\\b(?=.*?\\b\\+committed\\b)|history:(file|line)|status:file)\\b/ && gitlens:hasRemotes", + "group": "2_gitlens@2" + } + ], + "gitlens/commit/openChanges": [ + { + "command": "gitlens.views.openChangedFileDiffs", + "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", + "group": "2_gitlens_quickopen@1" + }, + { + "command": "gitlens.views.openChangedFileDiffsWithWorking", + "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", + "group": "2_gitlens_quickopen@2" + }, + { + "command": "gitlens.views.openChangedFiles", + "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", + "group": "2_gitlens_quickopen_1@1" + }, + { + "command": "gitlens.views.openChangedFileRevisions", + "when": "viewItem =~ /gitlens:(commit|stash|results:files)\\b/", + "group": "2_gitlens_quickopen_1@2" + } + ], + "gitlens/commit/file/openChanges": [ + { + "command": "gitlens.externalDiff", + "group": "1_gitlens@1" + }, + { + "command": "gitlens.views.openChangesWithWorking", + "group": "1_gitlens@2" + }, + { + "command": "gitlens.diffWithRevision", + "group": "2_gitlens@1" + }, + { + "command": "gitlens.diffWithRevisionFrom", + "group": "2_gitlens@2" + }, + { + "command": "gitlens.views.highlightChanges", + "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/", + "group": "3_gitlens@1" + }, + { + "command": "gitlens.views.highlightRevisionChanges", + "when": "viewItem =~ /gitlens:file\\b((?=.*?\\b\\+committed\\b)|:results)/", + "group": "3_gitlens@2" } ], "gitlens/editor/annotations": [ { "command": "gitlens.clearFileAnnotations", "when": "gitlens:activeFileStatus =~ /blameable/ && gitlens:annotationStatus", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.toggleFileBlame", @@ -7289,7 +7298,7 @@ { "command": "gitlens.clearFileAnnotations", "when": "gitlens:activeFileStatus =~ /blameable/ && gitlens:annotationStatus", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.toggleFileBlame", @@ -7348,22 +7357,22 @@ "gitlens/editor/context/openChanges": [ { "command": "gitlens.diffWithPrevious", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.diffWithWorking", "when": "resourceScheme == gitlens", - "group": "1_gitlens@1" + "group": "1_gitlens@2" }, { "command": "gitlens.diffLineWithPrevious", "when": "editorTextFocus && gitlens:activeFileStatus =~ /blameable/", - "group": "1_gitlens@2" + "group": "1_gitlens@3" }, { "command": "gitlens.diffLineWithWorking", "when": "editorTextFocus && gitlens:activeFileStatus =~ /blameable/", - "group": "1_gitlens@3" + "group": "1_gitlens@4" }, { "command": "gitlens.diffWithRevision", @@ -7396,26 +7405,26 @@ "gitlens/editor/openChanges": [ { "command": "gitlens.diffWithPrevious", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.diffWithWorking", "when": "resourceScheme == gitlens", - "group": "1_gitlens@1" + "group": "1_gitlens@2" }, { "command": "gitlens.diffWithRevision", - "group": "2_gitlens@2" + "group": "2_gitlens@1" }, { "command": "gitlens.diffWithRevisionFrom", - "group": "2_gitlens@3" + "group": "2_gitlens@2" } ], "gitlens/explorer/openChanges": [ { "command": "gitlens.diffWithPrevious", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.diffWithRevision", @@ -7429,15 +7438,15 @@ "gitlens/scm/resourceGroup/openChanges": [ { "command": "gitlens.externalDiffAll", - "group": "1_gitlens@0" + "group": "1_gitlens@1" }, { "command": "gitlens.diffDirectoryWithHead", - "group": "1_gitlens@1" + "group": "1_gitlens@2" }, { "command": "gitlens.diffDirectory", - "group": "1_gitlens@2" + "group": "1_gitlens@3" } ], "gitlens/scm/resourceState/openChanges": [ @@ -7456,10 +7465,42 @@ "when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.compare", "group": "1_gitlens@2" } + ], + "gitlens/view/searchAndCompare/new": [ + { + "command": "gitlens.views.searchAndCompare.searchCommits", + "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", + "group": "navigation@10" + }, + { + "command": "gitlens.views.searchAndCompare.selectForCompare", + "when": "view =~ /^gitlens\\.views\\.searchAndCompare\\b/", + "group": "navigation@11" + } ] }, "submenus": [ { + "id": "gitlens/commit/browse", + "label": "Browse" + }, + { + "id": "gitlens/commit/copy", + "label": "Copy" + }, + { + "id": "gitlens/commit/openChanges", + "label": "Open Changes" + }, + { + "id": "gitlens/commit/file/copy", + "label": "Copy" + }, + { + "id": "gitlens/commit/file/openChanges", + "label": "Open Changes" + }, + { "id": "gitlens/editor/annotations", "label": "File Annotations", "icon": { diff --git a/src/commands/copyMessageToClipboard.ts b/src/commands/copyMessageToClipboard.ts index 34220f2..6eb393c 100644 --- a/src/commands/copyMessageToClipboard.ts +++ b/src/commands/copyMessageToClipboard.ts @@ -11,7 +11,9 @@ import { CommandContext, Commands, getCommandUri, + isCommandContextViewNodeHasBranch, isCommandContextViewNodeHasCommit, + isCommandContextViewNodeHasTag, } from './common'; export interface CopyMessageToClipboardCommandArgs { @@ -30,6 +32,14 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand { args = { ...args }; args.sha = context.node.commit.sha; return this.execute(context.editor, context.node.commit.uri, args); + } else if (isCommandContextViewNodeHasBranch(context)) { + args = { ...args }; + args.sha = context.node.branch.sha; + return this.execute(context.editor, context.node.uri, args); + } else if (isCommandContextViewNodeHasTag(context)) { + args = { ...args }; + args.sha = context.node.tag.sha; + return this.execute(context.editor, context.node.uri, args); } return this.execute(context.editor, context.uri, args); diff --git a/src/views/viewCommands.ts b/src/views/viewCommands.ts index 5d15a71..965d97b 100644 --- a/src/views/viewCommands.ts +++ b/src/views/viewCommands.ts @@ -9,7 +9,6 @@ import { executeEditorCommand, GitActions, OpenFileAtRevisionCommandArgs, - OpenFileOnRemoteCommandArgs, } from '../commands'; import { configuration, FileAnnotationType, ViewShowBranchComparison } from '../configuration'; import { BuiltInCommands, ContextKeys, setContext } from '../constants';