Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
feat: open pull request of current branch
Browse files Browse the repository at this point in the history
Closes #91
  • Loading branch information
KnisterPeter committed May 5, 2017
1 parent 77b94ab commit 3d15385
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
"title": "Checkout open pull request...",
"category": "GitHub"
},
{
"command": "vscode-github.browserSimplePullRequest",
"title": "Browse pull request of current branch",
"category": "GitHub"
},
{
"command": "vscode-github.browserPullRequest",
"title": "Browse open pull request...",
Expand Down
17 changes: 15 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class Extension {
vscode.commands.registerCommand('vscode-github.createPullRequest', this.wrapCommand(this.createPullRequest)),
vscode.commands.registerCommand('vscode-github.checkoutPullRequests',
this.wrapCommand(this.checkoutPullRequests)),
vscode.commands.registerCommand('vscode-github.browserPullRequest', this.wrapCommand(this.browserPullRequest)),
vscode.commands.registerCommand('vscode-github.browserSimplePullRequest',
this.wrapCommand(this.browseSimplePullRequest)),
vscode.commands.registerCommand('vscode-github.browserPullRequest', this.wrapCommand(this.browsePullRequest)),
vscode.commands.registerCommand('vscode-github.mergePullRequest', this.wrapCommand(this.mergePullRequest)),
vscode.commands.registerCommand('vscode-github.addAssignee', this.wrapCommand(this.addAssignee)),
vscode.commands.registerCommand('vscode-github.removeAssignee', this.wrapCommand(this.removeAssignee)),
Expand Down Expand Up @@ -231,7 +233,18 @@ class Extension {
});
}

private async browserPullRequest(): Promise<void> {
private async browseSimplePullRequest(): Promise<void> {
await this.withinProgressUI(async() => {
const pullRequest = await this.githubManager.getPullRequestForCurrentBranch();
if (pullRequest) {
await vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(pullRequest.html_url));
} else {
vscode.window.showInformationMessage('No pull request for current branch found');
}
});
}

private async browsePullRequest(): Promise<void> {
this.selectPullRequest(pullRequest => {
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(pullRequest.html_url));
});
Expand Down

0 comments on commit 3d15385

Please sign in to comment.