diff mbox

[5/5] docs: Add delegation guide

Message ID 1476208911-8385-6-git-send-email-stephen@that.guru
State Accepted
Headers show

Commit Message

Stephen Finucane Oct. 11, 2016, 6:01 p.m. UTC
We do autodelegation - let's tell people all about it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 docs/usage/delegation.md | 35 +++++++++++++++++++++++++++++++++++
 mkdocs.yml               |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 docs/usage/delegation.md

Comments

Thomas Monjalon Nov. 28, 2016, 2:43 p.m. UTC | #1
Hi,

2016-10-11 19:01, Stephen Finucane:
> We do autodelegation - let's tell people all about it.

I am reading this documentation at
https://patchwork.readthedocs.io/en/latest/usage/delegation/
I have two questions about this feature.

Is the path starting with a slash?

What happens if a file does not match any rule?
What happens if two files match two rules leading to the same user?
What happens if two files match two rules leading to different users?

Thanks
Stephen Finucane Nov. 28, 2016, 3:13 p.m. UTC | #2
On Mon, 2016-11-28 at 15:43 +0100, Thomas Monjalon wrote:
> Hi,
> 
> 2016-10-11 19:01, Stephen Finucane:
> > We do autodelegation - let's tell people all about it.
> 
> I am reading this documentation at
> https://patchwork.readthedocs.io/en/latest/usage/delegation/
> I have two questions about this feature.
> 
> Is the path starting with a slash?

To be honest, I'm not 100% sure but I would guess no - the paths found
in mails are relative Git paths and we store them as is. However, you'd
probably want to use wildcards anyway unless you're being very
specific. For example, you can delegate this file:

    patchwork/views/cover.py

with varying levels of accuracy using any of these below patterns (and
many more beside):

    *.py
    */cover.py
    patchwork/views/*
    patchwork/views/cover.py
    patchwork/views/*.py
    */views/*

> What happens if a file does not match any rule?

Nothing. The file must be delegated manually, just as before.

> What happens if two files match two rules leading to the same user?

Only one rule will ever be applied. Rules have a 'priority' field,
which is used first (higher values are applied first). In the event of
a conflict, the 'path' field will take priority, alphabetically
ordered. As such, using the above rules, the first will take priority.
This can be confirmed by checking Python's sorting yourself:

    $ python
    >>> paths = ['*.py', '*/cover.py', ..., '*/views/*']
    >>> sorted(paths)
    ['*.py', '*/cover.py', '*/views/*', ...]

> What happens if two files match two rules leading to different users?

Won't happen. See above.

Stephen
diff mbox

Patch

diff --git a/docs/usage/delegation.md b/docs/usage/delegation.md
new file mode 100644
index 0000000..9553fd8
--- /dev/null
+++ b/docs/usage/delegation.md
@@ -0,0 +1,35 @@ 
+# Delegates
+
+Patchwork has the concept of patch delegation. Delegates are akin to reviewers,
+in that they are Patchwork users who are responsible for both reviewing a patch
+and setting its eventual state in Patchwork. Delegation works particularly well
+for larger projects where various subsystems, each with their own
+maintainer(s), can be identified.
+
+## Autodelegation
+
+Autodelegation allows patches to be automatically delegated to a user based on
+the files modified by the patch. To do this, a number of rules can be
+configured in the project admininstration page. This can usually be found at
+`/admin/patchwork/project/<project_id>/change`.
+
+**NOTE:** Autodelegation can only be configured by Patchwork administrators,
+i.e. those that can access the 'admin' panel. If you require configuration of
+autodelegation rules on a local instance, contact your Patchwork administrator.
+
+In this section there are the following fields:
+
+<dl>
+  <dt>Path</dt>
+  <dd>A path in <a href="https://docs.python.org/2/library/fnmatch.html">
+  fnmatch</a> format. The fnmatch library allows for limited, Unix shell-style
+  wildcarding</dd>
+  <dt>User</dt>
+  <dd>The patchwork user that should be autodelegated to the patch</dd>
+  <dt>Priority</dt>
+  <dd>The priority of the rule relative to other patches. Higher values
+  indicate higher priority</dd>
+</dl>
+
+Rules should be configured by setting the above fields and saving the rules.
+These rules will be applied at patch parse time.
diff --git a/mkdocs.yml b/mkdocs.yml
index ceb57d9..72fb368 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -18,3 +18,4 @@  pages:
    - REST API: 'usage/rest.md'
    - XML-RPC API: 'usage/xmlrpc.md'
    - Hint Headers: 'usage/headers.md'
+   - Delegation: 'usage/delegation.md'