소스 검색

Fixes gitkraken#1718 open current branch on remote

- adds command palette action
main
Keith Daulton 2 년 전
committed by Eric Amodio
부모
커밋
225fa392ce
6개의 변경된 파일59개의 추가작업 그리고 0개의 파일을 삭제
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      README.md
  3. +11
    -0
      package.json
  4. +1
    -0
      src/commands.ts
  5. +44
    -0
      src/commands/openCurrentBranchOnRemote.ts
  6. +1
    -0
      src/constants.ts

+ 1
- 0
CHANGELOG.md 파일 보기

@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds an _Autolinks_ section in the _GitLens Settings Editor_ to visually add and update autolink entries — closes [#1315](https://github.com/gitkraken/vscode-gitlens/issues/1315)
- Adds improved support to _Autolinked Issues and Pull Requests_ within comparisons to list autolinked issues in commit messages
- You can now see all autolinks found in the commits in the comparison regardless of whether its a provider-based autolink or a custom (user-provided) autolink
- Adds _Open Current Branch on Remote_ to the Command Palette — closes [#1718](https://github.com/gitkraken/vscode-gitlens/issues/1718)
## Changed

+ 1
- 0
README.md 파일 보기

@ -628,6 +628,7 @@ Additionally, these integrations provide commands to copy the url of or open fil
- _Open Commit on Remote_ command (`gitlens.openCommitOnRemote`) — opens a commit on the remote provider
- _Copy Remote Commit Url_ command (`gitlens.copyRemoteCommitUrl`) — copies the url of a commit on the remote provider
- _Open Branch on Remote_ command (`gitlens.openBranchOnRemote`) — opens the branch on the remote provider
- _Open Current Branch on Remote_ command (`gitlens.openCurrentBranchOnRemote`) — opens the current branch on the remote provider
- _Copy Remote Branch Url_ command (`gitlens.copyRemoteBranchUrl`) — copies the url of a branch on the remote provider
- _Open Branches on Remote_ command (`gitlens.openBranchesOnRemote`) — opens the branches on the remote provider
- _Copy Remote Branches Url_ command (`gitlens.copyRemoteBranchesUrl`) — copies the url of the branches on the remote provider

+ 11
- 0
package.json 파일 보기

@ -166,6 +166,7 @@
"onCommand:gitlens.openBranchesOnRemote",
"onCommand:gitlens.copyRemoteBranchesUrl",
"onCommand:gitlens.openBranchOnRemote",
"onCommand:gitlens.openCurrentBranchOnRemote",
"onCommand:gitlens.copyRemoteBranchUrl",
"onCommand:gitlens.openCommitOnRemote",
"onCommand:gitlens.copyRemoteCommitUrl",
@ -4405,6 +4406,12 @@
"icon": "$(globe)"
},
{
"command": "gitlens.openCurrentBranchOnRemote",
"title": "Open Current Branch on Remote",
"category": "GitLens",
"icon": "$(globe)"
},
{
"command": "gitlens.copyRemoteBranchUrl",
"title": "Copy Remote Branch Url",
"category": "GitLens",
@ -6510,6 +6517,10 @@
"when": "gitlens:hasRemotes"
},
{
"command": "gitlens.openCurrentBranchOnRemote",
"when": "gitlens:hasRemotes"
},
{
"command": "gitlens.copyRemoteBranchUrl",
"when": "false"
},

+ 1
- 0
src/commands.ts 파일 보기

@ -22,6 +22,7 @@ export * from './commands/logging';
export * from './commands/openAssociatedPullRequestOnRemote';
export * from './commands/openBranchesOnRemote';
export * from './commands/openBranchOnRemote';
export * from './commands/openCurrentBranchOnRemote';
export * from './commands/openChangedFiles';
export * from './commands/openCommitOnRemote';
export * from './commands/openComparisonOnRemote';

+ 44
- 0
src/commands/openCurrentBranchOnRemote.ts 파일 보기

@ -0,0 +1,44 @@
import { TextEditor, Uri, window } from 'vscode';
import { Commands } from '../constants';
import type { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { RemoteResourceType } from '../git/remotes/provider';
import { Logger } from '../logger';
import { RepositoryPicker } from '../quickpicks/repositoryPicker';
import { command, executeCommand } from '../system/command';
import { ActiveEditorCommand, getCommandUri } from './base';
import { OpenOnRemoteCommandArgs } from './openOnRemote';
@command()
export class OpenCurrentBranchOnRemoteCommand extends ActiveEditorCommand {
constructor(private readonly container: Container) {
super(Commands.OpenCurrentBranchOnRemote);
}
async execute(editor?: TextEditor, uri?: Uri) {
uri = getCommandUri(uri, editor);
const gitUri = uri != null ? await GitUri.fromUri(uri) : undefined;
const repository = await RepositoryPicker.getBestRepositoryOrShow(gitUri, editor, 'Open Current Branch Name');
if (repository == null) return;
try {
const branch = await repository.getBranch();
if (branch?.name) {
void (await executeCommand<OpenOnRemoteCommandArgs>(Commands.OpenOnRemote, {
resource: {
type: RemoteResourceType.Branch,
branch: branch.name || 'HEAD',
},
repoPath: repository.path,
}));
}
} catch (ex) {
Logger.error(ex, 'OpenCurrentBranchOnRemoteCommand');
void window.showErrorMessage(
'Unable to open branch on remote provider. See output channel for more details',
);
}
}
}

+ 1
- 0
src/constants.ts 파일 보기

@ -105,6 +105,7 @@ export const enum Commands {
OpenBlamePriorToChange = 'gitlens.openBlamePriorToChange',
OpenBranchesOnRemote = 'gitlens.openBranchesOnRemote',
OpenBranchOnRemote = 'gitlens.openBranchOnRemote',
OpenCurrentBranchOnRemote = 'gitlens.openCurrentBranchOnRemote',
OpenChangedFiles = 'gitlens.openChangedFiles',
OpenCommitOnRemote = 'gitlens.openCommitOnRemote',
OpenComparisonOnRemote = 'gitlens.openComparisonOnRemote',

불러오는 중...
취소
저장