Returns the Pull Request for a branch. Null if not exists.
968496
async function getBranchPr(branchName, refreshCache) {
  logger.debug(`getBranchPr(${branchName})`);
  const existingPr = await findPr(branchName, null, 'open');
  return existingPr ? getPr(existingPr.number, refreshCache) : null;
}
1082970
function getCurrentBranch(verbose) {
  return Promise.resolve()
    .then(execCmd.bind(null,
      'git',
      ['symbolic-ref', 'HEAD', '-q'],
      'problem getting current branch',
      verbose
    ))
    .catch(function() {
      return '';
    })
    .then(function(result) {
      return result.replace(new RegExp('^refs\/heads\/'), '');
    });
}
876093
def get_pull(self, number):
        
        assert isinstance(number, (int, long)), number
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/pulls/" + str(number)
        )
        return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
1138115
def bitbucket_pr_from_env(env)
      branch_name = env["BITBUCKET_BRANCH_NAME"]
      repo_slug   = env["BITBUCKET_REPO_SLUG"]
      begin
        Danger::RequestSources::BitbucketCloudAPI.new(repo_slug, nil, branch_name, env).pull_request_id
      rescue
        raise "Failed to find a pull request for branch \"#{branch_name}\" on Bitbucket."
      end
    end
1259396
public GHPullRequest getPullRequest(boolean force) throws IOException {
        if (this.pr == null || force) {
            setPullRequest(repo.getActualPullRequest(this.id));
        }
        return pr;
    }
1056306
def pull(self):
        
        git.Repo(self.path).remote().pull(self.branch)
14597
async function getBranchStatus(branchName, requiredStatusChecks) {
  logger.debug(`getBranchStatus(${branchName})`);
  if (!requiredStatusChecks) {
    // null means disable status checks, so it always succeeds
    return 'success';
  }
  if (requiredStatusChecks.length) {
    // This is Unsupported
    logger.warn({ requiredStatusChecks }, `Unsupported requiredStatusChecks`);
    return 'failed';
  }
  // First, get the branch commit SHA
  const branchSha = await config.storage.getBranchCommit(branchName);
  // Now, check the statuses for that commit
  const url = `projects/${
    config.repository
  }/repository/commits/${branchSha}/statuses`;
  const res = await get(url);
  logger.debug(`Got res with ${res.body.length} results`);
  if (res.body.length === 0) {
    // Return 'pending' if we have no status checks
    return 'pending';
  }
  let status = 'success';
  // Return 'success' if all are success
  res.body.forEach(check => {
    // If one is failed then don't overwrite that
    if (status !== 'failure') {
      if (!check.allow_failure) {
        if (check.status === 'failed') {
          status = 'failure';
        } else if (check.status !== 'success') {
          ({ status } = check);
        }
      }
    }
  });
  return status;
}
683641
public String getPullRequestAttachmentEndpoint(Object projectIdOrKey, Object repoIdOrName, Object number, Object attachmentId) {
        return buildEndpoint("projects/" + projectIdOrKey +
                "/git/repositories/" + repoIdOrName +
                "/pullRequests/" + number +
                "/attachments/" + attachmentId);
    }
1185348
def get_tree_from_branch(self, ref):
        '''
        
        '''
        try:
            return git.RemoteReference(
                self.repo,
                'refs/remotes/origin/{0}'.format(ref)).commit.tree
        except ValueError:
            return None
683234
def branch(self):
        """"""
        result = get_branch(repo=self.repo)
        if result is None:
            result = get_travis_branch()
        return result
835283
def grab(branch, path = Dir.pwd, remote = 'origin')
      exit_status = 1
      error "no branch provided" if branch.nil?
      #remotes  = FalkorLib::Git.remotes(path)
      branches = FalkorLib::Git.list_branch(path)
      if branches.include? "remotes/#{remote}/#{branch}"
        info "Grab the branch '#{remote}/#{branch}'"
        exit_status = execute_in_dir(FalkorLib::Git.rootdir( path ), "git branch --track #{branch} #{remote}/#{branch}")
      else
        warning "the remote branch '#{remote}/#{branch}' cannot be found"
      end
      exit_status
    end
655517
def frigg(branch: str):
    
    assert os.environ.get('FRIGG_BUILD_BRANCH') == branch
    assert not os.environ.get('FRIGG_PULL_REQUEST')
1164531
def get_protection(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.protection_url,
            headers={'Accept': Consts.mediaTypeRequireMultipleApprovingReviews}
        )
        return github.BranchProtection.BranchProtection(self._requester, headers, data, completed=True)
610905
public function pull($remote = null, $branch = null)
    {
        $result = $this->command . ' pull ' . $remote . ' ' . $branch;
        return $result;
    }
1295723
def as_pull_request(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            "/pulls/".join(self.url.rsplit("/issues/", 1))
        )
        return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
954619
protected String branchRefForName( String branchName ) {
        String remoteName = connector.remoteName();
        return remoteName != null ? remoteBranchPrefix(remoteName) + branchName : LOCAL_BRANCH_PREFIX + branchName;
    }
630435
def get_current_branch(self) -> str:
        
        current_branch: str = self.repo.active_branch.name
        LOGGER.debug('current branch: %s', current_branch)
        return current_branch