def branches(): """Returns a list of branches in a given repository by querying Gerrit. GET /gerrit/branches?param=<value> :arg str project: Project to query branches from. (required) JSON:: { "branches": [ { "ref": "refs/heads/stable/beryllium", "revision": "8f72284f3808328604bdff7f91a6999094f7c6d7" }, ... ] } """ mapping = { 'project': request.args.get('project', None), } result = check_parameters(mapping) if not result: gerrit = GerritHandler(app.config['GERRIT_URL']) branches = gerrit.project_branches_list(mapping['project']) if not branches: result = {'error': 'No branches found for {0}.'.format(mapping['project'])} else: result = {'branches': branches} return jsonify(result)
def branches(): """Returns a list of branches in a given repository by querying Gerrit. GET /gerrit/branches?param=<value> :arg str project: Project to query branches from. (required) JSON:: { "branches": [ { "ref": "refs/heads/stable/beryllium", "revision": "8f72284f3808328604bdff7f91a6999094f7c6d7" }, ... ] } """ mapping = { 'project': request.args.get('project', None), } result = check_parameters(mapping) if not result: gerrit = GerritHandler(app.config['GERRIT_URL']) branches = gerrit.project_branches_list(mapping['project']) if not branches: result = { 'error': 'No branches found for {0}.'.format(mapping['project']) } else: result = {'branches': branches} return jsonify(result)