Browse Source

Adds publish repository command

main
Eric Amodio 4 years ago
parent
commit
1e0bcfac29
4 changed files with 27 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +16
    -1
      package.json
  3. +1
    -0
      src/constants.ts
  4. +9
    -0
      src/views/viewCommands.ts

+ 1
- 0
CHANGELOG.md View File

@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- _Toggles the file heatmap_
- _Toggles the file changes since before the commit_
- _Toggles the file changes from the commit_
- Adds _Publish Repository_ command (`gitlens.publishRepository`) to publish the repository to a remote provider
- Adds supported remote types in README — thanks to [PR #1371](https://github.com/eamodio/vscode-gitlens/pull/1371) by Vladislav Guleaev ([@vguleaev](https://github.com/vguleaev))
### Changed

+ 16
- 1
package.json View File

@ -3808,6 +3808,12 @@
"icon": "$(cloud-upload)"
},
{
"command": "gitlens.views.publishRepository",
"title": "Publish Repository",
"category": "GitLens",
"icon": "$(cloud-upload)"
},
{
"command": "gitlens.views.pull",
"title": "Pull",
"category": "GitLens",
@ -5457,6 +5463,10 @@
"when": "false"
},
{
"command": "gitlens.views.publishRepository",
"when": "false"
},
{
"command": "gitlens.views.pull",
"when": "false"
},
@ -7906,11 +7916,16 @@
"group": "8_gitlens_actions_@2"
},
{
"command": "gitlens.views.addRemote",
"command": "gitlens.views.publishRepository",
"when": "!gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\-branch)?:upstream:none/",
"group": "inline@1"
},
{
"command": "gitlens.views.addRemote",
"when": "!gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\-branch)?:upstream:none/",
"group": "inline@2"
},
{
"command": "gitlens.views.publishBranch",
"when": "gitlens:hasRemotes && !gitlens:readonly && viewItem =~ /gitlens:status(\-branch)?:upstream:none/",
"group": "inline@1"

+ 1
- 0
src/constants.ts View File

@ -28,6 +28,7 @@ export enum BuiltInCommands {
}
export enum BuiltInGitCommands {
Publish = 'git.publish',
Pull = 'git.pull',
PullRebase = 'git.pullRebase',
Push = 'git.push',

+ 9
- 0
src/views/viewCommands.ts View File

@ -121,6 +121,7 @@ export class ViewCommands {
commands.registerCommand('gitlens.views.fetch', this.fetch, this);
commands.registerCommand('gitlens.views.publishBranch', this.publishBranch, this);
commands.registerCommand('gitlens.views.publishRepository', this.publishRepository, this);
commands.registerCommand('gitlens.views.pull', this.pull, this);
commands.registerCommand('gitlens.views.push', this.push, this);
commands.registerCommand('gitlens.views.pushWithForce', n => this.push(n, true), this);
@ -453,6 +454,14 @@ export class ViewCommands {
}
@debug()
private publishRepository(node: BranchNode | BranchTrackingStatusNode) {
if (node instanceof BranchNode || node instanceof BranchTrackingStatusNode) {
return commands.executeCommand(BuiltInGitCommands.Publish, Uri.file(node.repoPath));
}
return Promise.resolve();
}
@debug()
private pull(node: RepositoryNode | BranchNode | BranchTrackingStatusNode) {
if (node instanceof RepositoryNode) return GitActions.pull(node.repo);
if (node instanceof BranchNode || node instanceof BranchTrackingStatusNode) {

||||||
x
 
000:0
Loading…
Cancel
Save