Login
Artifact [cf89296325]
Login

Artifact cf8929632527ee6df050add2ed5c49762f58e220:


/* require() plugin which returns a handle to the repo Db object for
   Fossil.require's shared Fossil.Context.  If no repo has been opened
   when this is called, it opens the repo specified via the
   --repo-db|-R=FILENAME CLI script flag.
*/

/* reminder to self: we address require.fsl directly here,
   instead of via require()'ing it, for efficiency's sake.
*/
affirm requireS2;
affirm const F = requireS2.fsl;
affirm F inherits Fossil.Context;
if(!F.db || !F.db.repo){
    requireS2(
        ['cliargs'],
        proc(args){
            var f = args.takeFlag('repo-db',args.takeFlag('R'))
                ||| throw "No repo db specified. "+
                "Pass the --repo-db|-R=filename "+
                "SCRIPT flag (after --) to the interpreter.";
            ('string' === typename f) || throw "Invalid argument type for the --repo-db|-R=DBFILE flag";
            F.openRepo(f);
        });
    affirm F.db.repo;
};
return F.db.repo;