Pārlūkot izejas kodu

Add publish context menu action to local branches in graph (#2619)

main
Ramin Tadayon pirms 1 gada
revīziju iesūtīja GitHub
vecāks
revīzija
ab31b2b397
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
2 mainītis faili ar 27 papildinājumiem un 0 dzēšanām
  1. +16
    -0
      package.json
  2. +11
    -0
      src/plus/webviews/graph/graphWebview.ts

+ 16
- 0
package.json Parādīt failu

@ -6975,6 +6975,13 @@
"enablement": "!operationInProgress"
},
{
"command": "gitlens.graph.publishBranch",
"title": "Publish Branch",
"category": "GitLens",
"icon": "$(cloud-upload)",
"enablement": "!operationInProgress"
},
{
"command": "gitlens.graph.rebaseOntoBranch",
"title": "Rebase Current Branch onto Branch...",
"category": "GitLens",
@ -9181,6 +9188,10 @@
"when": "false"
},
{
"command": "gitlens.graph.publishBranch",
"when": "false"
},
{
"command": "gitlens.graph.rebaseOntoBranch",
"when": "false"
},
@ -11936,6 +11947,11 @@
"alt": "gitlens.copyRemoteBranchUrl"
},
{
"command": "gitlens.graph.publishBranch",
"when": "gitlens:hasRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && webviewItem =~ /gitlens:branch\\b(?!.*?\\b\\+remote\\b)(?!.*?\\b\\+tracking\\b)/",
"group": "8_gitlens_actions@13"
},
{
"command": "gitlens.graph.cherryPick",
"when": "!gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && webviewItem =~ /gitlens:commit\\b(?!.*?\\b\\+current\\b)/",
"group": "1_gitlens_actions@1"

+ 11
- 0
src/plus/webviews/graph/graphWebview.ts Parādīt failu

@ -308,6 +308,7 @@ export class GraphWebviewProvider implements WebviewProvider {
registerCommand('gitlens.graph.push', this.push, this),
registerCommand('gitlens.graph.pull', this.pull, this),
registerCommand('gitlens.graph.fetch', this.fetch, this),
registerCommand('gitlens.graph.publishBranch', this.publishBranch, this),
registerCommand('gitlens.graph.switchToAnotherBranch', this.switchToAnother, this),
registerCommand('gitlens.graph.createBranch', this.createBranch, this),
@ -2018,6 +2019,16 @@ export class GraphWebviewProvider implements WebviewProvider {
}
@debug()
private publishBranch(item?: GraphItemContext) {
if (isGraphItemRefContext(item, 'branch')) {
const { ref } = item.webviewItemValue;
return RepoActions.push(ref.repoPath, undefined, ref);
}
return Promise.resolve();
}
@debug()
private rebase(item?: GraphItemContext) {
const ref = this.getGraphItemRef(item);
if (ref == null) return Promise.resolve();

Notiek ielāde…
Atcelt
Saglabāt