123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121(********************************************************************************)(* crs - A tool for managing inline review comments embedded in source code *)(* Copyright (C) 2024-2026 Mathieu Barbin <mathieu.barbin@gmail.com> *)(* *)(* This file is part of crs. *)(* *)(* crs is free software; you can redistribute it and/or modify it under the *)(* terms of the GNU Lesser General Public License as published by the Free *)(* Software Foundation either version 3 of the License, or any later version, *)(* with the LGPL-3.0 Linking Exception. *)(* *)(* crs is distributed in the hope that it will be useful, but WITHOUT ANY *)(* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *)(* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License and *)(* the file `NOTICE.md` at the root of this repository for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* and the LGPL-3.0 Linking Exception along with this library. If not, see *)(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)(********************************************************************************)moduleRaw_assignee=structtypet=|Not_due_now|Invalid|RecipientofUser_handle.t|ReporterofUser_handle.t|Unaddressedletcompute~cr~config:_=matchCr_comment.prioritycrwith|Soon|Someday->Not_due_now|Now->(matchCr_comment.headercrwith|Error_->Invalid|Okh->(matchCr_comment.Header.statushwith|XCR->Reporter(Cr_comment.Header.reporterh)|CR->(matchCr_comment.Header.recipienthwith|Someuser->Recipientuser|None->Unaddressed)));;endmoduleReason=structtypet=|Not_due_now|Recipient|Reporter|Default_repo_owner|No_default_repo_owner|Pull_request_authorletall=[Not_due_now;Recipient;Reporter;Default_repo_owner;No_default_repo_owner;Pull_request_author];;letvariant_constructor_name=function|Not_due_now->"Not_due_now"|Recipient->"Recipient"|Reporter->"Reporter"|Default_repo_owner->"Default_repo_owner"|No_default_repo_owner->"No_default_repo_owner"|Pull_request_author->"Pull_request_author";;letto_dynt=Dyn.Variant(variant_constructor_namet,[])letto_string_hum=function|Not_due_now->"CR not due now"|Recipient->"CR recipient"|Reporter->"CR reporter"|Default_repo_owner->"default repo owner"|No_default_repo_owner->"no default repo owner configured"|Pull_request_author->"PR author";;endtypet={user:User_handle.toption;reason:Reason.t}letto_dyn{user;reason}=Dyn.record["user",user|>Dyn.optionUser_handle.to_dyn;"reason",reason|>Reason.to_dyn];;letof_raw~(raw_assignee:Raw_assignee.t)~(config:Config.t)~(review_mode:Review_mode.t)=letdefault=matchreview_modewith|Pull_request{author;base=_}->{user=Someauthor;reason=Pull_request_author}|Revision->(matchConfig.default_repo_ownerconfigwith|Someowner->{user=Someowner;reason=Default_repo_owner}|None->{user=None;reason=No_default_repo_owner})inmatchraw_assigneewith|Not_due_now->{user=None;reason=Not_due_now}|Invalid->default|Recipientrecipient->{user=Somerecipient;reason=Recipient}|Reporterreporter->{user=Somereporter;reason=Reporter}|Unaddressed->default;;letcompute~cr~(config:Config.t)~(review_mode:Review_mode.t)=letraw_assignee=Raw_assignee.compute~cr~configinof_raw~raw_assignee~config~review_mode;;