Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed Bitbucket Server and Cloud repo identifiers to include the project key, preventing collisions across projects. **Note:** Bitbucket Cloud users with `exclude.repos` patterns must update them from `workspace/repo` to `workspace/PROJECT_KEY/repo` format. [#904](https://github.com/sourcebot-dev/sourcebot/pull/904)

### Added
- Added optional `visibility` parameter to `/api/chat/blocking` endpoint and MCP `ask_codebase` tool to allow controlling chat session visibility in shared environments. [#903](https://github.com/sourcebot-dev/sourcebot/pull/903)

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/schemas/v3/bitbucket.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/schemas/v3/connection.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,8 @@
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/schemas/v3/index.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,8 @@
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/bitbucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ async function cloudGetRepos(client: BitbucketClient, repoList: string[]): Promi
function cloudShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketConnectionConfig): boolean {
const cloudRepo = repo as CloudRepository;
let reason = '';
const repoName = cloudRepo.full_name!;
const [workspace, repoSlug] = cloudRepo.full_name!.split('/');
const repoName = `${workspace}/${cloudRepo.project?.key}/${repoSlug}`;
Comment thread
brendan-kellam marked this conversation as resolved.

const shouldExclude = (() => {
if (config.exclude?.repos) {
Expand Down
13 changes: 12 additions & 1 deletion packages/backend/src/repoCompileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,18 @@ export const compileBitbucketConfig = async (
const repos = bitbucketRepos.map((repo) => {
const isServer = config.deploymentType === 'server';
const codeHostType: CodeHostType = isServer ? 'bitbucketServer' : 'bitbucketCloud';
const displayName = isServer ? (repo as BitbucketServerRepository).name! : (repo as BitbucketCloudRepository).full_name!;
const displayName = (() => {
if (isServer) {
const serverRepo = repo as BitbucketServerRepository;
// Server repos are of the format `project/repo`
return `${serverRepo.project!.key}/${serverRepo.slug!}`;
} else {
const cloudRepo = repo as BitbucketCloudRepository;
// Cloud repos are of the format `workspace/project/repo`
const [workspace, repoSlug] = cloudRepo.full_name!.split('/');
return `${workspace}/${cloudRepo.project?.key!}/${repoSlug}`;
}
})();
const externalId = isServer ? (repo as BitbucketServerRepository).id!.toString() : (repo as BitbucketCloudRepository).uuid!;
const isPublic = isServer ? (repo as BitbucketServerRepository).public : (repo as BitbucketCloudRepository).is_private === false;
const isArchived = isServer ? (repo as BitbucketServerRepository).archived === true : false;
Expand Down
4 changes: 2 additions & 2 deletions packages/schemas/src/v3/bitbucket.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ const schema = {
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
4 changes: 2 additions & 2 deletions packages/schemas/src/v3/connection.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ const schema = {
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
4 changes: 2 additions & 2 deletions packages/schemas/src/v3/index.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,8 @@ const schema = {
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down
4 changes: 2 additions & 2 deletions schemas/v3/bitbucket.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
},
"examples": [
[
"cloud_workspace/repo1",
"server_project/repo2"
"cloud_workspace/PROJECT_KEY/repo1",
"SERVER_PROJECT_KEY/repo2"
]
],
"description": "List of specific repos to exclude from syncing."
Expand Down