浏览代码

Adds create branch/tag menu item to status node

main
Eric Amodio 3 年前
父节点
当前提交
0f92aadf21
共有 2 个文件被更改,包括 36 次插入5 次删除
  1. +17
    -1
      package.json
  2. +19
    -4
      src/views/viewCommands.ts

+ 17
- 1
package.json 查看文件

@ -8437,9 +8437,25 @@
"group": "1_gitlens_actions@3"
},
{
"command": "gitlens.views.createBranch",
"when": "!gitlens:readonly && viewItem =~ /gitlens:status:upstream/",
"group": "1_gitlens_secondary_actions@1"
},
{
"command": "gitlens.views.createTag",
"when": "!gitlens:readonly && viewItem =~ /gitlens:status:upstream/",
"group": "1_gitlens_secondary_actions@2"
},
{
"command": "gitlens.views.createPullRequest",
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
"group": "1_gitlens_actions@4"
"group": "1_gitlens_secondary_actions@3"
},
{
"command": "gitlens.openBranchOnRemote",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status:upstream:(?!none)/",
"group": "2_gitlens_quickopen@1",
"alt": "gitlens.copyRemoteBranchUrl"
},
{
"command": "gitlens.views.dismissNode",

+ 19
- 4
src/views/viewCommands.ts 查看文件

@ -280,8 +280,13 @@ export class ViewCommands {
}
@debug()
private async createBranch(node?: ViewRefNode | BranchesNode) {
let from = node instanceof ViewRefNode ? node?.ref : undefined;
private async createBranch(node?: ViewRefNode | BranchesNode | BranchTrackingStatusNode) {
let from =
node instanceof ViewRefNode
? node?.ref
: node instanceof BranchTrackingStatusNode
? node.branch
: undefined;
if (from == null) {
const branch = await Container.git.getBranch(node?.repoPath ?? (await Container.git.getActiveRepoPath()));
from = branch;
@ -323,8 +328,18 @@ export class ViewCommands {
}
@debug()
private createTag(node?: ViewRefNode | TagsNode) {
return GitActions.Tag.create(node?.repoPath, node instanceof ViewRefNode ? node?.ref : undefined);
private async createTag(node?: ViewRefNode | TagsNode | BranchTrackingStatusNode) {
let from =
node instanceof ViewRefNode
? node?.ref
: node instanceof BranchTrackingStatusNode
? node.branch
: undefined;
if (from == null) {
const branch = await Container.git.getBranch(node?.repoPath ?? (await Container.git.getActiveRepoPath()));
from = branch;
}
return GitActions.Tag.create(node?.repoPath, from);
}
@debug()

正在加载...
取消
保存