diff options
author | Mete Polat <metepolat2000@gmail.com> | 2020-02-27 23:29:32 +0000 |
---|---|---|
committer | Daniel Axtens <dja@axtens.net> | 2020-03-16 11:15:57 +1100 |
commit | 83f364aad66c35e31df8d0871ec2b62016eba337 (patch) | |
tree | 9a9c650ec0e11f18ca5b25145ec64ae9689ba378 /releasenotes | |
parent | 27c2acf56cd30e77c932a1dde87b6fc1de8eeb2c (diff) | |
download | patchwork-83f364aad66c35e31df8d0871ec2b62016eba337.tar patchwork-83f364aad66c35e31df8d0871ec2b62016eba337.tar.gz |
REST: Add patch relations
View relations and add/update/delete them as a maintainer. Maintainers
can only create relations of patches which are part of a project they
maintain. Because this is a writable many-many nested relationship, it
behaves a little unusually. In short:
- All operations use PATCH to the 'related' field of a patch
- To relate a patch to another patch, say 7 to 19, either:
PATCH /api/patch/7 related := [19]
PATCH /api/patch/19 related := [7]
- To delete a patch from a relation, say 1, 21 and 42 are related but we
only want it to be 1 and 42:
PATCH /api/patch/21 related := []
* You _cannot_ remove a patch from a relation by patching another
patch in the relation: I'm trying to avoid read-modify-write loops.
* Relations that would be left with just 1 patch are deleted. This is
only ensured in the API - the admin interface will let you do this.
- Break-before-make: if you have [1, 12, 24] and [7, 15, 42] and you want
to end up with [1, 12, 15, 42], you have to remove 15 from the second
relation first:
PATCH /api/patch/1 related := [15] will fail with 409 Conflict.
Instead do:
PATCH /api/patch/15 related := []
PATCH /api/patch/1 related := [15]
-> 200 OK, [1, 12, 15, 42] and [7, 42] are the resulting relations
Signed-off-by: Mete Polat <metepolat2000@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Diffstat (limited to 'releasenotes')
-rw-r--r-- | releasenotes/notes/add-patch-relations-c96bb6c567b416d8.yaml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/releasenotes/notes/add-patch-relations-c96bb6c567b416d8.yaml b/releasenotes/notes/add-patch-relations-c96bb6c567b416d8.yaml new file mode 100644 index 0000000..44e704c --- /dev/null +++ b/releasenotes/notes/add-patch-relations-c96bb6c567b416d8.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Patches can now be related to other patches (e.g. to cross-reference + revisions). Relations can be set via the REST API by maintainers + (currently only for patches of projects they maintain). Patches can + belong to at most one relation at a time. +api: + - | + Relations are available via ``/patches/{patchID}/`` endpoint, in + the ``related`` field. |