Просмотр исходного кода

Adds create branch/tag menu item to status node

main
Eric Amodio 3 лет назад
Родитель
Сommit
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()

Загрузка…
Отмена
Сохранить