Return an array of {Mercurial::Branch Branch} instances where a specified commit exists.
 Experimental, doesn't always return a correct list of branches.

 === Example:
  repository.branches.for_commit('291a498f04e9')
429870
def for_commit(hash_id, cmd_options={})
      hg_to_array(["log -r 'descendants(?) and head()' --template '\n{branches}'", hash_id], {}, cmd_options) do |line|
        build_with_name_only(line)
      end.compact.uniq
    end
822004
def list_branches(self) -> typing.List[str]:
        
        branches: typing.List[str] = [head.name for head in self.repo.heads]
        LOGGER.debug('branches: %s', branches)
        return branches
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)
1009061
def _version_find_existing():
    
    _tool_run('git fetch origin -t')
    git_tags = [x for x in (y.strip() for y in (_tool_run('git tag -l')
                                                .stdout.split('\n'))) if x]
    return {tuple(int(n) if n else 0 for n in m.groups())
            for m in (_version_re.match(t) for t in git_tags) if m}
498067
def repo_values(self):
        
        branches = []
        commits = {}
        m_helper = Tools()
        status = m_helper.repo_branches(self.parentApp.repo_value['repo'])
        # branches and commits must both be retrieved successfully
        if status[0]:
            branches = status[1]
            status = m_helper.repo_commits(self.parentApp.repo_value['repo'])
            if status[0]:
                r_commits = status[1]
                for commit in r_commits:
                    commits[commit[0]] = commit[1]
            else:
                # if commits failed, return commit errors
                return status
        else:
            # if branch failed, return branch errors
            return status
        # if everything is good, return branches with commits
        return branches, commits
815378
def get_snapshots(self,**kwargs):
        
        commits = self.repository.get_commits(**kwargs)
        snapshots = []
        for commit in commits:
            for key in ('committer_date','author_date'):
                commit[key] = datetime.datetime.fromtimestamp(commit[key+'_ts'])
            snapshot = GitSnapshot(commit)
            hasher = Hasher()
            hasher.add(snapshot.sha)
            snapshot.hash = hasher.digest.hexdigest()
            snapshot.project = self.project
            snapshot.pk = uuid.uuid4().hex
            snapshots.append(snapshot)
        return snapshots
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 ''
983113
def repo_tools(self, branch):
        
        tools = []
        m_helper = Tools()
        repo = self.parentApp.repo_value['repo']
        version = self.parentApp.repo_value['versions'][branch]
        status = m_helper.repo_tools(repo, branch, version)
        if status[0]:
            r_tools = status[1]
            for tool in r_tools:
                tools.append(tool[0])
        return tools
1351917
def get_list_commits(self, branch: str = None,
                         reverse_order: bool = True) \
            -> Generator[Commit, None, None]:
        
        for commit in self.repo.iter_commits(branch, reverse=reverse_order):
            yield self.get_commit_from_gitpython(commit)
419040
def for_branch(self, branch):
        
        return self.replace(course_key=self.course_key.for_branch(branch))
318396
function checkBranch (branches, cb) {
  if (branches === "ALL") {
    return cb(null, true);
  }

  if (!_.isArray(branches)) {
    branches = _.invoke(branches.split(","), "trim");
  }

  return git.currentBranch().then(function (branch) {
    return [_.any(branches, _.partial(minimatch, branch)), branch];
  });
}
287087
def commit_branches(sha1):
    # type: (str) -> List[str]
    
    cmd = 'git branch --contains {}'.format(sha1)
    return shell.run(
        cmd,
        capture=True,
        never_pretend=True
    ).stdout.strip().split()
989027
def check_exists_repositories(repo):
    
    pkg_list = "PACKAGES.TXT"
    if repo == "sbo":
        pkg_list = "SLACKBUILDS.TXT"
    if check_for_local_repos(repo) is True:
        pkg_list = "PACKAGES.TXT"
        return ""
    if not os.path.isfile("{0}{1}{2}".format(
            _meta_.lib_path, repo, "_repo/{0}".format(pkg_list))):
        return repo
    return ""
1320880
def check_if_branch_exist(db, root_hash, key_prefix):
    
    validate_is_bytes(key_prefix)

    return _check_if_branch_exist(db, root_hash, encode_to_bin(key_prefix))
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']
504673
def by_branch(branch, cmd_options={})
      hg_to_array(["log -b ? --style ?", branch, style], {:separator => changeset_separator}, cmd_options) do |line|
        build(line)
      end
    end
1176852
def local_branches
      @local_branches ||= begin
        branches = []
        if not git.branches.local.empty?
          branches << git.branches.local.select{ |b| b.current }[0].name
          branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }
        end
        branches.flatten
      end
    end