12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(********************************************************************************)(* crs - A tool for managing code review comments embedded in source code *)(* Copyright (C) 2024-2025 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. *)(********************************************************************************)letfind_enclosing_repo~from=letvcs_git=Volgo_git_unix.create()inmatchVcs.find_enclosing_repo_rootvcs_git~from~store:[Fsegment.dot_git,`Git;Fsegment.dot_hg,`Hg]with|Some((`Gitasvcs_kind),repo_root)->{Enclosing_repo.vcs_kind;repo_root;vcs=(vcs_git:>Enclosing_repo.vcs)}|Some((`Hgasvcs_kind),repo_root)->letvcs_hg=Volgo_hg_unix.create()in{Enclosing_repo.vcs_kind;repo_root;vcs=(vcs_hg:>Enclosing_repo.vcs)}|None->Err.raisePp.O.[Pp.text"Failed to locate enclosing repo root from '"++Pp_tty.path(moduleAbsolute_path)from++Pp.text"'."][@coverageoff];;letrelativize~repo_root~cwd~path=letpath=Absolute_path.relativize~root:cwdpathinmatchAbsolute_path.chop_prefixpath~prefix:(repo_root|>Vcs.Repo_root.to_absolute_path)with|Somerelative_path->Vcs.Path_in_repo.of_relative_pathrelative_path|None->Err.raisePp.O.[Pp.text"Path "++Pp_tty.path(moduleAbsolute_path)path++Pp.text" is not in repo."];;letfilters=letopenCommand.Stdinletonefilter=let+select=Arg.flag[Cr_comment.Filter.to_stringfilter;Printf.sprintf"%c"(Cr_comment.Filter.shorthandfilter)]~doc:(Printf.sprintf"Select only CRs of type %S"(Cr_comment.Filter.to_stringfilter))inifselectthen[filter]else[]inlet+all=oneAlland+invalid=oneInvalidand+crs=oneCRsand+xcrs=oneXCRsand+now=oneNowand+soon=oneSoonand+someday=oneSomedayinletfilters=List.concat[all;invalid;crs;xcrs;now;soon;someday]inmatchfilterswith|[]->`Default|_::_asfilters->`Suppliedfilters;;