From 0e087e743345d2605dc2ff5c8d86612ea605a024 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 20 Oct 2021 14:28:29 +0200 Subject: [PATCH] [ADD] mergebot, forwardbot: changelog * Adds a changelog page, linked from the main, with content automatically loaded from the source. To avoid conflicts, each entry is its own file and entries are grouped by the month during which the update will (probably) be deployed * The last group (most likely "last update") doesn't have a title, the rest do. * Add changelog entries from the last update so it's not too empty. * Also update the layout for the alerts a bit: remove bottom margin to reduce loss of whitespace. --- forwardport/__init__.py | 1 + .../changelog/2021-09/authorship-dedup.md | 1 + forwardport/changelog/2021-09/authorship.md | 1 + .../changelog/2021-09/conflict-view.md | 1 + forwardport/changelog/2021-09/draft.md | 1 + .../2021-09/feedback-missing-login.md | 1 + .../changelog/2021-09/followup-conflict.md | 1 + .../changelog/2021-09/fp-remote-view.md | 1 + .../changelog/2021-09/fwbot-rplus-error.md | 1 + forwardport/changelog/2021-09/outstanding.md | 1 + .../changelog/2021-10/delegate-followup.md | 1 + .../changelog/2021-10/followupdate-race.md | 1 + .../changelog/2021-10/fw-reapproval.md | 1 + .../changelog/2021-10/outstanding-layout.md | 1 + forwardport/controllers.py | 15 ++++++++++ forwardport/data/views.xml | 2 +- .../changelog/2021-09/conflict_authorship.md | 1 + .../2021-09/different_project_link.md | 1 + runbot_merge/changelog/2021-09/drafts.md | 1 + .../changelog/2021-09/fetch_closed.md | 1 + .../2021-09/persistent_linked_prs.md | 1 + .../changelog/2021-09/rebase_tagging.md | 1 + .../2021-09/staging_failure_message.md | 1 + runbot_merge/changelog/2021-09/timestamps.md | 1 + runbot_merge/changelog/2021-10/changelog.md | 1 + .../changelog/2021-10/commit-title-edition.md | 1 + .../2021-10/pr_description_up_to_date.md | 1 + runbot_merge/changelog/2021-10/pr_errors.md | 1 + runbot_merge/changelog/2021-10/pr_page.md | 1 + .../changelog/2021-10/review-without-email.md | 1 + .../2021-10/reviewer-merge-methods.md | 1 + runbot_merge/changelog/2021-10/squash.md | 1 + runbot_merge/controllers/dashboard.py | 30 +++++++++++++++++++ runbot_merge/views/templates.xml | 22 ++++++++++++-- 34 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 forwardport/changelog/2021-09/authorship-dedup.md create mode 100644 forwardport/changelog/2021-09/authorship.md create mode 100644 forwardport/changelog/2021-09/conflict-view.md create mode 100644 forwardport/changelog/2021-09/draft.md create mode 100644 forwardport/changelog/2021-09/feedback-missing-login.md create mode 100644 forwardport/changelog/2021-09/followup-conflict.md create mode 100644 forwardport/changelog/2021-09/fp-remote-view.md create mode 100644 forwardport/changelog/2021-09/fwbot-rplus-error.md create mode 100644 forwardport/changelog/2021-09/outstanding.md create mode 100644 forwardport/changelog/2021-10/delegate-followup.md create mode 100644 forwardport/changelog/2021-10/followupdate-race.md create mode 100644 forwardport/changelog/2021-10/fw-reapproval.md create mode 100644 forwardport/changelog/2021-10/outstanding-layout.md create mode 100644 forwardport/controllers.py create mode 100644 runbot_merge/changelog/2021-09/conflict_authorship.md create mode 100644 runbot_merge/changelog/2021-09/different_project_link.md create mode 100644 runbot_merge/changelog/2021-09/drafts.md create mode 100644 runbot_merge/changelog/2021-09/fetch_closed.md create mode 100644 runbot_merge/changelog/2021-09/persistent_linked_prs.md create mode 100644 runbot_merge/changelog/2021-09/rebase_tagging.md create mode 100644 runbot_merge/changelog/2021-09/staging_failure_message.md create mode 100644 runbot_merge/changelog/2021-09/timestamps.md create mode 100644 runbot_merge/changelog/2021-10/changelog.md create mode 100644 runbot_merge/changelog/2021-10/commit-title-edition.md create mode 100644 runbot_merge/changelog/2021-10/pr_description_up_to_date.md create mode 100644 runbot_merge/changelog/2021-10/pr_errors.md create mode 100644 runbot_merge/changelog/2021-10/pr_page.md create mode 100644 runbot_merge/changelog/2021-10/review-without-email.md create mode 100644 runbot_merge/changelog/2021-10/reviewer-merge-methods.md create mode 100644 runbot_merge/changelog/2021-10/squash.md diff --git a/forwardport/__init__.py b/forwardport/__init__.py index 0650744f..f7209b17 100644 --- a/forwardport/__init__.py +++ b/forwardport/__init__.py @@ -1 +1,2 @@ from . import models +from . import controllers diff --git a/forwardport/changelog/2021-09/authorship-dedup.md b/forwardport/changelog/2021-09/authorship-dedup.md new file mode 100644 index 00000000..34f2d437 --- /dev/null +++ b/forwardport/changelog/2021-09/authorship-dedup.md @@ -0,0 +1 @@ +FIX: the deduplication of authorship in case of conflicts in multi-commit PRs diff --git a/forwardport/changelog/2021-09/authorship.md b/forwardport/changelog/2021-09/authorship.md new file mode 100644 index 00000000..ffe67c90 --- /dev/null +++ b/forwardport/changelog/2021-09/authorship.md @@ -0,0 +1 @@ +FIX: loss of authorship on conflicts in multi-commit PRs, such conflicts now generate a commit with no authorship information, which can not be merged diff --git a/forwardport/changelog/2021-09/conflict-view.md b/forwardport/changelog/2021-09/conflict-view.md new file mode 100644 index 00000000..4c6cc103 --- /dev/null +++ b/forwardport/changelog/2021-09/conflict-view.md @@ -0,0 +1 @@ +ADD: better localisation of conflicts in multi-PR commits, list all the commits in the comment and add an arrow pointing to the one which broke diff --git a/forwardport/changelog/2021-09/draft.md b/forwardport/changelog/2021-09/draft.md new file mode 100644 index 00000000..d92418a5 --- /dev/null +++ b/forwardport/changelog/2021-09/draft.md @@ -0,0 +1 @@ +REM: creation of forward ports in draft mode diff --git a/forwardport/changelog/2021-09/feedback-missing-login.md b/forwardport/changelog/2021-09/feedback-missing-login.md new file mode 100644 index 00000000..92e921e7 --- /dev/null +++ b/forwardport/changelog/2021-09/feedback-missing-login.md @@ -0,0 +1 @@ +FIX: some feedback messages didn't correctly ping the person being replied to diff --git a/forwardport/changelog/2021-09/followup-conflict.md b/forwardport/changelog/2021-09/followup-conflict.md new file mode 100644 index 00000000..6e8bf3bf --- /dev/null +++ b/forwardport/changelog/2021-09/followup-conflict.md @@ -0,0 +1 @@ +IMP: properly notify the user when an update to a pull request causes a conflict when impacted on the followup diff --git a/forwardport/changelog/2021-09/fp-remote-view.md b/forwardport/changelog/2021-09/fp-remote-view.md new file mode 100644 index 00000000..97729354 --- /dev/null +++ b/forwardport/changelog/2021-09/fp-remote-view.md @@ -0,0 +1 @@ +IMP: add the forward-port remote to the repository view, so it can be set via the UI diff --git a/forwardport/changelog/2021-09/fwbot-rplus-error.md b/forwardport/changelog/2021-09/fwbot-rplus-error.md new file mode 100644 index 00000000..e792d7ee --- /dev/null +++ b/forwardport/changelog/2021-09/fwbot-rplus-error.md @@ -0,0 +1 @@ +IMP: error messages when trying to `@fw-bot r+` on pull requests not under its purview diff --git a/forwardport/changelog/2021-09/outstanding.md b/forwardport/changelog/2021-09/outstanding.md new file mode 100644 index 00000000..8e83757d --- /dev/null +++ b/forwardport/changelog/2021-09/outstanding.md @@ -0,0 +1 @@ +ADD: list of outstanding forward-ports diff --git a/forwardport/changelog/2021-10/delegate-followup.md b/forwardport/changelog/2021-10/delegate-followup.md new file mode 100644 index 00000000..e3fcfc8b --- /dev/null +++ b/forwardport/changelog/2021-10/delegate-followup.md @@ -0,0 +1 @@ +FIX: allow delegate reviewers *on forward ports* to approve the followups, it worked fine for delegates on the original pull request but a delegation on a forward port would only work for that specific PR (note: only works if the followups don't already exist) diff --git a/forwardport/changelog/2021-10/followupdate-race.md b/forwardport/changelog/2021-10/followupdate-race.md new file mode 100644 index 00000000..06db5066 --- /dev/null +++ b/forwardport/changelog/2021-10/followupdate-race.md @@ -0,0 +1 @@ +FIX: rare condition where updating a forwardport would then require all followups to be individually approved diff --git a/forwardport/changelog/2021-10/fw-reapproval.md b/forwardport/changelog/2021-10/fw-reapproval.md new file mode 100644 index 00000000..8abdc008 --- /dev/null +++ b/forwardport/changelog/2021-10/fw-reapproval.md @@ -0,0 +1 @@ +FIX: don't trigger an error message when using `fw-bot r+` and some of the PRs were already approved diff --git a/forwardport/changelog/2021-10/outstanding-layout.md b/forwardport/changelog/2021-10/outstanding-layout.md new file mode 100644 index 00000000..c8d0a71b --- /dev/null +++ b/forwardport/changelog/2021-10/outstanding-layout.md @@ -0,0 +1 @@ +IMP: layout and features of the "outstanding forward port" page, show the oldest-merged PRs first and allow filtering by reviewer diff --git a/forwardport/controllers.py b/forwardport/controllers.py new file mode 100644 index 00000000..af464dcb --- /dev/null +++ b/forwardport/controllers.py @@ -0,0 +1,15 @@ +import pathlib + +from odoo.addons.runbot_merge.controllers.dashboard import MergebotDashboard + +class Dashboard(MergebotDashboard): + def _entries(self): + changelog = pathlib.Path(__file__).parent / 'changelog' + if not changelog.is_dir(): + return super()._entries() + + return super()._entries() + [ + (d.name, [f.read_text(encoding='utf-8') for f in d.iterdir() if f.is_file()]) + for d in changelog.iterdir() + ] + diff --git a/forwardport/data/views.xml b/forwardport/data/views.xml index fba29023..ff7f66c9 100644 --- a/forwardport/data/views.xml +++ b/forwardport/data/views.xml @@ -13,7 +13,7 @@ ('source_id', '!=', False), ('state', 'not in', ['merged', 'closed']), ])"/> -
+
outstanding forward-ports diff --git a/runbot_merge/changelog/2021-09/conflict_authorship.md b/runbot_merge/changelog/2021-09/conflict_authorship.md new file mode 100644 index 00000000..51bdc24a --- /dev/null +++ b/runbot_merge/changelog/2021-09/conflict_authorship.md @@ -0,0 +1 @@ +ADD: refuse merging commits without an email set, this is mostly to be used by the forwardport-bot diff --git a/runbot_merge/changelog/2021-09/different_project_link.md b/runbot_merge/changelog/2021-09/different_project_link.md new file mode 100644 index 00000000..7de4f0d3 --- /dev/null +++ b/runbot_merge/changelog/2021-09/different_project_link.md @@ -0,0 +1 @@ +FIX: two PRs with the same label in different projects should not be considered linked anymore diff --git a/runbot_merge/changelog/2021-09/drafts.md b/runbot_merge/changelog/2021-09/drafts.md new file mode 100644 index 00000000..c986709c --- /dev/null +++ b/runbot_merge/changelog/2021-09/drafts.md @@ -0,0 +1 @@ +ADD: mergebot should not accept merging draft PR anymore diff --git a/runbot_merge/changelog/2021-09/fetch_closed.md b/runbot_merge/changelog/2021-09/fetch_closed.md new file mode 100644 index 00000000..446c6357 --- /dev/null +++ b/runbot_merge/changelog/2021-09/fetch_closed.md @@ -0,0 +1 @@ +FIX: when fetching an unknown PR and it's closed, don't lose that information diff --git a/runbot_merge/changelog/2021-09/persistent_linked_prs.md b/runbot_merge/changelog/2021-09/persistent_linked_prs.md new file mode 100644 index 00000000..db9cbe5e --- /dev/null +++ b/runbot_merge/changelog/2021-09/persistent_linked_prs.md @@ -0,0 +1 @@ +IMP: keep showing linked PRs after a PR has been merged diff --git a/runbot_merge/changelog/2021-09/rebase_tagging.md b/runbot_merge/changelog/2021-09/rebase_tagging.md new file mode 100644 index 00000000..554c34a8 --- /dev/null +++ b/runbot_merge/changelog/2021-09/rebase_tagging.md @@ -0,0 +1 @@ +ADD: when integrating a PR via rebasing, tag all the commits with the source PR so they're easier to find diff --git a/runbot_merge/changelog/2021-09/staging_failure_message.md b/runbot_merge/changelog/2021-09/staging_failure_message.md new file mode 100644 index 00000000..26064528 --- /dev/null +++ b/runbot_merge/changelog/2021-09/staging_failure_message.md @@ -0,0 +1 @@ +FIX: when a PR fails at staging, link the correct status in the message posted on the PR diff --git a/runbot_merge/changelog/2021-09/timestamps.md b/runbot_merge/changelog/2021-09/timestamps.md new file mode 100644 index 00000000..35213013 --- /dev/null +++ b/runbot_merge/changelog/2021-09/timestamps.md @@ -0,0 +1 @@ +IMP: cleanup timestamp displays, always show the tzoffset, UTC on hover in the main page (easier to relate to logs), local in the per-branch listing diff --git a/runbot_merge/changelog/2021-10/changelog.md b/runbot_merge/changelog/2021-10/changelog.md new file mode 100644 index 00000000..2c7e19e2 --- /dev/null +++ b/runbot_merge/changelog/2021-10/changelog.md @@ -0,0 +1 @@ +ADD: a changelog feature you can now see here diff --git a/runbot_merge/changelog/2021-10/commit-title-edition.md b/runbot_merge/changelog/2021-10/commit-title-edition.md new file mode 100644 index 00000000..db2ca200 --- /dev/null +++ b/runbot_merge/changelog/2021-10/commit-title-edition.md @@ -0,0 +1 @@ +FIX: don't rewrite commit titles, this can lead to odd effects when it's incorrectly formatted and interpreted as a pseudo-header diff --git a/runbot_merge/changelog/2021-10/pr_description_up_to_date.md b/runbot_merge/changelog/2021-10/pr_description_up_to_date.md new file mode 100644 index 00000000..cdbfbad1 --- /dev/null +++ b/runbot_merge/changelog/2021-10/pr_description_up_to_date.md @@ -0,0 +1 @@ +FIX: ensure the merge message matches the up-to-date PR descriptions, the two could desync if we'd missed an update diff --git a/runbot_merge/changelog/2021-10/pr_errors.md b/runbot_merge/changelog/2021-10/pr_errors.md new file mode 100644 index 00000000..069cd0f5 --- /dev/null +++ b/runbot_merge/changelog/2021-10/pr_errors.md @@ -0,0 +1 @@ +FIX: correctly display the error message when a PR is in error diff --git a/runbot_merge/changelog/2021-10/pr_page.md b/runbot_merge/changelog/2021-10/pr_page.md new file mode 100644 index 00000000..0cfee6a1 --- /dev/null +++ b/runbot_merge/changelog/2021-10/pr_page.md @@ -0,0 +1 @@ +IMP: add reviewer and direct link to backend in PR pages diff --git a/runbot_merge/changelog/2021-10/review-without-email.md b/runbot_merge/changelog/2021-10/review-without-email.md new file mode 100644 index 00000000..167038ed --- /dev/null +++ b/runbot_merge/changelog/2021-10/review-without-email.md @@ -0,0 +1 @@ +CHG: reject reviewers without an email configured, the fallback to `@users.noreply.github.com` turns out to be confusing diff --git a/runbot_merge/changelog/2021-10/reviewer-merge-methods.md b/runbot_merge/changelog/2021-10/reviewer-merge-methods.md new file mode 100644 index 00000000..95202210 --- /dev/null +++ b/runbot_merge/changelog/2021-10/reviewer-merge-methods.md @@ -0,0 +1 @@ +IMP: allow delegate reviewers to set merge methods diff --git a/runbot_merge/changelog/2021-10/squash.md b/runbot_merge/changelog/2021-10/squash.md new file mode 100644 index 00000000..9441cfe2 --- /dev/null +++ b/runbot_merge/changelog/2021-10/squash.md @@ -0,0 +1 @@ +ADD: squash-mode, currently only for single-commit PRs to make it easier to edit commit messages when they're incorrectly formatted diff --git a/runbot_merge/controllers/dashboard.py b/runbot_merge/controllers/dashboard.py index 33919a82..4686d815 100644 --- a/runbot_merge/controllers/dashboard.py +++ b/runbot_merge/controllers/dashboard.py @@ -1,10 +1,17 @@ # -*- coding: utf-8 -*- +import collections import json +import pathlib +import markdown +import markupsafe import werkzeug.exceptions +from lxml import etree +from lxml.builder import ElementMaker from odoo.http import Controller, route, request +A = ElementMaker(namespace="http://www.w3.org/2005/Atom") LIMIT = 20 class MergebotDashboard(Controller): @route('/runbot_merge', auth="public", type="http", website=True) @@ -26,6 +33,29 @@ class MergebotDashboard(Controller): 'next': stagings[-1].staged_at if len(stagings) > LIMIT else None, }) + def _entries(self): + changelog = pathlib.Path(__file__).parent.parent / 'changelog' + if changelog.is_dir(): + return [ + (d.name, [f.read_text(encoding='utf-8') for f in d.iterdir() if f.is_file()]) + for d in changelog.iterdir() + ] + return [] + + def entries(self, item_converter): + entries = collections.OrderedDict() + for key, items in sorted(self._entries(), reverse=True): + entries.setdefault(key, []).extend(map(item_converter, items)) + return entries + + @route('/runbot_merge/changelog', auth='public', type='http', website=True) + def changelog(self): + md = markdown.Markdown(extensions=['nl2br'], output_format='html5') + entries = self.entries(lambda t: markupsafe.Markup(md.convert(t))) + return request.render('runbot_merge.changelog', { + 'entries': entries, + }) + @route('///pull/', auth='public', type='http', website=True) def pr(self, org, repo, pr): pr_id = request.env['runbot_merge.pull_requests'].sudo().search([ diff --git a/runbot_merge/views/templates.xml b/runbot_merge/views/templates.xml index 616bafee..49e475b3 100644 --- a/runbot_merge/views/templates.xml +++ b/runbot_merge/views/templates.xml @@ -14,12 +14,15 @@
+
+ Changelog +
-
+