Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch hooks Excluding Merge-Ins
This is equivalent to a diff from d4c45b50 to 94658201
2020-07-12
| ||
18:36 | Merge the (still experimental) hooks implementation onto trunk. ... (check-in: 9d8db79c user: drh tags: trunk) | |
18:35 | Documentation updates. ... (Closed-Leaf check-in: 94658201 user: drh tags: hooks) | |
2020-07-10
| ||
10:02 | Forum post collapse/expand: 1) Is now full width to balance visibility and mobile accessibility. 2) Use arrows (instead of words) to convey intent. 3) When collapsing, scroll the collapser widget to the top of the viewport so that the next post is in view (avoids manual scrolling back up). 4) double-click on a large post toggles expand/collapse (avoids scrolling when expanded). ... (check-in: a30a6db4 user: stephan tags: trunk) | |
2020-07-09
| ||
22:19 | Merge enhancements from trunk. ... (check-in: 7e845bfd user: drh tags: hooks) | |
20:50 | Improvements to bisect built-in documentation. No changes to code. ... (check-in: d4c45b50 user: drh tags: trunk) | |
20:44 | Add the "fossil bisect skip" command. ... (check-in: 9e7262b4 user: drh tags: trunk) | |
Changes to src/backoffice.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** ** This file contains code used to manage a background processes that ** occur after user interaction with the repository. Examples of ** backoffice processing includes: ** ** * Sending alerts and notifications ** * Processing the email queue ** * Automatically syncing to peer repositories ** ** Backoffice processing is automatically started whenever there are ** changes to the repository. The backoffice process dies off after ** a period of inactivity. ** ** Steps are taken to ensure that only a single backoffice process is | > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** ** This file contains code used to manage a background processes that ** occur after user interaction with the repository. Examples of ** backoffice processing includes: ** ** * Sending alerts and notifications ** * Processing the email queue ** * Handling post-receive hooks ** * Automatically syncing to peer repositories ** ** Backoffice processing is automatically started whenever there are ** changes to the repository. The backoffice process dies off after ** a period of inactivity. ** ** Steps are taken to ensure that only a single backoffice process is |
︙ | ︙ | |||
625 626 627 628 629 630 631 632 633 634 635 636 637 638 | } /* Here is where the actual work of the backoffice happens */ nThis = alert_backoffice(0); if( nThis ){ backoffice_log("%d alerts", nThis); nTotal += nThis; } nThis = smtp_cleanup(); if( nThis ){ backoffice_log("%d SMTPs", nThis); nTotal += nThis; } /* Close the log */ if( backofficeFILE ){ if( nTotal || backofficeLogDetail ){ if( nTotal==0 ) backoffice_log("no-op"); #if !defined(_WIN32) gettimeofday(&sEnd,0); | > > | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | } /* Here is where the actual work of the backoffice happens */ nThis = alert_backoffice(0); if( nThis ){ backoffice_log("%d alerts", nThis); nTotal += nThis; } nThis = smtp_cleanup(); if( nThis ){ backoffice_log("%d SMTPs", nThis); nTotal += nThis; } nThis = hook_backoffice(); if( nThis ){ backoffice_log("%d hooks", nThis); nTotal += nThis; } /* Close the log */ if( backofficeFILE ){ if( nTotal || backofficeLogDetail ){ if( nTotal==0 ) backoffice_log("no-op"); #if !defined(_WIN32) gettimeofday(&sEnd,0); |
︙ | ︙ |
Changes to src/checkin.c.
︙ | ︙ | |||
1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | "# All merged-in branches will be closed due to the --integrate flag\n" "#\n", -1 ); } prompt_for_user_comment(pComment, &prompt); blob_reset(&prompt); } /* ** Populate the Global.aCommitFile[] based on the command line arguments ** to a [commit] command. Global.aCommitFile is an array of integers ** sized at (N+1), where N is the number of arguments passed to [commit]. ** The contents are the [id] values from the vfile table corresponding ** to the filenames passed as arguments. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | "# All merged-in branches will be closed due to the --integrate flag\n" "#\n", -1 ); } prompt_for_user_comment(pComment, &prompt); blob_reset(&prompt); } /* ** Prepare text that describes a pending commit and write it into ** a file at the root of the check-in. Return the name of that file. ** ** Space to hold the returned filename is obtained from fossil_malloc() ** and should be freed by the caller. The caller should also unlink ** the file when it is done. */ static char *prepare_commit_description_file( CheckinInfo *p, /* Information about this commit */ int parent_rid /* parent check-in */ ){ Blob *pDesc; char *zTags; char *zFilename; Blob desc; unsigned int r[2]; blob_init(&desc, 0, 0); pDesc = &desc; blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot); blob_appendf(pDesc, "repository %s\n", g.zRepositoryName); blob_appendf(pDesc, "user %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); blob_appendf(pDesc, "branch %s\n", (p->zBranch && p->zBranch[0]) ? p->zBranch : "trunk"); zTags = info_tags_of_checkin(parent_rid, 1); if( zTags || p->azTag ){ blob_append(pDesc, "tags ", -1); if(zTags){ blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : ""); } if(p->azTag){ int i = 0; for( ; p->azTag[i]; ++i ){ blob_appendf(pDesc, "%s%s", p->azTag[i], p->azTag[i+1] ? ", " : ""); } } blob_appendf(pDesc, "\n"); } status_report(pDesc, C_DEFAULT | C_FATAL); if( g.markPrivate ){ blob_append(pDesc, "private-branch\n", -1); } if( p->integrateFlag ){ blob_append(pDesc, "integrate\n", -1); } sqlite3_randomness(sizeof(r), r); zFilename = mprintf("%scommit-description-%08x%08x.txt", g.zLocalRoot, r[0], r[1]); blob_write_to_file(pDesc, zFilename); blob_reset(pDesc); return zFilename; } /* ** Populate the Global.aCommitFile[] based on the command line arguments ** to a [commit] command. Global.aCommitFile is an array of integers ** sized at (N+1), where N is the number of arguments passed to [commit]. ** The contents are the [id] values from the vfile table corresponding ** to the filenames passed as arguments. |
︙ | ︙ | |||
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | ** --allow-fork allow the commit to fork ** --allow-older allow a commit older than its ancestor ** --baseline use a baseline manifest in the commit process ** --bgcolor COLOR apply COLOR to this one check-in only ** --branch NEW-BRANCH-NAME check in to this new branch ** --branchcolor COLOR apply given COLOR to the branch ** --close close the branch being committed ** --delta use a delta manifest in the commit process ** --integrate close all merged-in branches ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment ** -M|--message-file FILE read the commit comment from given file ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** --no-prompt This option disables prompting the user for ** input and assumes an answer of 'No' for every ** question. ** --no-warnings omit all warnings about file contents ** --nosign do not attempt to sign this commit with gpg ** --override-lock allow a check-in even though parent is locked ** --private do not sync changes and their descendants | > > > > < < | | 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | ** --allow-fork allow the commit to fork ** --allow-older allow a commit older than its ancestor ** --baseline use a baseline manifest in the commit process ** --bgcolor COLOR apply COLOR to this one check-in only ** --branch NEW-BRANCH-NAME check in to this new branch ** --branchcolor COLOR apply given COLOR to the branch ** --close close the branch being committed ** --date-override DATETIME DATE to use instead of 'now' ** --delta use a delta manifest in the commit process ** --hash verify file status using hashing rather ** than relying on file mtimes ** --integrate close all merged-in branches ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment ** -M|--message-file FILE read the commit comment from given file ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** --no-prompt This option disables prompting the user for ** input and assumes an answer of 'No' for every ** question. ** --no-warnings omit all warnings about file contents ** --no-verify do not run before-commit hooks ** --nosign do not attempt to sign this commit with gpg ** --override-lock allow a check-in even though parent is locked ** --private do not sync changes and their descendants ** --tag TAG-NAME assign given tag TAG-NAME to the check-in ** --trace debug tracing. ** --user-override USER USER to use instead of the current default ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. |
︙ | ︙ | |||
2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 | char *zUuid; /* Hash of the new check-in */ int useHash = 0; /* True to verify file status using hashing */ int noSign = 0; /* True to omit signing the manifest using GPG */ int privateFlag = 0; /* True if the --private option is present */ int privateParent = 0; /* True if the parent check-in is private */ int isAMerge = 0; /* True if checking in a merge */ int noWarningFlag = 0; /* True if skipping all warnings */ int noPrompt = 0; /* True if skipping all prompts */ int forceFlag = 0; /* Undocumented: Disables all checks */ int forceDelta = 0; /* Force a delta-manifest */ int forceBaseline = 0; /* Force a baseline-manifest */ int allowConflict = 0; /* Allow unresolve merge conflicts */ int allowEmpty = 0; /* Allow a commit with no changes */ int allowFork = 0; /* Allow the commit to fork */ | > > | 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 | char *zUuid; /* Hash of the new check-in */ int useHash = 0; /* True to verify file status using hashing */ int noSign = 0; /* True to omit signing the manifest using GPG */ int privateFlag = 0; /* True if the --private option is present */ int privateParent = 0; /* True if the parent check-in is private */ int isAMerge = 0; /* True if checking in a merge */ int noWarningFlag = 0; /* True if skipping all warnings */ int noVerify = 0; /* Do not run before-commit hooks */ int bTrace = 0; /* Debug tracing */ int noPrompt = 0; /* True if skipping all prompts */ int forceFlag = 0; /* Undocumented: Disables all checks */ int forceDelta = 0; /* Force a delta-manifest */ int forceBaseline = 0; /* Force a baseline-manifest */ int allowConflict = 0; /* Allow unresolve merge conflicts */ int allowEmpty = 0; /* Allow a commit with no changes */ int allowFork = 0; /* Allow the commit to fork */ |
︙ | ︙ | |||
2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 | allowConflict = find_option("allow-conflict",0,0)!=0; allowEmpty = find_option("allow-empty",0,0)!=0; allowFork = find_option("allow-fork",0,0)!=0; if( find_option("override-lock",0,0)!=0 ) allowFork = 1; allowOlder = find_option("allow-older",0,0)!=0; noPrompt = find_option("no-prompt", 0, 0)!=0; noWarningFlag = find_option("no-warnings", 0, 0)!=0; sCiInfo.zBranch = find_option("branch","b",1); sCiInfo.zColor = find_option("bgcolor",0,1); sCiInfo.zBrClr = find_option("branchcolor",0,1); sCiInfo.closeFlag = find_option("close",0,0)!=0; sCiInfo.integrateFlag = find_option("integrate",0,0)!=0; sCiInfo.zMimetype = find_option("mimetype",0,1); while( (zTag = find_option("tag",0,1))!=0 ){ | > > | 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 | allowConflict = find_option("allow-conflict",0,0)!=0; allowEmpty = find_option("allow-empty",0,0)!=0; allowFork = find_option("allow-fork",0,0)!=0; if( find_option("override-lock",0,0)!=0 ) allowFork = 1; allowOlder = find_option("allow-older",0,0)!=0; noPrompt = find_option("no-prompt", 0, 0)!=0; noWarningFlag = find_option("no-warnings", 0, 0)!=0; noVerify = find_option("no-verify",0,0)!=0; bTrace = find_option("trace",0,0)!=0; sCiInfo.zBranch = find_option("branch","b",1); sCiInfo.zColor = find_option("bgcolor",0,1); sCiInfo.zBrClr = find_option("branchcolor",0,1); sCiInfo.closeFlag = find_option("close",0,0)!=0; sCiInfo.integrateFlag = find_option("integrate",0,0)!=0; sCiInfo.zMimetype = find_option("mimetype",0,1); while( (zTag = find_option("tag",0,1))!=0 ){ |
︙ | ︙ | |||
2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 | " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) ){ fossil_fatal("cannot commit against a closed leaf"); } /* Always exit the loop on the second pass */ if( bRecheck ) break; /* Get the check-in comment. This might involve prompting the ** user for the check-in comment, in which case we should resync ** to renew the check-in lock and repeat the checks for conflicts. */ if( zComment ){ blob_zero(&comment); | > > > > > > > > > > > | 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 | " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) ){ fossil_fatal("cannot commit against a closed leaf"); } /* Always exit the loop on the second pass */ if( bRecheck ) break; /* Run before-commit hooks */ if( !noVerify ){ char *zAuxFile = prepare_commit_description_file(&sCiInfo,vid); int rc = hook_run("before-commit",zAuxFile,bTrace); file_delete(zAuxFile); fossil_free(zAuxFile); if( rc ){ fossil_fatal("Before-commit hook failed\n"); } } /* Get the check-in comment. This might involve prompting the ** user for the check-in comment, in which case we should resync ** to renew the check-in lock and repeat the checks for conflicts. */ if( zComment ){ blob_zero(&comment); |
︙ | ︙ |
Added src/hook.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | /* ** Copyright (c) 2020 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program 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. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file implements "hooks" - external programs that can be run ** when various events occur on a Fossil repository. ** ** Hooks are stored in the following CONFIG variables: ** ** hooks A JSON-array of JSON objects. Each object describes ** a single hook. Example: ** { ** "type": "after-receive", // type of hook ** "cmd": "command-to-run", // command to run ** "seq": 50 // run in this order ** } ** ** hook-last-rcvid The last rcvid for which post-receive hooks were ** run. ** ** hook-embargo Do not run hooks again before this julianday. ** ** For "after-receive" hooks, a list of the received artifacts is sent ** into the command via standard input. Each line of input begins with ** the hash of the artifact and continues with a description of the ** interpretation of the artifact. */ #include "config.h" #include "hook.h" /* ** List of valid hook types: */ static const char *azType[] = { "after-receive", "before-commit", "disabled", }; /* ** Return true if zType is a valid hook type. */ static int is_valid_hook_type(const char *zType){ int i; for(i=0; i<count(azType); i++){ if( strcmp(azType[i],zType)==0 ) return 1; } return 0; } /* ** Throw an error if zType is not a valid hook type */ static void validate_type(const char *zType){ int i; char *zMsg; if( is_valid_hook_type(zType) ) return; zMsg = mprintf("\"%s\" is not a valid hook type - should be one of:", zType); for(i=0; i<count(azType); i++){ zMsg = mprintf("%z %s", zMsg, azType[i]); } fossil_fatal("%s", zMsg); } /* ** Translate a hook command string into its executable format by ** converting every %-substitutions as follows: ** ** %F -> Name of the fossil executable ** %R -> Name of the repository ** %A -> Auxiliary information filename (might be empty string) ** ** The returned string is obtained from fossil_malloc() and should ** be freed by the caller. */ static char *hook_subst( const char *zCmd, const char *zAuxFilename /* Name of auxiliary information file */ ){ Blob r; int i; blob_init(&r, 0, 0); while( zCmd[0] ){ for(i=0; zCmd[i] && zCmd[i]!='%'; i++){} blob_append(&r, zCmd, i); if( zCmd[i]==0 ) break; if( zCmd[i+1]=='F' ){ blob_append(&r, g.nameOfExe, -1); zCmd += i+2; }else if( zCmd[i+1]=='R' ){ blob_append(&r, g.zRepositoryName, -1); zCmd += i+2; }else if( zCmd[i+1]=='A' ){ if( zAuxFilename ) blob_append(&r, zAuxFilename, -1); zCmd += i+2; }else{ blob_append(&r, zCmd+i, 1); zCmd += i+1; } } blob_str(&r); return r.aData; } /* ** Record the fact that new artifacts are expected within N seconds ** (N is normally a small number) and so post-receive hooks should ** probably be deferred until after the new artifacts arrive. ** ** If N==0, then there is no expectation of new artifacts arriving ** soon and so post-receive hooks can be run without delay. */ void hook_expecting_more_artifacts(int N){ if( N>0 ){ db_multi_exec( "REPLACE INTO config(name,value,mtime)" "VALUES('hook-embargo',now()+%d,now())", N ); }else{ db_unset("hook-embargo",0); } } /* ** Fill the Blob pOut with text that describes all artifacts ** received after zBaseRcvid up to and including zNewRcvid. ** Except, never include more than one days worth of changes. ** ** If zBaseRcvid is NULL, then use the "hook-last-rcvid" setting. ** If zNewRcvid is NULL, use the last available rcvid. */ void hook_changes(Blob *pOut, const char *zBaseRcvid, const char *zNewRcvid){ char *zWhere; Stmt q; if( zBaseRcvid==0 ){ zBaseRcvid = db_get("hook-last-rcvid","0"); } if( zNewRcvid==0 ){ zNewRcvid = db_text("0","SELECT max(rcvid) FROM rcvfrom"); } /* Adjust the baseline rcvid to omit change that are more than ** 24 hours older than the most recent change. */ zBaseRcvid = db_text(0, "SELECT min(rcvid) FROM rcvfrom" " WHERE rcvid>=%d" " AND mtime>=(SELECT mtime FROM rcvfrom WHERE rcvid=%d)-1.0", atoi(zBaseRcvid), atoi(zNewRcvid) ); zWhere = mprintf("IN (SELECT rid FROM blob WHERE rcvid>%d AND rcvid<=%d)", atoi(zBaseRcvid), atoi(zNewRcvid)); describe_artifacts(zWhere); fossil_free(zWhere); db_prepare(&q, "SELECT uuid, summary FROM description"); while( db_step(&q)==SQLITE_ROW ){ blob_appendf(pOut, "%s %s\n", db_column_text(&q,0), db_column_text(&q,1)); } db_finalize(&q); } /* ** COMMAND: hook ** ** Usage: %fossil hook COMMAND ... ** ** Commands include: ** ** > fossil hook add --command COMMAND --type TYPE --sequence NUMBER ** ** Create a new hook. The --command and --type arguments are ** required. --sequence is optional. ** ** > fossil hook delete ID ... ** ** Delete one or more hooks by their IDs. ID can be "all" ** to delete all hooks. Caution: There is no "undo" for ** this operation. Deleted hooks are permanently lost. ** ** > fossil hook edit --command COMMAND --type TYPE --sequence NUMBER ID ... ** ** Make changes to one or more existing hooks. The ID argument ** is either a hook-id, or a list of hook-ids, or the keyword ** "all". For example, to disable hook number 2, use: ** ** fossil hook edit --type disabled 2 ** ** > fossil hook list ** ** Show all current hooks ** ** > fossil hook status ** ** Print the values of CONFIG table entries that are relevant to ** hook processing. Used for debugging. ** ** > fossil hook test [OPTIONS] ID ** ** Run the hook script given by ID for testing purposes. ** Options: ** ** --dry-run Print the script on stdout rather than run it ** --base-rcvid N Pretend that the hook-last-rcvid value is N ** --new-rcvid M Pretend that the last rcvid valud is M ** --aux-file NAME NAME is substituted for %A in the script ** ** The --base-rcvid and --new-rcvid options are silently ignored if ** the hook type is not "after-receive". The default values for ** --base-rcvid and --new-rcvid cause the last recieve to be processed. */ void hook_cmd(void){ const char *zCmd; int nCmd; db_find_and_open_repository(0, 0); if( g.argc<3 ){ usage("SUBCOMMAND ..."); } zCmd = g.argv[2]; nCmd = (int)strlen(zCmd); if( strncmp(zCmd, "add", nCmd)==0 ){ const char *zCmd = find_option("command",0,1); const char *zType = find_option("type",0,1); const char *zSeq = find_option("sequence",0,1); int nSeq; verify_all_options(); if( zCmd==0 || zType==0 ){ fossil_fatal("the --command and --type options are required"); } validate_type(zType); nSeq = zSeq ? atoi(zSeq) : 10; db_begin_write(); db_multi_exec( "INSERT OR IGNORE INTO config(name,value) VALUES('hooks','[]');\n" "UPDATE config" " SET value=json_insert(" " CASE WHEN json_valid(value) THEN value ELSE '[]' END,'$[#]'," " json_object('cmd',%Q,'type',%Q,'seq',%d))," " mtime=now()" " WHERE name='hooks';", zCmd, zType, nSeq ); db_commit_transaction(); }else if( strncmp(zCmd, "edit", nCmd)==0 ){ const char *zCmd = find_option("command",0,1); const char *zType = find_option("type",0,1); const char *zSeq = find_option("sequence",0,1); int nSeq; int i; verify_all_options(); if( zCmd==0 && zType==0 && zSeq==0 ){ fossil_fatal("at least one of --command, --type, or --sequence" " is required"); } if( zType ) validate_type(zType); nSeq = zSeq ? atoi(zSeq) : 10; if( g.argc<4 ) usage("delete ID ..."); db_begin_write(); for(i=3; i<g.argc; i++){ Blob sql; if( sqlite3_strglob("*[^0-9]*", g.argv[i])==0 ){ fossil_fatal("not a valid ID: \"%s\"", g.argv[i]); } int id = atoi(g.argv[i]); blob_init(&sql, 0, 0); blob_append_sql(&sql, "UPDATE config SET mtime=now(), value=" "json_replace(CASE WHEN json_valid(value) THEN value ELSE '[]' END"); if( zCmd ){ blob_append_sql(&sql, ",'$[%d].cmd',%Q", id, zCmd); } if( zType ){ blob_append_sql(&sql, ",'$[%d].type',%Q", id, zType); } if( zSeq ){ blob_append_sql(&sql, ",'$[%d].seq',%d", id, nSeq); } blob_append_sql(&sql,") WHERE name='hooks';"); db_multi_exec("%s", blob_sql_text(&sql)); blob_reset(&sql); } db_commit_transaction(); }else if( strncmp(zCmd, "delete", nCmd)==0 ){ int i; verify_all_options(); if( g.argc<4 ) usage("delete ID ..."); db_begin_write(); db_multi_exec( "INSERT OR IGNORE INTO config(name,value) VALUES('hooks','[]');\n" ); for(i=3; i<g.argc; i++){ const char *zId = g.argv[i]; if( strcmp(zId,"all")==0 ){ db_set("hooks","[]", 0); break; } if( sqlite3_strglob("*[^0-9]*", g.argv[i])==0 ){ fossil_fatal("not a valid ID: \"%s\"", g.argv[i]); } db_multi_exec( "UPDATE config" " SET value=json_remove(" " CASE WHEN json_valid(value) THEN value ELSE '[]' END,'$[%d]')," " mtime=now()" " WHERE name='hooks';", atoi(zId) ); } db_commit_transaction(); }else if( strncmp(zCmd, "list", nCmd)==0 ){ Stmt q; verify_all_options(); int n = 0; db_prepare(&q, "SELECT jx.key," " json_extract(jx.value,'$.seq')," " json_extract(jx.value,'$.cmd')," " json_extract(jx.value,'$.type')" " FROM config, json_each(config.value) AS jx" " WHERE config.name='hooks' AND json_valid(config.value)" ); while( db_step(&q)==SQLITE_ROW ){ if( n++ ) fossil_print("\n"); fossil_print("%3d: type = %s\n", db_column_int(&q,0), db_column_text(&q,3)); fossil_print(" command = %s\n", db_column_text(&q,2)); fossil_print(" sequence = %d\n", db_column_int(&q,1)); } db_finalize(&q); }else if( strncmp(zCmd, "status", nCmd)==0 ){ Stmt q; db_prepare(&q, "SELECT name, quote(value) FROM config WHERE name IN" "('hooks','hook-embargo','hook-last-rcvid') ORDER BY name" ); while( db_step(&q)==SQLITE_ROW ){ fossil_print("%s: %s\n", db_column_text(&q,0), db_column_text(&q,1)); } db_finalize(&q); }else if( strncmp(zCmd, "test", nCmd)==0 ){ Stmt q; int bDryRun = find_option("dry-run", "n", 0)!=0; const char *zOrigRcvid = find_option("base-rcvid",0,1); const char *zNewRcvid = find_option("new-rcvid",0,1); const char *zAuxFilename = find_option("aux-file",0,1); verify_all_options(); if( g.argc<4 ) usage("test ID"); int id = atoi(g.argv[3]); if( zOrigRcvid==0 ){ zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom"); } db_prepare(&q, "SELECT json_extract(value,'$[%d].cmd'), " " json_extract(value,'$[%d].type')=='after-receive'" " FROM config" " WHERE name='hooks' AND json_valid(value)", id, id ); while( db_step(&q)==SQLITE_ROW ){ const char *zCmd = db_column_text(&q,0); char *zCmd2 = hook_subst(zCmd, zAuxFilename); int needOut = db_column_int(&q,1); Blob out; blob_init(&out,0,0); if( needOut ) hook_changes(&out, zOrigRcvid, zNewRcvid); if( bDryRun ){ fossil_print("%s\n", zCmd2); if( needOut ){ fossil_print("%s", blob_str(&out)); } }else if( needOut ){ int fdFromChild; FILE *toChild; int pidChild; if( popen2(zCmd2, &fdFromChild, &toChild, &pidChild, 0)==0 ){ if( toChild ){ fwrite(blob_buffer(&out),1,blob_size(&out),toChild); } pclose2(fdFromChild, toChild, pidChild); } }else{ fossil_system(zCmd2); } fossil_free(zCmd2); blob_reset(&out); } db_finalize(&q); }else { fossil_fatal("unknown command \"%s\" - should be one of: " "add delete edit list test", zCmd); } } /* ** The backoffice calls this routine to run the after-receive hooks. */ int hook_backoffice(void){ Stmt q; const char *zLastRcvid = 0; char *zNewRcvid = 0; Blob chng; int cnt = 0; db_begin_write(); if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){ goto hook_backoffice_done; /* No hooks */ } if( db_int(0, "SELECT now()<value+0 FROM config" " WHERE name='hook-embargo'") ){ goto hook_backoffice_done; /* Within the embargo window */ } zLastRcvid = db_get("hook-last-rcvid","0"); zNewRcvid = db_text("0","SELECT max(rcvid) FROM rcvfrom"); if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){ goto hook_backoffice_done; /* no new content */ } blob_init(&chng, 0, 0); db_prepare(&q, "SELECT json_extract(jx.value,'$.cmd') " " FROM config, json_each(config.value) AS jx" " WHERE config.name='hooks' AND json_valid(config.value)" " AND json_extract(jx.value,'$.type')='after-receive'" " ORDER BY json_extract(jx.value,'$.seq');" ); while( db_step(&q)==SQLITE_ROW ){ char *zCmd; int fdFromChild; FILE *toChild; int childPid; if( cnt==0 ){ hook_changes(&chng, zLastRcvid, 0); } zCmd = hook_subst(db_column_text(&q,0), 0); if( popen2(zCmd, &fdFromChild, &toChild, &childPid, 0) ){ if( toChild ){ fwrite(blob_buffer(&chng),1,blob_size(&chng),toChild); } pclose2(fdFromChild, toChild, childPid); } fossil_free(zCmd); cnt++; } db_finalize(&q); db_set("hook-last-rcvid", zNewRcvid, 0); blob_reset(&chng); hook_backoffice_done: db_commit_transaction(); return cnt; } /* ** Run all hooks of type zType. Use zAuxFile as the auxiliary information ** file. ** ** If any hook returns non-zero, then stop running and return non-zero. ** Return zero only if all hooks return zero. */ int hook_run(const char *zType, const char *zAuxFile, int traceFlag){ Stmt q; int rc = 0; if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){ return 0; } db_prepare(&q, "SELECT json_extract(jx.value,'$.cmd') " " FROM config, json_each(config.value) AS jx" " WHERE config.name='hooks' AND json_valid(config.value)" " AND json_extract(jx.value,'$.type')=%Q" " ORDER BY json_extract(jx.value,'$.seq');", zType ); while( db_step(&q)==SQLITE_ROW ){ char *zCmd; zCmd = hook_subst(db_column_text(&q,0), zAuxFile); if( traceFlag ){ fossil_print("%s hook: %s\n", zType, zCmd); } rc = fossil_system(zCmd); fossil_free(zCmd); if( rc ){ break; } } db_finalize(&q); return rc; } |
Changes to src/main.mk.
︙ | ︙ | |||
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ $(SRCDIR)/http_transport.c \ $(SRCDIR)/import.c \ $(SRCDIR)/info.c \ $(SRCDIR)/json.c \ | > | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/hook.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ $(SRCDIR)/http_transport.c \ $(SRCDIR)/import.c \ $(SRCDIR)/info.c \ $(SRCDIR)/json.c \ |
︙ | ︙ | |||
311 312 313 314 315 316 317 318 319 320 321 322 323 324 | $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ $(OBJDIR)/http_transport_.c \ $(OBJDIR)/import_.c \ $(OBJDIR)/info_.c \ $(OBJDIR)/json_.c \ | > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/hook_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ $(OBJDIR)/http_transport_.c \ $(OBJDIR)/import_.c \ $(OBJDIR)/info_.c \ $(OBJDIR)/json_.c \ |
︙ | ︙ | |||
456 457 458 459 460 461 462 463 464 465 466 467 468 469 | $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ $(OBJDIR)/http_transport.o \ $(OBJDIR)/import.o \ $(OBJDIR)/info.o \ $(OBJDIR)/json.o \ | > | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/hook.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ $(OBJDIR)/http_transport.o \ $(OBJDIR)/import.o \ $(OBJDIR)/info.o \ $(OBJDIR)/json.o \ |
︙ | ︙ | |||
788 789 790 791 792 793 794 795 796 797 798 799 800 801 | $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h \ $(OBJDIR)/import_.c:$(OBJDIR)/import.h \ $(OBJDIR)/info_.c:$(OBJDIR)/info.h \ $(OBJDIR)/json_.c:$(OBJDIR)/json.h \ | > | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/hook_.c:$(OBJDIR)/hook.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h \ $(OBJDIR)/import_.c:$(OBJDIR)/import.h \ $(OBJDIR)/info_.c:$(OBJDIR)/info.h \ $(OBJDIR)/json_.c:$(OBJDIR)/json.h \ |
︙ | ︙ | |||
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | $(OBJDIR)/hname_.c: $(SRCDIR)/hname.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/hname.c >$@ $(OBJDIR)/hname.o: $(OBJDIR)/hname_.c $(OBJDIR)/hname.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hname.o -c $(OBJDIR)/hname_.c $(OBJDIR)/hname.h: $(OBJDIR)/headers $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/http.c >$@ $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c | > > > > > > > > | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | $(OBJDIR)/hname_.c: $(SRCDIR)/hname.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/hname.c >$@ $(OBJDIR)/hname.o: $(OBJDIR)/hname_.c $(OBJDIR)/hname.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hname.o -c $(OBJDIR)/hname_.c $(OBJDIR)/hname.h: $(OBJDIR)/headers $(OBJDIR)/hook_.c: $(SRCDIR)/hook.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/hook.c >$@ $(OBJDIR)/hook.o: $(OBJDIR)/hook_.c $(OBJDIR)/hook.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hook.o -c $(OBJDIR)/hook_.c $(OBJDIR)/hook.h: $(OBJDIR)/headers $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/http.c >$@ $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c |
︙ | ︙ |
Changes to src/makemake.tcl.
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | fshell fusefs fuzz glob graph gzip hname http http_socket http_transport import info json json_artifact | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | fshell fusefs fuzz glob graph gzip hname hook http http_socket http_transport import info json json_artifact |
︙ | ︙ |
Changes to src/xfer.c.
︙ | ︙ | |||
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 | send_all(&xfer); if( xfer.syncPrivate ) send_private(&xfer); }else if( isPull ){ create_cluster(); send_unclustered(&xfer); if( xfer.syncPrivate ) send_private(&xfer); } db_multi_exec("DROP TABLE onremote; DROP TABLE unk;"); manifest_crosslink_end(MC_PERMIT_HOOKS); /* Send the server timestamp last, in case prior processing happened ** to use up a significant fraction of our time window. */ zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')"); | > | 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | send_all(&xfer); if( xfer.syncPrivate ) send_private(&xfer); }else if( isPull ){ create_cluster(); send_unclustered(&xfer); if( xfer.syncPrivate ) send_private(&xfer); } hook_expecting_more_artifacts(xfer.nGimmeSent?60:0); db_multi_exec("DROP TABLE onremote; DROP TABLE unk;"); manifest_crosslink_end(MC_PERMIT_HOOKS); /* Send the server timestamp last, in case prior processing happened ** to use up a significant fraction of our time window. */ zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')"); |
︙ | ︙ |
Changes to win/Makefile.dmc.
︙ | ︙ | |||
26 27 28 29 30 31 32 | TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen | | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O RC=$(DMDIR)\bin\rcc RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__ APPNAME = $(OBJDIR)\fossil$(E) all: $(APPNAME) $(APPNAME) : translate$E mkindex$E codecheck1$E headers $(OBJ) $(OBJDIR)\link cd $(OBJDIR) codecheck1$E $(SRC) $(DMDIR)\bin\link @link $(OBJDIR)\fossil.res: $B\win\fossil.rc $(RC) $(RCFLAGS) -o$@ $** $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res +echo add ajax alerts allrepo attach backlink backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file fileedit finfo foci forum fshell fusefs fuzz glob graph gzip hname hook http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar terminal th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@ +echo fossil >> $@ +echo fossil >> $@ +echo $(LIBS) >> $@ +echo. >> $@ +echo fossil >> $@ translate$E: $(SRCDIR)\translate.c |
︙ | ︙ | |||
431 432 433 434 435 436 437 438 439 440 441 442 443 444 | +translate$E $** > $@ $(OBJDIR)\hname$O : hname_.c hname.h $(TCC) -o$@ -c hname_.c hname_.c : $(SRCDIR)\hname.c +translate$E $** > $@ $(OBJDIR)\http$O : http_.c http.h $(TCC) -o$@ -c http_.c http_.c : $(SRCDIR)\http.c +translate$E $** > $@ | > > > > > > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | +translate$E $** > $@ $(OBJDIR)\hname$O : hname_.c hname.h $(TCC) -o$@ -c hname_.c hname_.c : $(SRCDIR)\hname.c +translate$E $** > $@ $(OBJDIR)\hook$O : hook_.c hook.h $(TCC) -o$@ -c hook_.c hook_.c : $(SRCDIR)\hook.c +translate$E $** > $@ $(OBJDIR)\http$O : http_.c http.h $(TCC) -o$@ -c http_.c http_.c : $(SRCDIR)\http.c +translate$E $** > $@ |
︙ | ︙ | |||
979 980 981 982 983 984 985 | $(OBJDIR)\zip$O : zip_.c zip.h $(TCC) -o$@ -c zip_.c zip_.c : $(SRCDIR)\zip.c +translate$E $** > $@ headers: makeheaders$E page_index.h builtin_data.h VERSION.h | | | 985 986 987 988 989 990 991 992 993 | $(OBJDIR)\zip$O : zip_.c zip.h $(TCC) -o$@ -c zip_.c zip_.c : $(SRCDIR)\zip.c +translate$E $** > $@ headers: makeheaders$E page_index.h builtin_data.h VERSION.h +makeheaders$E add_.c:add.h ajax_.c:ajax.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backlink_.c:backlink.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h fileedit_.c:fileedit.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h hook_.c:hook.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h terminal_.c:terminal.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h @copy /Y nul: headers |
Changes to win/Makefile.mingw.
︙ | ︙ | |||
476 477 478 479 480 481 482 483 484 485 486 487 488 489 | $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ $(SRCDIR)/http_transport.c \ $(SRCDIR)/import.c \ $(SRCDIR)/info.c \ $(SRCDIR)/json.c \ | > | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/hook.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ $(SRCDIR)/http_transport.c \ $(SRCDIR)/import.c \ $(SRCDIR)/info.c \ $(SRCDIR)/json.c \ |
︙ | ︙ | |||
723 724 725 726 727 728 729 730 731 732 733 734 735 736 | $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ $(OBJDIR)/http_transport_.c \ $(OBJDIR)/import_.c \ $(OBJDIR)/info_.c \ $(OBJDIR)/json_.c \ | > | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/hook_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ $(OBJDIR)/http_transport_.c \ $(OBJDIR)/import_.c \ $(OBJDIR)/info_.c \ $(OBJDIR)/json_.c \ |
︙ | ︙ | |||
868 869 870 871 872 873 874 875 876 877 878 879 880 881 | $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ $(OBJDIR)/http_transport.o \ $(OBJDIR)/import.o \ $(OBJDIR)/info.o \ $(OBJDIR)/json.o \ | > | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/hook.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ $(OBJDIR)/http_transport.o \ $(OBJDIR)/import.o \ $(OBJDIR)/info.o \ $(OBJDIR)/json.o \ |
︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 | $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h \ $(OBJDIR)/import_.c:$(OBJDIR)/import.h \ $(OBJDIR)/info_.c:$(OBJDIR)/info.h \ $(OBJDIR)/json_.c:$(OBJDIR)/json.h \ | > | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/hook_.c:$(OBJDIR)/hook.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h \ $(OBJDIR)/import_.c:$(OBJDIR)/import.h \ $(OBJDIR)/info_.c:$(OBJDIR)/info.h \ $(OBJDIR)/json_.c:$(OBJDIR)/json.h \ |
︙ | ︙ | |||
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | $(OBJDIR)/hname_.c: $(SRCDIR)/hname.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/hname.c >$@ $(OBJDIR)/hname.o: $(OBJDIR)/hname_.c $(OBJDIR)/hname.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hname.o -c $(OBJDIR)/hname_.c $(OBJDIR)/hname.h: $(OBJDIR)/headers $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/http.c >$@ $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c | > > > > > > > > | 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 | $(OBJDIR)/hname_.c: $(SRCDIR)/hname.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/hname.c >$@ $(OBJDIR)/hname.o: $(OBJDIR)/hname_.c $(OBJDIR)/hname.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hname.o -c $(OBJDIR)/hname_.c $(OBJDIR)/hname.h: $(OBJDIR)/headers $(OBJDIR)/hook_.c: $(SRCDIR)/hook.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/hook.c >$@ $(OBJDIR)/hook.o: $(OBJDIR)/hook_.c $(OBJDIR)/hook.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/hook.o -c $(OBJDIR)/hook_.c $(OBJDIR)/hook.h: $(OBJDIR)/headers $(OBJDIR)/http_.c: $(SRCDIR)/http.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/http.c >$@ $(OBJDIR)/http.o: $(OBJDIR)/http_.c $(OBJDIR)/http.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/http.o -c $(OBJDIR)/http_.c |
︙ | ︙ |
Changes to win/Makefile.msc.
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 408 409 410 411 | "$(OX)\fshell_.c" \ "$(OX)\fusefs_.c" \ "$(OX)\fuzz_.c" \ "$(OX)\glob_.c" \ "$(OX)\graph_.c" \ "$(OX)\gzip_.c" \ "$(OX)\hname_.c" \ "$(OX)\http_.c" \ "$(OX)\http_socket_.c" \ "$(OX)\http_ssl_.c" \ "$(OX)\http_transport_.c" \ "$(OX)\import_.c" \ "$(OX)\info_.c" \ "$(OX)\json_.c" \ | > | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | "$(OX)\fshell_.c" \ "$(OX)\fusefs_.c" \ "$(OX)\fuzz_.c" \ "$(OX)\glob_.c" \ "$(OX)\graph_.c" \ "$(OX)\gzip_.c" \ "$(OX)\hname_.c" \ "$(OX)\hook_.c" \ "$(OX)\http_.c" \ "$(OX)\http_socket_.c" \ "$(OX)\http_ssl_.c" \ "$(OX)\http_transport_.c" \ "$(OX)\import_.c" \ "$(OX)\info_.c" \ "$(OX)\json_.c" \ |
︙ | ︙ | |||
644 645 646 647 648 649 650 651 652 653 654 655 656 657 | "$(OX)\fshell$O" \ "$(OX)\fusefs$O" \ "$(OX)\fuzz$O" \ "$(OX)\glob$O" \ "$(OX)\graph$O" \ "$(OX)\gzip$O" \ "$(OX)\hname$O" \ "$(OX)\http$O" \ "$(OX)\http_socket$O" \ "$(OX)\http_ssl$O" \ "$(OX)\http_transport$O" \ "$(OX)\import$O" \ "$(OX)\info$O" \ "$(OX)\json$O" \ | > | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | "$(OX)\fshell$O" \ "$(OX)\fusefs$O" \ "$(OX)\fuzz$O" \ "$(OX)\glob$O" \ "$(OX)\graph$O" \ "$(OX)\gzip$O" \ "$(OX)\hname$O" \ "$(OX)\hook$O" \ "$(OX)\http$O" \ "$(OX)\http_socket$O" \ "$(OX)\http_ssl$O" \ "$(OX)\http_transport$O" \ "$(OX)\import$O" \ "$(OX)\info$O" \ "$(OX)\json$O" \ |
︙ | ︙ | |||
870 871 872 873 874 875 876 877 878 879 880 881 882 883 | echo "$(OX)\fshell.obj" >> $@ echo "$(OX)\fusefs.obj" >> $@ echo "$(OX)\fuzz.obj" >> $@ echo "$(OX)\glob.obj" >> $@ echo "$(OX)\graph.obj" >> $@ echo "$(OX)\gzip.obj" >> $@ echo "$(OX)\hname.obj" >> $@ echo "$(OX)\http.obj" >> $@ echo "$(OX)\http_socket.obj" >> $@ echo "$(OX)\http_ssl.obj" >> $@ echo "$(OX)\http_transport.obj" >> $@ echo "$(OX)\import.obj" >> $@ echo "$(OX)\info.obj" >> $@ echo "$(OX)\json.obj" >> $@ | > | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | echo "$(OX)\fshell.obj" >> $@ echo "$(OX)\fusefs.obj" >> $@ echo "$(OX)\fuzz.obj" >> $@ echo "$(OX)\glob.obj" >> $@ echo "$(OX)\graph.obj" >> $@ echo "$(OX)\gzip.obj" >> $@ echo "$(OX)\hname.obj" >> $@ echo "$(OX)\hook.obj" >> $@ echo "$(OX)\http.obj" >> $@ echo "$(OX)\http_socket.obj" >> $@ echo "$(OX)\http_ssl.obj" >> $@ echo "$(OX)\http_transport.obj" >> $@ echo "$(OX)\import.obj" >> $@ echo "$(OX)\info.obj" >> $@ echo "$(OX)\json.obj" >> $@ |
︙ | ︙ | |||
1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\hname$O" : "$(OX)\hname_.c" "$(OX)\hname.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\hname_.c" "$(OX)\hname_.c" : "$(SRCDIR)\hname.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\http$O" : "$(OX)\http_.c" "$(OX)\http.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\http_.c" "$(OX)\http_.c" : "$(SRCDIR)\http.c" "$(OBJDIR)\translate$E" $** > $@ | > > > > > > | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\hname$O" : "$(OX)\hname_.c" "$(OX)\hname.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\hname_.c" "$(OX)\hname_.c" : "$(SRCDIR)\hname.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\hook$O" : "$(OX)\hook_.c" "$(OX)\hook.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\hook_.c" "$(OX)\hook_.c" : "$(SRCDIR)\hook.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\http$O" : "$(OX)\http_.c" "$(OX)\http.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\http_.c" "$(OX)\http_.c" : "$(SRCDIR)\http.c" "$(OBJDIR)\translate$E" $** > $@ |
︙ | ︙ | |||
2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 | "$(OX)\fshell_.c":"$(OX)\fshell.h" \ "$(OX)\fusefs_.c":"$(OX)\fusefs.h" \ "$(OX)\fuzz_.c":"$(OX)\fuzz.h" \ "$(OX)\glob_.c":"$(OX)\glob.h" \ "$(OX)\graph_.c":"$(OX)\graph.h" \ "$(OX)\gzip_.c":"$(OX)\gzip.h" \ "$(OX)\hname_.c":"$(OX)\hname.h" \ "$(OX)\http_.c":"$(OX)\http.h" \ "$(OX)\http_socket_.c":"$(OX)\http_socket.h" \ "$(OX)\http_ssl_.c":"$(OX)\http_ssl.h" \ "$(OX)\http_transport_.c":"$(OX)\http_transport.h" \ "$(OX)\import_.c":"$(OX)\import.h" \ "$(OX)\info_.c":"$(OX)\info.h" \ "$(OX)\json_.c":"$(OX)\json.h" \ | > | 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | "$(OX)\fshell_.c":"$(OX)\fshell.h" \ "$(OX)\fusefs_.c":"$(OX)\fusefs.h" \ "$(OX)\fuzz_.c":"$(OX)\fuzz.h" \ "$(OX)\glob_.c":"$(OX)\glob.h" \ "$(OX)\graph_.c":"$(OX)\graph.h" \ "$(OX)\gzip_.c":"$(OX)\gzip.h" \ "$(OX)\hname_.c":"$(OX)\hname.h" \ "$(OX)\hook_.c":"$(OX)\hook.h" \ "$(OX)\http_.c":"$(OX)\http.h" \ "$(OX)\http_socket_.c":"$(OX)\http_socket.h" \ "$(OX)\http_ssl_.c":"$(OX)\http_ssl.h" \ "$(OX)\http_transport_.c":"$(OX)\http_transport.h" \ "$(OX)\import_.c":"$(OX)\import.h" \ "$(OX)\info_.c":"$(OX)\info.h" \ "$(OX)\json_.c":"$(OX)\json.h" \ |
︙ | ︙ |
Added www/hooks.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | # Hooks Hooks are short scripts that Fossil runs at defined points of processing. Administrators can use hooks to help enforce policy or connect Fossil to a continuous integration (CI) system. ## Interim Documentation. * This is a work-in-progress. The interface is in flux. For the time being, the documentation as a list of bullet points. We hope to transform this into a proper document later, after things settle down. * Contributions and suggestions to the hook system and/or the documentation are welcomed. ## General Notes. * Each hooks has a "type", a "sequence", and a "command". The command is a shell command that runs at the appropriate time. The type is currently one of "after-receive", "before-commit", "commit-msg", or "disabled". The sequence is an arbitrary integer. * There can be multiple hooks of the same type. When that is the case, the hooks are run in order of ascending sequence. * Use the "fossil hook" command to create, edit, and delete hooks. * Use the "fossil hook test" command to test new hooks. ## Hook Scripts * All scripts are expected to run relatively quickly. If a long-running process is started by a hook, it should be run in the background so that the original script can return. * The "%F" sequence inside the script is translated into the name of the fossil executable. * The "%R" sequence in the script is translated in to the name of the repository. * The "%A" sequence becomes the name of an auxiliary input files, the meaning of which depends on the hook type. The auxiliary filename might be an empty string. Take care to use appropriate quoting! ## Disabled Hooks * Hooks with type "disabled" never run. They are a place-holder for scripts that might be converted to some other hook-type later. For example, the command "fossil hook edit --type disabled ID" can be used to temporarily disable the hook named ID, and then "fossil hook edit --type after-receive ID" can be used to reenable it later. ## After-Receive Hooks * The "after-receive" hook is run by [the backoffice](./backoffice.md) whenever new artifacts are received into the repository. The artifacts have already been committed and so there is nothing that the after-receive hook can do to block them. * The after-receive hooks are intended to be run on a server to start up a background testing or CI process. But they can also be run on the client side. The key point is that after-receive hooks are invoked by backoffice, so backoffice must be running in order to fire after-receive hooks. * The exit code from the after-receive script is ignored. * The standard input to the after-receive hook is a list of new artifacts, one per line. The first token on each line is the hash of the new artifact. After the hash is a human-readable text description of what the artifact represents. * Sometimes the same artifact can represent two or more things. For example, the same artifact might represent two or more files in the check-out (assuming the files hold identical content). In that case, the text description that is input to the after-receive hook only shows one of the possible uses for the artifact. * If two or more pushes occur against a repository at about the same time, then the set of artifacts added by both pushes might be combined into a single after-receive callback. * Fossil holds a write transaction on the repository while the after-receive hook is running. If the script needs to access the database, then the database will need to be in WAL mode so that readers can co-exist with the writer. Or the script might just launch a background process that waits until the hook script finishes and the transaction commits before it tries to access the repository database. * A push might not deliver all of the artifacts for a checkin. If Fossil knows that a /xfer HTTP request is incomplete, it will defer running the after-receive push for 60 seconds, or unti a complete /xfer request is received. This helps to prevent after-receive hooks from running when incomplete checkins exist in the repository, but it does not provide hard guarantees, as there is no way to do that in a distributed system. * The list of artifacts delivered to standard input of the after-receive hook will not contain more than 24-hours worth of artifacts. If the backoffice has been shut down for a while such that after-receive hooks have not been running, and more than 24-hours of changes have accumulated since the last run of an after-receive hook, then only the most recent 24-hours is included in the input. ## Before-Commit Hooks * Before-commit hooks run during the "fossil commit" command before the user is prompted for the check-in comment. Fossil holds a write-transaction on the repository when the before-commit hook is running, so the repository needs to be in WAL mode if the script needs to access the repository. * The %A substitution is the name of a "commit description file" that shows the details of the commit in progress. To see what a "commit description file" looks like, set a before-commit hook with a command of "cat %Q" and then run a sample commit with the --dry-run option. * If any before-commit hook returns a non-zero exit code, then the commit is abandoned. All before-commit hooks must exit(0) in order for the commit to proceed. * The --no-validate flag to the "fossil commit" command prevents any before-commit hooks from running. * The --trace flag to the "fossil commit" command shows each before-commit hook as it is run. * If a before-commit hook fails, it should print an error message on standard output or standard error. Otherwise, the user won't know what went wrong, because Fossil won't tell them. * Nothing is written to standard input of the before-commit hook. The information transmitted to the before-commit hook is contained in the "%A" auxiliary file. The before-commit hook must open and read that file if it wants access to the commit information. ## Commit-Msg Hooks * Commit-msg hooks are not yet implemented. * The commit-msg hooks run during "fossil commit" after the check-in messages has been entered by the user. The "%A" argument to the commit-msg hook is the text of the commit message. The intent of the commit-msg hook is to validate the text of the commit message to (for example) check for typos or ensure that it conforms to standards. * If any commit-msg hook returns a non-zero exit code, then the commit is abandoned. All commit-msg hooks must exit(0) in order for the commit to proceed. * Commit-msg hooks are advisory only. Each developer is in total control of the local repository and can easily bypass the hooks to cause a non-conforming checkin to be committed. |