roundabout,
created on Tuesday, 4 June 2024, 15:11:43 (1717513903),
received on Wednesday, 31 July 2024, 06:54:49 (1722408889)
Author identity: vlad <vlad.muntoiu@gmail.com>
a71544cb0bf2b88c1e5960f2f3aa86dcc8e20757
app.py
@@ -1492,7 +1492,7 @@ def repository_prs_merge(username, repository):
) task_result = worker.AsyncResult(result.id) return flask.redirect(f"/task/{result.id}?pr-id={id}", 303)return flask.redirect(f"/task/{result.id}?pr-id={id}", 303) # should be 202 Accepted but we must use a redirect# db.session.delete(pull_request) # db.session.commit() else:
@@ -1668,6 +1668,11 @@ def e405(error):
return flask.render_template("method-not-allowed.html"), 405 @app.errorhandler(500) def e500(error): return flask.render_template("server-error.html"), 500 if __name__ == "__main__": app.run(debug=True, port=8080, host="0.0.0.0")
celery_tasks.py
@@ -53,10 +53,12 @@ def merge_heads(head_route, head_branch, base_route, base_branch, simulate=True)
out, err, merge_exit = common.git_command(server_repo_location, b"", "merge", f"heads/{head_branch}", return_err=True, return_exit=True) return "merge_simulator" if simulate else "merge", out, err, head_route, head_branch, base_route, base_branch, merge_exitnew_commits = common.git_command(server_repo_location, b"", "log", "--oneline", f"heads/{base_branch}..heads/{head_branch}") return "merge_simulator" if simulate else "merge", out, err, head_route, head_branch, base_route, base_branch, merge_exit, new_commits# Otherwise, we need to fetch the head repo. remote_url = os.path.join(config.BASE_DOMAIN, "git", base_route.lstrip("/"))remote_url = "https://" if config.suggest_https else "http://" + os.path.join(config.BASE_DOMAIN + f":{config.port}" if config.port not in {80, 443} else "", "git", base_route.lstrip("/"))out, err = b"", b"" part_out, part_err = common.git_command(server_repo_location, b"", "remote", "add", "NEW", remote_url, return_err=True)
@@ -65,10 +67,15 @@ def merge_heads(head_route, head_branch, base_route, base_branch, simulate=True)
part_out, part_err = common.git_command(server_repo_location, b"", "remote", "update", return_err=True) out += part_out err += part_err part_out, part_err = common.git_command(server_repo_location, b"", "fetch", "NEW", f"{head_branch}", return_err=True) out += part_out err += part_errpart_out, part_err = common.git_command(server_repo_location, b"", "checkout", f"{base_branch}", return_err=True) out += part_out err += part_err new_commits = common.git_command(server_repo_location, b"", "log", "--oneline", f"{base_branch}..{head_branch}")new_commits, part_err = common.git_command(server_repo_location, b"", "log", "--oneline", f"heads/{base_branch}..NEW/{head_branch}", "--", return_err=True) print(new_commits) err += part_errif simulate: part_out, part_err, merge_exit = common.git_command(server_repo_location, b"", "merge", "--allow-unrelated-histories",
@@ -100,7 +107,7 @@ def merge_heads(head_route, head_branch, base_route, base_branch, simulate=True)
commit_data.receive_date = datetime.now() db.session.add(commit_data) return "merge_simulator" if simulate else "merge", out, err, head_route, head_branch, base_route, base_branch, merge_exitreturn "merge_simulator" if simulate else "merge", out, err, head_route, head_branch, base_route, base_branch, merge_exit, new_commits@shared_task(ignore_result=False)
config.py
@@ -28,7 +28,8 @@ HASHING_ROUNDS: int = 11
RESERVED_NAMES: tuple = ("git", "settings", "logout", "accounts", "info", "notifications", "about", "newrepo", "favourites",) suggest_https: bool = False # this config is intended for a test server restrict_cookie_domain: bool = False # dittoport: int = 8080 # currently not shown in the UI, only used for critical communications restrict_cookie_domain: bool = Falseavailable_locales: list[str] = ["ro_RO", "en_GB"]
templates/repository/repo-commit.html
@@ -3,7 +3,7 @@
{% set active_page = "log" %} {% block title %} {% trans message=data.message|split("\n\n")|first, username=username, repository=repository %}{{ basename }} in {{ username }}/{{ repository }}{% endtrans %}{% trans message=data.message|split("\n\n")|first, username=username, repository=repository %}{{ message }} in {{ username }}/{{ repository }}{% endtrans %}{% endblock %} {% block content %} <x-vbox>
templates/search.html
@@ -1,7 +1,7 @@
{% extends "default.html" %} {% block title %} {% trans username=username, repository=repository %}History of {{ username }}/{{ repository }}{% endtrans %}{% trans username=username, repository=repository %}Repository listing: {{ query }}{% endtrans %}{% endblock %} {% block content %} <x-vbox>
templates/server-error.html
@@ -0,0 +1,11 @@
{% extends "error.html" %} {% block error %} {% trans %}500{% endtrans %} {% endblock %} {% block heading %} {% trans %}500 internal server error{% endtrans %} {% endblock %} {% block text %} {% trans %}The program running on the server has crashed. This is a problem with the program; you did nothing wrong. Please send it to the server administrator.{% endtrans %} {% endblock %} {% block icon %}mdi:cloud-alert{% endblock %}