MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / cloudShouldExcludeRepo

Function cloudShouldExcludeRepo

packages/backend/src/bitbucket.ts:370–401  ·  view source on GitHub ↗
(repo: BitbucketRepository, config: BitbucketConnectionConfig)

Source from the content-addressed store, hash-verified

368}
369
370export function cloudShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketConnectionConfig): boolean {
371 const cloudRepo = repo as CloudRepository;
372 let reason = '';
373 const [workspace, repoSlug] = cloudRepo.full_name!.split('/');
374 const repoName = `${workspace}/${cloudRepo.project?.key}/${repoSlug}`;
375
376 const shouldExclude = (() => {
377 if (config.exclude?.repos) {
378 if (micromatch.isMatch(repoName, config.exclude.repos)) {
379 reason = `\`exclude.repos\` contains ${repoName}`;
380 return true;
381 }
382 }
383
384 if (!!config.exclude?.archived) {
385 logger.warn(`Exclude archived repos flag provided in config but Bitbucket Cloud does not support archived repos. Ignoring...`);
386 }
387
388 if (!!config.exclude?.forks && cloudRepo.parent !== undefined) {
389 reason = `\`exclude.forks\` is true`;
390 return true;
391 }
392
393 return false;
394 })();
395
396 if (shouldExclude) {
397 logger.debug(`Excluding repo ${repoName}. Reason: ${reason}`);
398 return true;
399 }
400 return false;
401}
402
403export function createBitbucketServerClient(url: string, user: string | undefined, token: string | undefined): BitbucketClient {
404 const authorizationString = (() => {

Callers 1

bitbucket.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected