Something went wrong. Try again.
A local Git merge queue with content-bound gate verdicts
Something went wrong. Try again.
2.8 kB · 64 lines
OCaml
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465open Cmdlineropen Cmdliner.Term.Syntaxmodule Command_init = Merge_queue_eio.Command_init
let action out : Common.action Term.t = let+ out and+ url = let doc = "Clone the repository at $(docv) into a new directory, as $(b,git clone) \ does, and set the queue up there." in Arg.(value & pos 0 (some string) None & info [] ~docv:"URL" ~doc) and+ dir = let doc = "The directory to clone into, as $(b,git clone) takes it; by default the \ last part of $(i,URL), without $(b,.git)." in Arg.(value & pos 1 (some string) None & info [] ~docv:"DIR" ~doc) and+ no_fetch = let doc = "Contact no remote, as $(b,git submodule update --no-fetch) does: adopt \ the copy of $(b,mq/config) the remote-tracking branches already hold, \ else create the rules here. By default every remote is asked for its \ copy first, and one that does not answer ends the call." in Arg.(value & flag & info [ "no-fetch" ] ~doc) in fun ctx -> Common.result out (Command_init.run ?dir ~fetch:(not no_fetch) ctx ~url)
let cmd = let man = [ `S Manpage.s_description; `P "Set the queue up in this repository: create the rules branch \ $(b,mq/config), or adopt the remote's, and install the \ reference-transaction hook. It is the one command that runs outside a \ repository. Running it again changes nothing."; `P "A repository that builds with another declares it in the lock, \ $(b,.mqmodule) at the root of its tree, one section per dependency, \ in Git's configuration syntax:"; `Pre "[dependency \"lib\"]\n\ \tpath = vendor/lib\n\ \turl = https://example.org/lib.git\n\ \tcommit = <the 40 hexadecimal digits of a commit of lib>"; `P "The $(b,path) and $(b,url) lines are the consumer's to write, and mq \ writes the $(b,commit) line at each land that moves the dependency. \ When the entry branch's tip holds a lock, $(b,mq init) reads it and, \ for each dependency, the dependencies of dependencies first, keeps \ the link at $(b,path) when it resolves to a repository of the \ $(b,url); otherwise it takes the repository a local $(b,url) names, \ or clones $(b,url) beside this checkout (or into the directory the \ local key $(b,mq.dependencies) names) and sets its queue up there. It \ fetches the locked commit once when that repository lacks it, and \ points the link at $(b,path) at a read-only worktree of the locked \ commit."; ] in Common.v "init" ~exits:Act ~uninitialised:true ~doc:"Set the queue up in this repository." ~man action