Currently, any 400 error that occurs will be swallowed by
`SrhtService.post()` [1] - the caller must use a validation object to
become aware of an error.
This commit adds such error handling by means of a validation object to
the build submission webhook.
[1]: https://git.sr.ht/~sircmpwn/hub.sr.ht/tree/f37b9e6e/item/hubsrht/services.py#L56-60
When pushing a tag, the webhooks are invoked twice: once for the the
commit and once for the tag. Avoid inserting the same comment multiple
times. This also fixes the multiple comments issue when a git repository
is associated with more than one project.
This requires the new graphql method to get specific tickets by their
scoped ID on a given tracker.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Allow referencing tracker tickets in git commit messages via specific
trailer words:
Fixes: <ticket url>
Implements: <ticket url>
References: <ticket url>
These must follow standard git trailer syntax. The trailers are
extracted from commit messages with the function added in previous
commit. The ticket url must point to a valid ticket.
A comment will be inserted in the ticket with a back reference to the
git commit and its original author. The comment will be made by the user
who pushed the commit. E.g.:
~arkanoid REPORTED -> FIXED 9 seconds ago
John Doe referenced this ticket in commit b4dc4c40.
Open tickets referenced by a Fixes trailer will be resolved with the
FIXED resolution.
Open tickets referenced by an Implements trailer will be resolved with
the IMPLEMENTED resolution.
Caveats:
* Only the 25 most recent commit messages will be considered when
pushing long series. This should be a fairly sane limitation.
* If the user pushing commits does not have triage/comment permissions
on the bug tracker, nothing will happen.
* Invalid/non-existent ticket urls are ignored.
* When a git repository is part of more than one project, the webhook
will run once per project and update the same ticket(s) once per
project as well.
* If an already resolved ticket is referenced by a Fixes or Implements
trailer, only a comment will be added.
Link: https://git-scm.com/docs/git-interpret-trailers
Implements: https://todo.sr.ht/~sircmpwn/hub.sr.ht/55
Signed-off-by: Robin Jarry <robin@jarry.cc>
Relative links from project summaries resulted in raw pages rather
than rendered pages for both mercurial and git repositories.
This patch is intended to match the behavior of git.sr.ht and hg.sr.ht
README rendering by passing the previous raw links as secondary link
prefixes (for rendering images) but otherwise link to rendered
resources.
related ticket: todo.sr.ht/~sircmpwn/hub.sr.ht/67
It looked like using hoedown (through misaka), which is very
unmaintained, was leading to a lot of issues (see [0]). This replaces
misaka by mistletoe [1], without losing any functionality (I hope).
This affects the call to 'markdown()', removing the now-redundant
argument for the tag whitelist.
[0]: https://todo.sr.ht/~sircmpwn/sr.ht/20
[1]: https://github.com/miyuchina/mistletoe