Return the set of branches that contain the commit.

        :return: set(str) branches
330583
def branches(self) -> Set[str]:
        
        if self._branches is None:
            self._branches = self._get_branches()

        return self._branches
1194717
def get_commits(self, since_sha=None):
        
        assert self.tempdir

        cmd = ['git', 'log', '--first-parent', '--reverse', COMMIT_FORMAT]
        if since_sha:
            commits = [self.get_commit(since_sha)]
            cmd.append('{}..HEAD'.format(since_sha))
        else:
            commits = []
            cmd.append('HEAD')

        output = cmd_output(*cmd, cwd=self.tempdir)

        for sha, date in chunk_iter(output.splitlines(), 2):
            commits.append(Commit(sha, int(date)))

        return commits
291307
def get_branch(db, root_hash, key):
    
    validate_is_bytes(key)

    return tuple(_get_branch(db, root_hash, encode_to_bin(key)))
391435
def get_commits(repo_dir, old_commit, new_commit, hide_merges=True):
    """"""
    repo = Repo(repo_dir)
    commits = repo.iter_commits(rev="{0}..{1}".format(old_commit, new_commit))
    if hide_merges:
        return [x for x in commits if not x.summary.startswith("Merge ")]
    else:
        return list(commits)
250576
def read_git_branch():
    
    if os.getenv('TRAVIS'):
        return os.getenv('TRAVIS_BRANCH')
    else:
        try:
            repo = git.repo.base.Repo(search_parent_directories=True)
            return repo.active_branch.name
        except Exception:
            return ''
604696
def get_commits(self):
        
        return github.PaginatedList.PaginatedList(
            github.Commit.Commit,
            self._requester,
            self.url + "/commits",
            None
        )
944048
def get_branch(self, branch):
        
        assert isinstance(branch, (str, unicode)), branch
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/branches/" + branch
        )
        return github.Branch.Branch(self._requester, headers, data, completed=True)
603546
def branch(self, branch_name, start_point='HEAD', force=True,
               checkout=False):
        
        return git_branch(
            self.repo_dir, branch_name, start_point, force=force,
            checkout=checkout)
190072
def project_branches(self):
        
        request_url = "{}git/branches".format(self.create_basic_url())

        return_value = self._call_api(request_url)

        return return_value['branches']
1084958
def get_num_branches(self):
        
        num = {}
        for trt, branches in itertools.groupby(
                self.branches, operator.attrgetter('trt')):
            num[trt] = sum(1 for br in branches if br.effective)
        return num
409844
def parents(self):
        
        return [self.repository.get_changeset(parent)
                for parent in self._commit.parents]
349098
def fetch(self):
        
        fetch_kwargs = {'multiple': True}
        fetch_args = []

        if self.is_prune():
            fetch_kwargs['prune'] = True

        if self.settings['fetch.all']:
            fetch_kwargs['all'] = True
        else:
            if '.' in self.remotes:
                self.remotes.remove('.')

                if not self.remotes:
                    # Only local target branches,
                    # `git fetch --multiple` will fail
                    return

            fetch_args.append(self.remotes)

        try:
            self.git.fetch(*fetch_args, **fetch_kwargs)
        except GitError as error:
            error.message = "`git fetch` failed"
            raise error
686989
def tree(self):
        
        bs = self.model.branchScale
        for node in self._tree.find_clades():
            if node != self._tree.root:
                node.branch_length = self.t[self.name_to_nodeindex[node]] * bs
        return self._tree
300013
def get_branches(self):
        
        return github.PaginatedList.PaginatedList(
            github.Branch.Branch,
            self._requester,
            self.url + "/branches",
            None
        )
126290
def merged(revision)
      # By hand, build a list of all branches known to be merged into master
      git_args = ['branch', '-a', '--merged', revision]
      all_merged = []
      @repo.git_output(git_args).lines.each do |line|
        line.strip!
        all_merged << Branch.new(@repo, line)
      end

      # Filter the contents of this collection according to the big list
      merged = []
      @branches.each do |candidate|
        # For some reason Set#include? does not play nice with our overridden comparison operators
        # for branches, so we need to do this the hard way :(
        merged << candidate if all_merged.detect { |b| candidate == b }
      end

      BranchCollection.new(@repo, merged)
    end
1278494
def branches(self):
        
        # We need to read the _cte_node_children attribute, so ensure it exists.
        self._ensure_parameters()
        return self.filter(
            **{"%s__id__in" % self.model._cte_node_children: self.all()}
        ).distinct()
581200
def _branch_descendants(self, branch=None):
        
        branch = branch or self.branch
        for (parent, (child, _, _, _, _)) in self._branches.items():
            if parent == branch:
                yield child