Переглянути джерело

Fixes #1006 - open files as revision for bitbucket

main
Eric Amodio 3 роки тому
джерело
коміт
6effd609c5
2 змінених файлів з 22 додано та 0 видалено
  1. +1
    -0
      CHANGELOG.md
  2. +21
    -0
      src/quickpicks/remoteProviderPicker.ts

+ 1
- 0
CHANGELOG.md Переглянути файл

@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#1006](https://github.com/eamodio/vscode-gitlens/issues/1006) - "GitLens: Open File on Remote" opens wrong Bitbucket URL
- Fixes [#901](https://github.com/eamodio/vscode-gitlens/issues/901) - Bitbucket Server fails when url = https://DOMAIN/stash/scm/PROJECT/REPO.git
- Fixes [#1354](https://github.com/eamodio/vscode-gitlens/issues/1354) - Stuck after merge a branch with a single quote in the name
- Fixes [#863](https://github.com/eamodio/vscode-gitlens/issues/863) - Pulling all repositories doesn't work unless built-in Git knows about the repo (requires VS Code v1.53 or later)

+ 21
- 0
src/quickpicks/remoteProviderPicker.ts Переглянути файл

@ -2,6 +2,7 @@
import { Disposable, env, Uri, window } from 'vscode';
import { Commands, OpenOnRemoteCommandArgs } from '../commands';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import {
getNameFromRemoteResource,
GitBranch,
@ -47,6 +48,26 @@ export class CopyOrOpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
if (GitBranch.getRemote(resource.ref2) === this.remote.name) {
resource = { ...resource, ref2: GitBranch.getNameWithoutRemote(resource.ref2) };
}
} else if (
resource.type === RemoteResourceType.File &&
resource.branchOrTag != null &&
(this.remote.provider.id === 'bitbucket' || this.remote.provider.id === 'bitbucket-server')
) {
// HACK ALERT
// Since Bitbucket can't support branch names in the url (other than with the default branch),
// turn this into a `Revision` request
const { branchOrTag } = resource;
const branchesOrTags = await Container.git.getBranchesAndOrTags(this.remote.repoPath, {
filter: {
branches: b => b.name === branchOrTag,
tags: b => b.name === branchOrTag,
},
});
const sha = branchesOrTags?.[0].sha;
if (sha) {
resource = { ...resource, type: RemoteResourceType.Revision, sha: sha };
}
}
void (await (this.clipboard ? this.remote.provider.copy(resource) : this.remote.provider.open(resource)));

Завантаження…
Відмінити
Зберегти