diff --git a/progit/app.py b/progit/app.py index f305f3d..0f3cbec 100644 --- a/progit/app.py +++ b/progit/app.py @@ -499,6 +499,26 @@ def edit_issue(repo, issueid, username=None): ) +def request_pulls(repo, username=None): + """ Returns the list of pull-requests opened on a project. + """ + repo = progit.lib.get_project(SESSION, repo, user=username) + + if not repo: + flask.abort(404, 'Project not found') + + requests = progit.lib.get_pull_requests( + SESSION, project_id=repo.id, status=True) + + return flask.render_template( + 'requests.html', + select='requests', + repo=repo, + username=username, + requests=requests, + ) + + def request_pull(repo, requestid, username=None): """ Request pulling the changes from the fork into the project. """ @@ -562,6 +582,7 @@ def request_pull(repo, requestid, username=None): return flask.render_template( 'pull_request.html', + select='requests', repo=repo, username=username or request.user, request=request, diff --git a/progit/templates/requests.html b/progit/templates/requests.html new file mode 100644 index 0000000..a95cd48 --- /dev/null +++ b/progit/templates/requests.html @@ -0,0 +1,40 @@ +{% extends "repo_master.html" %} + +{% block title %}Home{% endblock %} +{%block tag %}home{% endblock %} + + +{% block repo %} + +

Pull-requests

+ +
+ {% if requests %} + + {% else %} +

+ No pull-request have been opened for this project. +

+ {% endif %} +
+ +{% endblock %} diff --git a/progit/urls.py b/progit/urls.py index da2ecf3..430a0aa 100644 --- a/progit/urls.py +++ b/progit/urls.py @@ -332,6 +332,20 @@ def fork_edit_issue(username, repo, issueid): return progit.app.edit_issue(repo, issueid, username=username) +@APP.route('//request-pulls') +def request_pulls(repo): + """ Request pulling the changes from the fork into the project. + """ + return progit.app.request_pulls(repo) + + +@APP.route('/fork///request-pulls') +def fork_request_pulls(username, repo): + """ Request pulling the changes from the fork into the project. + """ + return progit.app.request_pulls(repo, username=username) + + @APP.route('//request-pull/') def request_pull(repo, requestid): """ Request pulling the changes from the fork into the project.