code: async function initRepo({ repository, endpoint, localDir }) {
    logger.debug(`initRepo("${repository}")`);
    const opts = hostRules.find({ platform: 'bitbucket' }, { endpoint });
    // istanbul ignore next
    if (!(opts.username && opts.password)) {
      throw new Error(
        `No username/password found for Bitbucket repository ${repository}`
      );
    }
    hostRules.update({ ...opts, platform: 'bitbucket', default: true });
    api.reset();
    config = {};
    // TODO: get in touch with @rarkins about lifting up the caching into the app layer
    config.repository = repository;
    const platformConfig = {};
  
    // Always gitFs
    const url = GitStorage.getUrl({
      gitFs: 'https',
      auth: `${opts.username}:${opts.password}`,
      hostname: 'bitbucket.org',
      repository,
    });
  
    config.storage = new GitStorage();
    await config.storage.initRepo({
      ...config,
      localDir,
      url,
    });
  
    try {
      const info = utils.repoInfoTransformer(
        (await api.get(`/2.0/repositories/${repository}`)).body
      );
      platformConfig.privateRepo = info.privateRepo;
      platformConfig.isFork = info.isFork;
      platformConfig.repoFullName = info.repoFullName;
      config.owner = info.owner;
      logger.debug(`${repository} owner = ${config.owner}`);
      config.defaultBranch = info.mainbranch;
      config.baseBranch = config.defaultBranch;
      config.mergeMethod = info.mergeMethod;
    } catch (err) /* istanbul ignore next */ {
      if (err.statusCode === 404) {
        throw new Error('not-found');
      }
      logger.info({ err }, 'Unknown Bitbucket initRepo error');
      throw err;
    }
    delete config.prList;
    delete config.fileList;
    await Promise.all([getPrList(), getFileList()]);
    return platformConfig;
  }
docs: Initialize bitbucket by getting base branch and SHA