Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge trunk |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | cleanX |
| Files: | files | file ages | folders |
| SHA1: |
1cbe4fd9e10e2681a456c1e3d5023404 |
| User & Date: | jan.nijtmans 2015-02-24 03:40:00.000 |
Context
|
2015-04-30
| ||
| 21:24 | Merge trunk check-in: 44bed85354 user: jan.nijtmans tags: cleanX | |
|
2015-02-24
| ||
| 04:40 | Merge cleanX check-in: c4750a1e85 user: jan.nijtmans tags: cleanX-no-clean-glob | |
| 03:40 | Merge trunk check-in: 1cbe4fd9e1 user: jan.nijtmans tags: cleanX | |
| 02:40 | Minor tweaks to coding style and comments. No functional changes. check-in: a97404ef7f user: mistachkin tags: trunk | |
|
2015-01-19
| ||
| 11:59 | merge trunk check-in: aa5dae22a1 user: jan.nijtmans tags: cleanX | |
Changes
Changes to Dockerfile.
1 2 3 4 5 6 | ### # Dockerfile for Fossil ### FROM fedora:21 ### Now install some additional parts we will need for the build | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
###
# Dockerfile for Fossil
###
FROM fedora:21
### Now install some additional parts we will need for the build
RUN yum update -y && yum install -y gcc make zlib-devel openssl-devel tcl tar && yum clean all && groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil
### If you want to build "release", change the next line accordingly.
ENV FOSSIL_INSTALL_VERSION trunk
RUN curl "http://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx
RUN cd fossil-src && ./configure --disable-lineedit --disable-fusefs --json --with-th1-docs --with-th1-hooks --with-tcl --with-tcl-stubs --with-tcl-private-stubs && make;
RUN cp fossil-src/fossil /usr/bin && rm -rf fossil-src && chmod a+rx /usr/bin/fossil && mkdir -p /opt/fossil && chown fossil:fossil /opt/fossil
### Build is done, remove modules no longer needed
RUN yum remove -y gcc make zlib-devel openssl-devel tar && yum clean all
USER fossil
ENV HOME /opt/fossil
RUN fossil new --docker -A admin /opt/fossil/repository.fossil && fossil user password -R /opt/fossil/repository.fossil admin admin && fossil cache init -R /opt/fossil/repository.fossil
|
| ︙ | ︙ |
Changes to VERSION.
|
| | | 1 | 1.31 |
Changes to auto.def.
| ︙ | ︙ | |||
66 67 68 69 70 71 72 |
user-error "system sqlite3 not found"
}
find_internal_sqlite
}
if {[string match *-solaris* [get-define host]]} {
| | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
user-error "system sqlite3 not found"
}
find_internal_sqlite
}
if {[string match *-solaris* [get-define host]]} {
define-append EXTRA_CFLAGS {-D_XOPEN_SOURCE=500 -D__EXTENSIONS__}
}
if {[opt-bool fossil-debug]} {
define-append EXTRA_CFLAGS -DFOSSIL_DEBUG
msg-result "Debugging support enabled"
}
|
| ︙ | ︙ |
Changes to autosetup/jimsh0.c.
| ︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 | #else #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" #define TCL_PLATFORM_PATH_SEPARATOR ":" #define HAVE_VFORK #define HAVE_WAITPID #define HAVE_ISATTY #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #endif | > > | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#else
#define TCL_PLATFORM_OS "unknown"
#define TCL_PLATFORM_PLATFORM "unix"
#define TCL_PLATFORM_PATH_SEPARATOR ":"
#define HAVE_VFORK
#define HAVE_WAITPID
#define HAVE_ISATTY
#define HAVE_MKSTEMP
#define HAVE_LINK
#define HAVE_SYS_TIME_H
#define HAVE_DIRENT_H
#define HAVE_UNISTD_H
#endif
#define JIM_VERSION 76
#ifndef JIM_WIN32COMPAT_H
#define JIM_WIN32COMPAT_H
#ifdef __cplusplus
extern "C" {
|
| ︙ | ︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | DIR *opendir(const char *name); int closedir(DIR *dir); struct dirent *readdir(DIR *dir); #elif defined(__MINGW32__) #define strtod __strtod #endif #endif #ifdef __cplusplus | > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | DIR *opendir(const char *name); int closedir(DIR *dir); struct dirent *readdir(DIR *dir); #elif defined(__MINGW32__) #include <stdlib.h> #define strtod __strtod #endif #endif #ifdef __cplusplus |
| ︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 1053 1054 |
return Jim_EvalSource(interp, "initjimsh.tcl", 1,
"\n"
"\n"
"\n"
"proc _jimsh_init {} {\n"
" rename _jimsh_init {}\n"
"\n"
"\n"
| > > > > > > > > > > > > > > > > | > > > | < | | > | | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
return Jim_EvalSource(interp, "initjimsh.tcl", 1,
"\n"
"\n"
"\n"
"proc _jimsh_init {} {\n"
" rename _jimsh_init {}\n"
" global jim::exe jim::argv0 tcl_interactive auto_path tcl_platform\n"
"\n"
"\n"
" if {[exists jim::argv0]} {\n"
" if {[string match \"*/*\" $jim::argv0]} {\n"
" set jim::exe [file join [pwd] $jim::argv0]\n"
" } else {\n"
" foreach path [split [env PATH \"\"] $tcl_platform(pathSeparator)] {\n"
" set exec [file join [pwd] [string map {\\\\ /} $path] $jim::argv0]\n"
" if {[file executable $exec]} {\n"
" set jim::exe $exec\n"
" break\n"
" }\n"
" }\n"
" }\n"
" }\n"
"\n"
"\n"
" lappend p {*}[split [env JIMLIB {}] $tcl_platform(pathSeparator)]\n"
" if {[exists jim::exe]} {\n"
" lappend p [file dirname $jim::exe]\n"
" }\n"
" lappend p {*}$auto_path\n"
" set auto_path $p\n"
"\n"
" if {$tcl_interactive && [env HOME {}] ne \"\"} {\n"
" foreach src {.jimrc jimrc.tcl} {\n"
" if {[file exists [env HOME]/$src]} {\n"
" uplevel #0 source [env HOME]/$src\n"
" break\n"
" }\n"
" }\n"
" }\n"
" return \"\"\n"
"}\n"
"\n"
"if {$tcl_platform(platform) eq \"windows\"} {\n"
" set jim::argv0 [string map {\\\\ /} $jim::argv0]\n"
"}\n"
"\n"
"_jimsh_init\n"
);
}
int Jim_globInit(Jim_Interp *interp)
{
|
| ︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 |
"\n"
"package require readdir\n"
"\n"
"\n"
"proc glob.globdir {dir pattern} {\n"
" if {[file exists $dir/$pattern]} {\n"
"\n"
| | | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
"\n"
"package require readdir\n"
"\n"
"\n"
"proc glob.globdir {dir pattern} {\n"
" if {[file exists $dir/$pattern]} {\n"
"\n"
" return [list $pattern]\n"
" }\n"
"\n"
" set result {}\n"
" set files [readdir $dir]\n"
" lappend files . ..\n"
"\n"
" foreach name $files {\n"
|
| ︙ | ︙ | |||
1151 1152 1153 1154 1155 1156 1157 |
" break\n"
" }\n"
" }\n"
"\n"
" foreach old $oldexp {\n"
" lappend newexp $old$suf\n"
" }\n"
| | | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
" break\n"
" }\n"
" }\n"
"\n"
" foreach old $oldexp {\n"
" lappend newexp $old$suf\n"
" }\n"
" list $rest {*}$newexp\n"
"}\n"
"\n"
"\n"
"\n"
"proc glob.glob {base pattern} {\n"
" set dir [file dirname $pattern]\n"
" if {$pattern eq $dir || $pattern eq \"\"} {\n"
|
| ︙ | ︙ | |||
1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 |
"\n"
"\n"
"\n"
"\n"
"proc glob {args} {\n"
" set nocomplain 0\n"
" set base \"\"\n"
"\n"
" set n 0\n"
" foreach arg $args {\n"
" if {[info exists param]} {\n"
" set $param $arg\n"
" unset param\n"
" incr n\n"
" continue\n"
" }\n"
" switch -glob -- $arg {\n"
" -d* {\n"
" set switch $arg\n"
" set param base\n"
" }\n"
" -n* {\n"
" set nocomplain 1\n"
" }\n"
| > | < | < < < > > > | | > > | > > > > | | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 |
"\n"
"\n"
"\n"
"\n"
"proc glob {args} {\n"
" set nocomplain 0\n"
" set base \"\"\n"
" set tails 0\n"
"\n"
" set n 0\n"
" foreach arg $args {\n"
" if {[info exists param]} {\n"
" set $param $arg\n"
" unset param\n"
" incr n\n"
" continue\n"
" }\n"
" switch -glob -- $arg {\n"
" -d* {\n"
" set switch $arg\n"
" set param base\n"
" }\n"
" -n* {\n"
" set nocomplain 1\n"
" }\n"
" -ta* {\n"
" set tails 1\n"
" }\n"
" -- {\n"
" incr n\n"
" break\n"
" }\n"
" -* {\n"
" return -code error \"bad option \\\"$arg\\\": must be -directory, -nocomplain, -tails, or --\"\n"
" }\n"
" * {\n"
" break\n"
" }\n"
" }\n"
" incr n\n"
" }\n"
" if {[info exists param]} {\n"
" return -code error \"missing argument to \\\"$switch\\\"\"\n"
" }\n"
" if {[llength $args] <= $n} {\n"
" return -code error \"wrong # args: should be \\\"glob ?options? pattern ?pattern ...?\\\"\"\n"
" }\n"
"\n"
" set args [lrange $args $n end]\n"
"\n"
" set result {}\n"
" foreach pattern $args {\n"
" set escpattern [string map {\n"
" \\\\\\\\ \\x01 \\\\\\{ \\x02 \\\\\\} \\x03 \\\\, \\x04\n"
" } $pattern]\n"
" set patexps [lassign [glob.explode $escpattern] rest]\n"
" if {$rest ne \"\"} {\n"
" return -code error \"unmatched close brace in glob pattern\"\n"
" }\n"
" foreach patexp $patexps {\n"
" set patexp [string map {\n"
" \\x01 \\\\\\\\ \\x02 \\{ \\x03 \\} \\x04 ,\n"
" } $patexp]\n"
" foreach {realname name} [glob.glob $base $patexp] {\n"
" incr n\n"
" if {$tails} {\n"
" lappend result $name\n"
" } else {\n"
" lappend result [file join $base $name]\n"
" }\n"
" }\n"
" }\n"
" }\n"
"\n"
" if {!$nocomplain && [llength $result] == 0} {\n"
" set s $(([llength $args] > 1) ? \"s\" : \"\")\n"
" return -code error \"no files matched glob pattern$s \\\"[join $args]\\\"\"\n"
" }\n"
"\n"
" return $result\n"
"}\n"
);
}
int Jim_stdlibInit(Jim_Interp *interp)
|
| ︙ | ︙ | |||
1346 1347 1348 1349 1350 1351 1352 |
"\n"
" set stacktrace [info stacktrace]\n"
"\n"
" lappend stacktrace {*}[stacktrace 1]\n"
" }\n"
" lassign $stacktrace p f l\n"
" if {$f ne \"\"} {\n"
| | | < < < < < < | < < < | 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 |
"\n"
" set stacktrace [info stacktrace]\n"
"\n"
" lappend stacktrace {*}[stacktrace 1]\n"
" }\n"
" lassign $stacktrace p f l\n"
" if {$f ne \"\"} {\n"
" set result \"$f:$l: Error: \"\n"
" }\n"
" append result \"$msg\\n\"\n"
" append result [stackdump $stacktrace]\n"
"\n"
"\n"
" string trim $result\n"
"}\n"
"\n"
"\n"
"\n"
"proc {info nameofexecutable} {} {\n"
" if {[exists ::jim::exe]} {\n"
" return $::jim::exe\n"
" }\n"
"}\n"
"\n"
"\n"
"proc {dict with} {&dictVar {args key} script} {\n"
" set keys {}\n"
" foreach {n v} [dict get $dictVar {*}$key] {\n"
" upvar $n var_$n\n"
|
| ︙ | ︙ | |||
1585 1586 1587 1588 1589 1590 1591 |
"\n"
"proc {file copy} {{force {}} source target} {\n"
" try {\n"
" if {$force ni {{} -force}} {\n"
" error \"bad option \\\"$force\\\": should be -force\"\n"
" }\n"
"\n"
| | | | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 |
"\n"
"proc {file copy} {{force {}} source target} {\n"
" try {\n"
" if {$force ni {{} -force}} {\n"
" error \"bad option \\\"$force\\\": should be -force\"\n"
" }\n"
"\n"
" set in [open $source rb]\n"
"\n"
" if {[file exists $target]} {\n"
" if {$force eq \"\"} {\n"
" error \"error copying \\\"$source\\\" to \\\"$target\\\": file already exists\"\n"
" }\n"
"\n"
" if {$source eq $target} {\n"
" return\n"
" }\n"
"\n"
"\n"
" file stat $source ss\n"
" file stat $target ts\n"
" if {$ss(dev) == $ts(dev) && $ss(ino) == $ts(ino) && $ss(ino)} {\n"
" return\n"
" }\n"
" }\n"
" set out [open $target wb]\n"
" $in copyto $out\n"
" $out close\n"
" } on error {msg opts} {\n"
" incr opts(-level)\n"
" return {*}$opts $msg\n"
" } finally {\n"
" catch {$in close}\n"
|
| ︙ | ︙ | |||
1689 1690 1691 1692 1693 1694 1695 |
" }\n"
" lappend catchopts $opt\n"
" }\n"
" if {[llength $args] == 0} {\n"
" return -code error {wrong # args: should be \"try ?options? script ?argument ...?\"}\n"
" }\n"
" set args [lassign $args script]\n"
| | | | | 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 |
" }\n"
" lappend catchopts $opt\n"
" }\n"
" if {[llength $args] == 0} {\n"
" return -code error {wrong # args: should be \"try ?options? script ?argument ...?\"}\n"
" }\n"
" set args [lassign $args script]\n"
" set code [catch -eval {*}$catchopts {uplevel 1 $script} msg opts]\n"
"\n"
" set handled 0\n"
"\n"
" foreach {on codes vars script} $args {\n"
" switch -- $on \\\n"
" on {\n"
" if {!$handled && ($codes eq \"*\" || [info returncode $code] in $codes)} {\n"
" lassign $vars msgvar optsvar\n"
" if {$msgvar ne \"\"} {\n"
" upvar $msgvar hmsg\n"
" set hmsg $msg\n"
" }\n"
" if {$optsvar ne \"\"} {\n"
" upvar $optsvar hopts\n"
" set hopts $opts\n"
" }\n"
"\n"
" set code [catch {uplevel 1 $script} msg opts]\n"
" incr handled\n"
" }\n"
" } \\\n"
" finally {\n"
" set finalcode [catch {uplevel 1 $codes} finalmsg finalopts]\n"
" if {$finalcode} {\n"
"\n"
" set code $finalcode\n"
" set msg $finalmsg\n"
" set opts $finalopts\n"
" }\n"
" break\n"
|
| ︙ | ︙ | |||
2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 |
Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);
Jim_SetResult(interp, Jim_MakeGlobalNamespaceName(interp, Jim_NewStringObj(interp, buf, -1)));
return JIM_OK;
}
static int JimMakeChannelPair(Jim_Interp *interp, int p[2], Jim_Obj *filename,
const char *hdlfmt, int family, const char *mode[2])
{
if (JimMakeChannel(interp, NULL, p[0], filename, hdlfmt, family, mode[0]) == JIM_OK) {
Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp));
if (JimMakeChannel(interp, NULL, p[1], filename, hdlfmt, family, mode[1]) == JIM_OK) {
Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp));
Jim_SetResult(interp, objPtr);
return JIM_OK;
}
}
close(p[0]);
close(p[1]);
JimAioSetError(interp, NULL);
return JIM_ERR;
}
int Jim_MakeTempFile(Jim_Interp *interp, const char *template)
{
#ifdef HAVE_MKSTEMP
int fd;
mode_t mask;
| > > | 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 |
Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);
Jim_SetResult(interp, Jim_MakeGlobalNamespaceName(interp, Jim_NewStringObj(interp, buf, -1)));
return JIM_OK;
}
#if defined(HAVE_PIPE) || (defined(HAVE_SOCKETPAIR) && defined(HAVE_SYS_UN_H))
static int JimMakeChannelPair(Jim_Interp *interp, int p[2], Jim_Obj *filename,
const char *hdlfmt, int family, const char *mode[2])
{
if (JimMakeChannel(interp, NULL, p[0], filename, hdlfmt, family, mode[0]) == JIM_OK) {
Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp));
if (JimMakeChannel(interp, NULL, p[1], filename, hdlfmt, family, mode[1]) == JIM_OK) {
Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp));
Jim_SetResult(interp, objPtr);
return JIM_OK;
}
}
close(p[0]);
close(p[1]);
JimAioSetError(interp, NULL);
return JIM_ERR;
}
#endif
int Jim_MakeTempFile(Jim_Interp *interp, const char *template)
{
#ifdef HAVE_MKSTEMP
int fd;
mode_t mask;
|
| ︙ | ︙ | |||
2550 2551 2552 2553 2554 2555 2556 |
mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
fd = mkstemp(filenameObj->bytes);
umask(mask);
if (fd < 0) {
| | | | 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 |
mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
fd = mkstemp(filenameObj->bytes);
umask(mask);
if (fd < 0) {
JimAioSetError(interp, filenameObj);
Jim_FreeNewObj(interp, filenameObj);
return -1;
}
Jim_SetResult(interp, filenameObj);
return fd;
#else
Jim_SetResultString(interp, "platform has no tempfile support", -1);
return -1;
#endif
}
FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command)
{
Jim_Cmd *cmdPtr = Jim_GetCommand(interp, command, JIM_ERRMSG);
|
| ︙ | ︙ | |||
3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 |
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
# ifndef MAXPATHLEN
# define MAXPATHLEN JIM_PATH_LEN
# endif
static const char *JimGetFileType(int mode)
{
if (S_ISREG(mode)) {
return "file";
}
else if (S_ISDIR(mode)) {
| > > > > > > | 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 |
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
# ifndef MAXPATHLEN
# define MAXPATHLEN JIM_PATH_LEN
# endif
#if defined(__MINGW32__) || defined(_MSC_VER)
#define ISWINDOWS 1
#else
#define ISWINDOWS 0
#endif
static const char *JimGetFileType(int mode)
{
if (S_ISREG(mode)) {
return "file";
}
else if (S_ISDIR(mode)) {
|
| ︙ | ︙ | |||
3279 3280 3281 3282 3283 3284 3285 |
Jim_SetResultString(interp, "..", -1);
} else if (!p) {
Jim_SetResultString(interp, ".", -1);
}
else if (p == path) {
Jim_SetResultString(interp, "/", -1);
}
| < | < | 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 |
Jim_SetResultString(interp, "..", -1);
} else if (!p) {
Jim_SetResultString(interp, ".", -1);
}
else if (p == path) {
Jim_SetResultString(interp, "/", -1);
}
else if (ISWINDOWS && p[-1] == ':') {
Jim_SetResultString(interp, path, p - path + 1);
}
else {
Jim_SetResultString(interp, path, p - path);
}
return JIM_OK;
}
static int file_cmd_rootname(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
| ︙ | ︙ | |||
3371 3372 3373 3374 3375 3376 3377 |
int len;
const char *part = Jim_GetString(argv[i], &len);
if (*part == '/') {
last = newname;
}
| < | < | 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 |
int len;
const char *part = Jim_GetString(argv[i], &len);
if (*part == '/') {
last = newname;
}
else if (ISWINDOWS && strchr(part, ':')) {
last = newname;
}
else if (part[0] == '.') {
if (part[1] == '/') {
part += 2;
len -= 2;
}
else if (part[1] == 0 && last != newname) {
|
| ︙ | ︙ | |||
3405 3406 3407 3408 3409 3410 3411 |
}
memcpy(last, part, len);
last += len;
}
if (last > newname + 1 && last[-1] == '/') {
| > > | > | 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 |
}
memcpy(last, part, len);
last += len;
}
if (last > newname + 1 && last[-1] == '/') {
if (!ISWINDOWS || !(last > newname + 2 && last[-2] == ':')) {
*--last = 0;
}
}
}
*last = 0;
|
| ︙ | ︙ | |||
3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 |
Jim_SetResultFormatted(interp, "error renaming \"%#s\" to \"%#s\": %s", argv[0], argv[1],
strerror(errno));
return JIM_ERR;
}
return JIM_OK;
}
static int file_stat(Jim_Interp *interp, Jim_Obj *filename, struct stat *sb)
{
const char *path = Jim_String(filename);
if (stat(path, sb) == -1) {
Jim_SetResultFormatted(interp, "could not read \"%#s\": %s", filename, strerror(errno));
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 |
Jim_SetResultFormatted(interp, "error renaming \"%#s\" to \"%#s\": %s", argv[0], argv[1],
strerror(errno));
return JIM_ERR;
}
return JIM_OK;
}
#if defined(HAVE_LINK) && defined(HAVE_SYMLINK)
static int file_cmd_link(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int ret;
const char *source;
const char *dest;
static const char * const options[] = { "-hard", "-symbolic", NULL };
enum { OPT_HARD, OPT_SYMBOLIC, };
int option = OPT_HARD;
if (argc == 3) {
if (Jim_GetEnum(interp, argv[0], options, &option, NULL, JIM_ENUM_ABBREV | JIM_ERRMSG) != JIM_OK) {
return JIM_ERR;
}
argv++;
argc--;
}
dest = Jim_String(argv[0]);
source = Jim_String(argv[1]);
if (option == OPT_HARD) {
ret = link(source, dest);
}
else {
ret = symlink(source, dest);
}
if (ret != 0) {
Jim_SetResultFormatted(interp, "error linking \"%#s\" to \"%#s\": %s", argv[0], argv[1],
strerror(errno));
return JIM_ERR;
}
return JIM_OK;
}
#endif
static int file_stat(Jim_Interp *interp, Jim_Obj *filename, struct stat *sb)
{
const char *path = Jim_String(filename);
if (stat(path, sb) == -1) {
Jim_SetResultFormatted(interp, "could not read \"%#s\": %s", filename, strerror(errno));
|
| ︙ | ︙ | |||
3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 |
{ "rename",
"?-force? source dest",
file_cmd_rename,
2,
3,
},
#if defined(HAVE_READLINK)
{ "readlink",
"name",
file_cmd_readlink,
1,
1,
| > > > > > > > > > | 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 |
{ "rename",
"?-force? source dest",
file_cmd_rename,
2,
3,
},
#if defined(HAVE_LINK) && defined(HAVE_SYMLINK)
{ "link",
"?-symbolic|-hard? newname target",
file_cmd_link,
2,
3,
},
#endif
#if defined(HAVE_READLINK)
{ "readlink",
"name",
file_cmd_readlink,
1,
1,
|
| ︙ | ︙ | |||
3980 3981 3982 3983 3984 3985 3986 |
char *cwd = Jim_Alloc(MAXPATHLEN);
if (getcwd(cwd, MAXPATHLEN) == NULL) {
Jim_SetResultString(interp, "Failed to get pwd", -1);
Jim_Free(cwd);
return JIM_ERR;
}
| | < < | 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 |
char *cwd = Jim_Alloc(MAXPATHLEN);
if (getcwd(cwd, MAXPATHLEN) == NULL) {
Jim_SetResultString(interp, "Failed to get pwd", -1);
Jim_Free(cwd);
return JIM_ERR;
}
else if (ISWINDOWS) {
char *p = cwd;
while ((p = strchr(p, '\\')) != NULL) {
*p++ = '/';
}
}
Jim_SetResultString(interp, cwd, -1);
Jim_Free(cwd);
return JIM_OK;
}
|
| ︙ | ︙ | |||
5320 5321 5322 5323 5324 5325 5326 |
return lseek(fd, 0L, SEEK_SET);
}
static int JimCreateTemp(Jim_Interp *interp, const char *contents, int len)
{
int fd = Jim_MakeTempFile(interp, NULL);
| | < < < | | | | | | | | > | 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 |
return lseek(fd, 0L, SEEK_SET);
}
static int JimCreateTemp(Jim_Interp *interp, const char *contents, int len)
{
int fd = Jim_MakeTempFile(interp, NULL);
if (fd != JIM_BAD_FD) {
unlink(Jim_String(Jim_GetResult(interp)));
if (contents) {
if (write(fd, contents, len) != len) {
Jim_SetResultErrno(interp, "couldn't write temp file");
close(fd);
return -1;
}
lseek(fd, 0L, SEEK_SET);
}
}
return fd;
}
static char **JimSaveEnv(char **env)
{
char **saveenv = Jim_GetEnviron();
|
| ︙ | ︙ | |||
7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 |
}
const char *Jim_String(Jim_Obj *objPtr)
{
if (objPtr->bytes == NULL) {
JimPanic((objPtr->typePtr->updateStringProc == NULL, "UpdateStringProc called against '%s' type.", objPtr->typePtr->name));
objPtr->typePtr->updateStringProc(objPtr);
}
return objPtr->bytes;
}
static void JimSetStringBytes(Jim_Obj *objPtr, const char *str)
| > | 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 |
}
const char *Jim_String(Jim_Obj *objPtr)
{
if (objPtr->bytes == NULL) {
JimPanic((objPtr->typePtr == NULL, "UpdateStringProc called against typeless value."));
JimPanic((objPtr->typePtr->updateStringProc == NULL, "UpdateStringProc called against '%s' type.", objPtr->typePtr->name));
objPtr->typePtr->updateStringProc(objPtr);
}
return objPtr->bytes;
}
static void JimSetStringBytes(Jim_Obj *objPtr, const char *str)
|
| ︙ | ︙ | |||
8528 8529 8530 8531 8532 8533 8534 |
objPtr->internalRep.scriptLineValue.line = line;
return objPtr;
}
static void FreeScriptInternalRep(Jim_Interp *interp, Jim_Obj *objPtr);
static void DupScriptInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr);
| | | 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 |
objPtr->internalRep.scriptLineValue.line = line;
return objPtr;
}
static void FreeScriptInternalRep(Jim_Interp *interp, Jim_Obj *objPtr);
static void DupScriptInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr);
static void JimSetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr);
static int JimParseCheckMissing(Jim_Interp *interp, int ch);
static const Jim_ObjType scriptObjType = {
"script",
FreeScriptInternalRep,
DupScriptInternalRep,
NULL,
|
| ︙ | ︙ | |||
8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 |
int len;
int substFlags;
int inUse; /* Used to share a ScriptObj. Currently
only used by Jim_EvalObj() as protection against
shimmering of the currently evaluated object. */
int firstline;
int linenr;
} ScriptObj;
void FreeScriptInternalRep(Jim_Interp *interp, Jim_Obj *objPtr)
{
int i;
struct ScriptObj *script = (void *)objPtr->internalRep.ptr;
| > | 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 |
int len;
int substFlags;
int inUse; /* Used to share a ScriptObj. Currently
only used by Jim_EvalObj() as protection against
shimmering of the currently evaluated object. */
int firstline;
int linenr;
int missing;
} ScriptObj;
void FreeScriptInternalRep(Jim_Interp *interp, Jim_Obj *objPtr)
{
int i;
struct ScriptObj *script = (void *)objPtr->internalRep.ptr;
|
| ︙ | ︙ | |||
8834 8835 8836 8837 8838 8839 8840 |
Jim_IncrRefCount(token->objPtr);
token++;
}
script->len = i;
}
| | < < < < > > | < | > | | > > > > > > > > > | | > | < | | 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 |
Jim_IncrRefCount(token->objPtr);
token++;
}
script->len = i;
}
static void JimSetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr)
{
int scriptTextLen;
const char *scriptText = Jim_GetString(objPtr, &scriptTextLen);
struct JimParserCtx parser;
struct ScriptObj *script;
ParseTokenList tokenlist;
int line = 1;
if (objPtr->typePtr == &sourceObjType) {
line = objPtr->internalRep.sourceValue.lineNumber;
}
ScriptTokenListInit(&tokenlist);
JimParserInit(&parser, scriptText, scriptTextLen, line);
while (!parser.eof) {
JimParseScript(&parser);
ScriptAddToken(&tokenlist, parser.tstart, parser.tend - parser.tstart + 1, parser.tt,
parser.tline);
}
ScriptAddToken(&tokenlist, scriptText + scriptTextLen, 0, JIM_TT_EOF, 0);
script = Jim_Alloc(sizeof(*script));
memset(script, 0, sizeof(*script));
script->inUse = 1;
if (objPtr->typePtr == &sourceObjType) {
script->fileNameObj = objPtr->internalRep.sourceValue.fileNameObj;
}
else {
script->fileNameObj = interp->emptyObj;
}
Jim_IncrRefCount(script->fileNameObj);
script->missing = parser.missing.ch;
script->linenr = parser.missing.line;
ScriptObjAddTokens(interp, script, &tokenlist);
ScriptTokenListFree(&tokenlist);
Jim_FreeIntRep(interp, objPtr);
Jim_SetIntRepPtr(objPtr, script);
objPtr->typePtr = &scriptObjType;
}
static void JimAddErrorToStack(Jim_Interp *interp, ScriptObj *script);
ScriptObj *JimGetScript(Jim_Interp *interp, Jim_Obj *objPtr)
{
if (objPtr == interp->emptyObj) {
objPtr = interp->nullScriptObj;
}
if (objPtr->typePtr != &scriptObjType || ((struct ScriptObj *)Jim_GetIntRepPtr(objPtr))->substFlags) {
JimSetScriptFromAny(interp, objPtr);
}
return (ScriptObj *)Jim_GetIntRepPtr(objPtr);
}
static int JimScriptValid(Jim_Interp *interp, ScriptObj *script)
{
if (JimParseCheckMissing(interp, script->missing) == JIM_ERR) {
JimAddErrorToStack(interp, script);
return 0;
}
return 1;
}
static void JimIncrCmdRefCount(Jim_Cmd *cmdPtr)
{
cmdPtr->inUse++;
}
static void JimDecrCmdRefCount(Jim_Interp *interp, Jim_Cmd *cmdPtr)
|
| ︙ | ︙ | |||
10899 10900 10901 10902 10903 10904 10905 |
objPtr->typePtr = &coercedDoubleObjType;
objPtr->internalRep.wideValue = wideValue;
return JIM_OK;
}
else {
if (Jim_StringToDouble(str, &doubleValue) != JIM_OK) {
| | | 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 |
objPtr->typePtr = &coercedDoubleObjType;
objPtr->internalRep.wideValue = wideValue;
return JIM_OK;
}
else {
if (Jim_StringToDouble(str, &doubleValue) != JIM_OK) {
Jim_SetResultFormatted(interp, "expected floating-point number but got \"%#s\"", objPtr);
return JIM_ERR;
}
Jim_FreeIntRep(interp, objPtr);
}
objPtr->typePtr = &doubleObjType;
objPtr->internalRep.doubleValue = doubleValue;
|
| ︙ | ︙ | |||
12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 |
JIM_EXPROP_BITNOT,
JIM_EXPROP_UNARYMINUS,
JIM_EXPROP_UNARYPLUS,
JIM_EXPROP_FUNC_FIRST,
JIM_EXPROP_FUNC_INT = JIM_EXPROP_FUNC_FIRST,
JIM_EXPROP_FUNC_ABS,
JIM_EXPROP_FUNC_DOUBLE,
JIM_EXPROP_FUNC_ROUND,
JIM_EXPROP_FUNC_RAND,
JIM_EXPROP_FUNC_SRAND,
| > | 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 |
JIM_EXPROP_BITNOT,
JIM_EXPROP_UNARYMINUS,
JIM_EXPROP_UNARYPLUS,
JIM_EXPROP_FUNC_FIRST,
JIM_EXPROP_FUNC_INT = JIM_EXPROP_FUNC_FIRST,
JIM_EXPROP_FUNC_WIDE,
JIM_EXPROP_FUNC_ABS,
JIM_EXPROP_FUNC_DOUBLE,
JIM_EXPROP_FUNC_ROUND,
JIM_EXPROP_FUNC_RAND,
JIM_EXPROP_FUNC_SRAND,
|
| ︙ | ︙ | |||
12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 |
Jim_Obj *A = ExprPop(e);
double dA, dC = 0;
jim_wide wA, wC = 0;
if ((A->typePtr != &doubleObjType || A->bytes) && JimGetWideNoErr(interp, A, &wA) == JIM_OK) {
switch (e->opcode) {
case JIM_EXPROP_FUNC_INT:
case JIM_EXPROP_FUNC_ROUND:
case JIM_EXPROP_UNARYPLUS:
wC = wA;
break;
case JIM_EXPROP_FUNC_DOUBLE:
dC = wA;
intresult = 0;
| > | 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 |
Jim_Obj *A = ExprPop(e);
double dA, dC = 0;
jim_wide wA, wC = 0;
if ((A->typePtr != &doubleObjType || A->bytes) && JimGetWideNoErr(interp, A, &wA) == JIM_OK) {
switch (e->opcode) {
case JIM_EXPROP_FUNC_INT:
case JIM_EXPROP_FUNC_WIDE:
case JIM_EXPROP_FUNC_ROUND:
case JIM_EXPROP_UNARYPLUS:
wC = wA;
break;
case JIM_EXPROP_FUNC_DOUBLE:
dC = wA;
intresult = 0;
|
| ︙ | ︙ | |||
12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 |
default:
abort();
}
}
else if ((rc = Jim_GetDouble(interp, A, &dA)) == JIM_OK) {
switch (e->opcode) {
case JIM_EXPROP_FUNC_INT:
wC = dA;
break;
case JIM_EXPROP_FUNC_ROUND:
wC = dA < 0 ? (dA - 0.5) : (dA + 0.5);
break;
case JIM_EXPROP_FUNC_DOUBLE:
case JIM_EXPROP_UNARYPLUS:
| > | 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 |
default:
abort();
}
}
else if ((rc = Jim_GetDouble(interp, A, &dA)) == JIM_OK) {
switch (e->opcode) {
case JIM_EXPROP_FUNC_INT:
case JIM_EXPROP_FUNC_WIDE:
wC = dA;
break;
case JIM_EXPROP_FUNC_ROUND:
wC = dA < 0 ? (dA - 0.5) : (dA + 0.5);
break;
case JIM_EXPROP_FUNC_DOUBLE:
case JIM_EXPROP_UNARYPLUS:
|
| ︙ | ︙ | |||
13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 |
OPRINIT("~", 150, 1, JimExprOpIntUnary),
OPRINIT(NULL, 150, 1, JimExprOpNumUnary),
OPRINIT(NULL, 150, 1, JimExprOpNumUnary),
OPRINIT("int", 200, 1, JimExprOpNumUnary),
OPRINIT("abs", 200, 1, JimExprOpNumUnary),
OPRINIT("double", 200, 1, JimExprOpNumUnary),
OPRINIT("round", 200, 1, JimExprOpNumUnary),
OPRINIT("rand", 200, 0, JimExprOpNone),
OPRINIT("srand", 200, 1, JimExprOpIntUnary),
#ifdef JIM_MATH_FUNCTIONS
| > | 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 |
OPRINIT("~", 150, 1, JimExprOpIntUnary),
OPRINIT(NULL, 150, 1, JimExprOpNumUnary),
OPRINIT(NULL, 150, 1, JimExprOpNumUnary),
OPRINIT("int", 200, 1, JimExprOpNumUnary),
OPRINIT("wide", 200, 1, JimExprOpNumUnary),
OPRINIT("abs", 200, 1, JimExprOpNumUnary),
OPRINIT("double", 200, 1, JimExprOpNumUnary),
OPRINIT("round", 200, 1, JimExprOpNumUnary),
OPRINIT("rand", 200, 0, JimExprOpNone),
OPRINIT("srand", 200, 1, JimExprOpIntUnary),
#ifdef JIM_MATH_FUNCTIONS
|
| ︙ | ︙ | |||
14748 14749 14750 14751 14752 14753 14754 |
nargv[0] = prefix;
memcpy(&nargv[1], &objv[0], sizeof(nargv[0]) * objc);
ret = Jim_EvalObjVector(interp, objc + 1, nargv);
Jim_Free(nargv);
return ret;
}
| | < < | | < < < < < < | 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 |
nargv[0] = prefix;
memcpy(&nargv[1], &objv[0], sizeof(nargv[0]) * objc);
ret = Jim_EvalObjVector(interp, objc + 1, nargv);
Jim_Free(nargv);
return ret;
}
static void JimAddErrorToStack(Jim_Interp *interp, ScriptObj *script)
{
if (!interp->errorFlag) {
interp->errorFlag = 1;
Jim_IncrRefCount(script->fileNameObj);
Jim_DecrRefCount(interp, interp->errorFileNameObj);
interp->errorFileNameObj = script->fileNameObj;
interp->errorLine = script->linenr;
JimResetStackTrace(interp);
interp->addStackTrace++;
}
if (interp->addStackTrace > 0) {
JimAppendStackTrace(interp, Jim_String(interp->errorProc), script->fileNameObj, script->linenr);
if (Jim_Length(script->fileNameObj)) {
interp->addStackTrace = 0;
}
Jim_DecrRefCount(interp, interp->errorProc);
interp->errorProc = interp->emptyObj;
Jim_IncrRefCount(interp->errorProc);
}
}
static int JimSubstOneToken(Jim_Interp *interp, const ScriptToken *token, Jim_Obj **objPtrPtr)
{
Jim_Obj *objPtr;
switch (token->type) {
|
| ︙ | ︙ | |||
14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 |
}
static int JimEvalObjList(Jim_Interp *interp, Jim_Obj *listPtr)
{
int retcode = JIM_OK;
if (listPtr->internalRep.listValue.len) {
Jim_IncrRefCount(listPtr);
retcode = JimInvokeCommand(interp,
listPtr->internalRep.listValue.len,
listPtr->internalRep.listValue.ele);
Jim_DecrRefCount(interp, listPtr);
}
| > > | 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 |
}
static int JimEvalObjList(Jim_Interp *interp, Jim_Obj *listPtr)
{
int retcode = JIM_OK;
JimPanic((Jim_IsList(listPtr) == 0, "JimEvalObjList() invoked on non-list."));
if (listPtr->internalRep.listValue.len) {
Jim_IncrRefCount(listPtr);
retcode = JimInvokeCommand(interp,
listPtr->internalRep.listValue.len,
listPtr->internalRep.listValue.ele);
Jim_DecrRefCount(interp, listPtr);
}
|
| ︙ | ︙ | |||
14956 14957 14958 14959 14960 14961 14962 |
Jim_Obj *prevScriptObj;
if (Jim_IsList(scriptObjPtr) && scriptObjPtr->bytes == NULL) {
return JimEvalObjList(interp, scriptObjPtr);
}
Jim_IncrRefCount(scriptObjPtr);
| | | | 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 |
Jim_Obj *prevScriptObj;
if (Jim_IsList(scriptObjPtr) && scriptObjPtr->bytes == NULL) {
return JimEvalObjList(interp, scriptObjPtr);
}
Jim_IncrRefCount(scriptObjPtr);
script = JimGetScript(interp, scriptObjPtr);
if (!JimScriptValid(interp, script)) {
Jim_DecrRefCount(interp, scriptObjPtr);
return JIM_ERR;
}
Jim_SetEmptyResult(interp);
token = script->token;
|
| ︙ | ︙ | |||
15123 15124 15125 15126 15127 15128 15129 |
if (argv != sargv) {
Jim_Free(argv);
argv = sargv;
}
}
| > | > > > > > > | 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 |
if (argv != sargv) {
Jim_Free(argv);
argv = sargv;
}
}
if (retcode == JIM_ERR) {
JimAddErrorToStack(interp, script);
}
else if (retcode != JIM_RETURN || interp->returnCode != JIM_ERR) {
interp->addStackTrace = 0;
}
interp->currentScriptObj = prevScriptObj;
Jim_FreeIntRep(interp, scriptObjPtr);
scriptObjPtr->typePtr = &scriptObjType;
Jim_SetIntRepPtr(scriptObjPtr, script);
|
| ︙ | ︙ | |||
15274 15275 15276 15277 15278 15279 15280 |
callFramePtr->argv = argv;
callFramePtr->argc = argc;
callFramePtr->procArgsObjPtr = cmd->u.proc.argListObjPtr;
callFramePtr->procBodyObjPtr = cmd->u.proc.bodyObjPtr;
callFramePtr->staticVars = cmd->u.proc.staticVars;
| | | 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 |
callFramePtr->argv = argv;
callFramePtr->argc = argc;
callFramePtr->procArgsObjPtr = cmd->u.proc.argListObjPtr;
callFramePtr->procBodyObjPtr = cmd->u.proc.bodyObjPtr;
callFramePtr->staticVars = cmd->u.proc.staticVars;
script = JimGetScript(interp, interp->currentScriptObj);
callFramePtr->fileNameObj = script->fileNameObj;
callFramePtr->line = script->linenr;
Jim_IncrRefCount(cmd->u.proc.argListObjPtr);
Jim_IncrRefCount(cmd->u.proc.bodyObjPtr);
interp->framePtr = callFramePtr;
|
| ︙ | ︙ | |||
15471 15472 15473 15474 15475 15476 15477 |
fclose(fp);
buf[readlen] = 0;
scriptObjPtr = Jim_NewStringObjNoAlloc(interp, buf, readlen);
JimSetSourceInfo(interp, scriptObjPtr, Jim_NewStringObj(interp, filename, -1), 1);
Jim_IncrRefCount(scriptObjPtr);
| < < < < < < < < | 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 |
fclose(fp);
buf[readlen] = 0;
scriptObjPtr = Jim_NewStringObjNoAlloc(interp, buf, readlen);
JimSetSourceInfo(interp, scriptObjPtr, Jim_NewStringObj(interp, filename, -1), 1);
Jim_IncrRefCount(scriptObjPtr);
prevScriptObj = interp->currentScriptObj;
interp->currentScriptObj = scriptObjPtr;
retcode = Jim_EvalObj(interp, scriptObjPtr);
if (retcode == JIM_RETURN) {
|
| ︙ | ︙ | |||
16028 16029 16030 16031 16032 16033 16034 |
ExprByteCode *expr;
jim_wide stop, currentVal;
Jim_Obj *objPtr;
int cmpOffset;
expr = JimGetExpression(interp, argv[2]);
| | | 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 |
ExprByteCode *expr;
jim_wide stop, currentVal;
Jim_Obj *objPtr;
int cmpOffset;
expr = JimGetExpression(interp, argv[2]);
incrScript = JimGetScript(interp, argv[3]);
if (incrScript == NULL || incrScript->len != 3 || !expr || expr->len != 3) {
goto evalstart;
}
if (incrScript->token[1].type != JIM_TT_ESC ||
|
| ︙ | ︙ | |||
17015 17016 17017 17018 17019 17020 17021 |
static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_Obj *stringObjPtr;
int i;
if (argc < 2) {
| | | 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 |
static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_Obj *stringObjPtr;
int i;
if (argc < 2) {
Jim_WrongNumArgs(interp, 1, argv, "varName ?value ...?");
return JIM_ERR;
}
if (argc == 2) {
stringObjPtr = Jim_GetVariable(interp, argv[1], JIM_ERRMSG);
if (!stringObjPtr)
return JIM_ERR;
}
|
| ︙ | ︙ | |||
17064 17065 17066 17067 17068 17069 17070 |
static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int rc;
if (argc < 2) {
| | | 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 |
static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int rc;
if (argc < 2) {
Jim_WrongNumArgs(interp, 1, argv, "arg ?arg ...?");
return JIM_ERR;
}
if (argc == 2) {
rc = Jim_EvalObj(interp, argv[1]);
}
else {
|
| ︙ | ︙ | |||
17275 17276 17277 17278 17279 17280 17281 |
static int JimAliasCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_Obj *cmdList;
Jim_Obj *prefixListObj = Jim_CmdPrivData(interp);
cmdList = Jim_DuplicateObj(interp, prefixListObj);
| | | 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 |
static int JimAliasCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_Obj *cmdList;
Jim_Obj *prefixListObj = Jim_CmdPrivData(interp);
cmdList = Jim_DuplicateObj(interp, prefixListObj);
Jim_ListInsertElements(interp, cmdList, Jim_ListLength(interp, cmdList), argc - 1, argv + 1);
return JimEvalObjList(interp, cmdList);
}
static void JimAliasCmdDelete(Jim_Interp *interp, void *privData)
{
Jim_Obj *prefixListObj = privData;
|
| ︙ | ︙ | |||
17595 17596 17597 17598 17599 17600 17601 |
static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int len;
int opt_case = 1;
int option;
static const char * const options[] = {
"bytelength", "length", "compare", "match", "equal", "is", "byterange", "range", "replace",
| | | | 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 |
static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int len;
int opt_case = 1;
int option;
static const char * const options[] = {
"bytelength", "length", "compare", "match", "equal", "is", "byterange", "range", "replace",
"map", "repeat", "reverse", "index", "first", "last", "cat",
"trim", "trimleft", "trimright", "tolower", "toupper", "totitle", NULL
};
enum
{
OPT_BYTELENGTH, OPT_LENGTH, OPT_COMPARE, OPT_MATCH, OPT_EQUAL, OPT_IS, OPT_BYTERANGE, OPT_RANGE, OPT_REPLACE,
OPT_MAP, OPT_REPEAT, OPT_REVERSE, OPT_INDEX, OPT_FIRST, OPT_LAST, OPT_CAT,
OPT_TRIM, OPT_TRIMLEFT, OPT_TRIMRIGHT, OPT_TOLOWER, OPT_TOUPPER, OPT_TOTITLE
};
static const char * const nocase_options[] = {
"-nocase", NULL
};
static const char * const nocase_length_options[] = {
"-nocase", "-length", NULL
|
| ︙ | ︙ | |||
17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 |
len = Jim_Utf8Length(interp, argv[2]);
}
else {
len = Jim_Length(argv[2]);
}
Jim_SetResultInt(interp, len);
return JIM_OK;
case OPT_COMPARE:
case OPT_EQUAL:
{
long opt_length = -1;
int n = argc - 4;
| > > > > > > > > > > > > > > > > > > > | 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 |
len = Jim_Utf8Length(interp, argv[2]);
}
else {
len = Jim_Length(argv[2]);
}
Jim_SetResultInt(interp, len);
return JIM_OK;
case OPT_CAT:{
Jim_Obj *objPtr;
if (argc == 3) {
objPtr = argv[2];
}
else {
int i;
objPtr = Jim_NewStringObj(interp, "", 0);
for (i = 2; i < argc; i++) {
Jim_AppendObj(interp, objPtr, argv[i]);
}
}
Jim_SetResult(interp, objPtr);
return JIM_OK;
}
case OPT_COMPARE:
case OPT_EQUAL:
{
long opt_length = -1;
int n = argc - 4;
|
| ︙ | ︙ | |||
18617 18618 18619 18620 18621 18622 18623 |
break;
case INFO_SCRIPT:
if (argc != 2) {
Jim_WrongNumArgs(interp, 2, argv, "");
return JIM_ERR;
}
| | | | | > > > > > > > > | | | | | | | | | | | | | | | | > | 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 |
break;
case INFO_SCRIPT:
if (argc != 2) {
Jim_WrongNumArgs(interp, 2, argv, "");
return JIM_ERR;
}
Jim_SetResult(interp, JimGetScript(interp, interp->currentScriptObj)->fileNameObj);
break;
case INFO_SOURCE:{
jim_wide line;
Jim_Obj *resObjPtr;
Jim_Obj *fileNameObj;
if (argc != 3 && argc != 5) {
Jim_WrongNumArgs(interp, 2, argv, "source ?filename line?");
return JIM_ERR;
}
if (argc == 5) {
if (Jim_GetWide(interp, argv[4], &line) != JIM_OK) {
return JIM_ERR;
}
resObjPtr = Jim_NewStringObj(interp, Jim_String(argv[2]), Jim_Length(argv[2]));
JimSetSourceInfo(interp, resObjPtr, argv[3], line);
}
else {
if (argv[2]->typePtr == &sourceObjType) {
fileNameObj = argv[2]->internalRep.sourceValue.fileNameObj;
line = argv[2]->internalRep.sourceValue.lineNumber;
}
else if (argv[2]->typePtr == &scriptObjType) {
ScriptObj *script = JimGetScript(interp, argv[2]);
fileNameObj = script->fileNameObj;
line = script->firstline;
}
else {
fileNameObj = interp->emptyObj;
line = 1;
}
resObjPtr = Jim_NewListObj(interp, NULL, 0);
Jim_ListAppendElement(interp, resObjPtr, fileNameObj);
Jim_ListAppendElement(interp, resObjPtr, Jim_NewIntObj(interp, line));
}
Jim_SetResult(interp, resObjPtr);
break;
}
case INFO_STACKTRACE:
Jim_SetResult(interp, interp->stackTrace);
break;
|
| ︙ | ︙ | |||
21841 21842 21843 21844 21845 21846 21847 |
Jim_RegisterCoreCommands(interp);
if (Jim_InitStaticExtensions(interp) != JIM_OK) {
JimPrintErrorMessage(interp);
}
| | | 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 |
Jim_RegisterCoreCommands(interp);
if (Jim_InitStaticExtensions(interp) != JIM_OK) {
JimPrintErrorMessage(interp);
}
Jim_SetVariableStrWithStr(interp, "jim::argv0", argv[0]);
Jim_SetVariableStrWithStr(interp, JIM_INTERACTIVE, argc == 1 ? "1" : "0");
retcode = Jim_initjimshInit(interp);
if (argc == 1) {
if (retcode == JIM_ERR) {
JimPrintErrorMessage(interp);
}
|
| ︙ | ︙ |
Added fossil.1.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .TH FOSSIL "1" "February 2015" "http://fossil-scm.org" "User Commands" .SH NAME fossil \- Distributed Version Control System .SH SYNOPSIS .B fossil \fIhelp\fR .br .B fossil \fIhelp COMMAND\fR .br .B fossil \fICOMMAND [OPTIONS]\fR .SH DESCRIPTION Fossil is a distributed version control system (DVCS) with built-in wiki, ticket tracker, CGI/http interface, and http server. .SH Common COMMANDs: add clean import pull stash .br addremove clone info purge status .br all commit init push sync .br annotate diff json rebuild tag .br bisect export ls remote-url timeline .br blame extras merge revert ui .br branch finfo mv rm undo .br bundle fusefs open rss unpublish .br cat gdiff praise settings update .br changes help publish sqlite3 version .SH FEATURES Features as described on the fossil home page. .HP 1. .B Integrated Bug Tracking, Wiki, & Technotes - In addition to doing distributed version control like Git and Mercurial, Fossil also supports bug tracking, wiki, and technotes. .HP 2. .B Built-in Web Interface - Fossil has a built-in and intuitive web interface that promotes project situational awareness. Type "fossil ui" and Fossil automatically opens a web browser to a page that shows detailed graphical history and status information on that project. .HP 3. .B Self-Contained - Fossil is a single self-contained stand-alone executable. To install, simply download a precompiled binary for Linux, Mac, OpenBSD, or Windows and put it on your $PATH. Easy-to-compile source code is available for users on other platforms. .HP 4. .B Simple Networking - No custom protocols or TCP ports. Fossil uses plain old HTTP (or HTTPS or SSH) for all network communications, so it works fine from behind restrictive firewalls, including proxies. The protocol is bandwidth efficient to the point that Fossil can be used comfortably over dial-up. .HP 5. .B CGI/SCGI Enabled - No server is required, but if you want to set one up, Fossil supports four simple server configurations. .HP 6. .B Autosync - Fossil supports "autosync" mode which helps to keep projects moving forward by reducing the amount of needless forking and merging often associated with distributed projects. .HP 7. .B Robust & Reliable - Fossil stores content using an enduring file format in an SQLite database so that transactions are atomic even if interrupted by a power loss or system crash. Automatic self-checks verify that all aspects of the repository are consistent prior to each commit. In over seven years of operation, no work has ever been lost after having been committed to a Fossil repository. .SH DOCUMENTATION http://www.fossil-scm.org/ .br .B fossil \fIui\fR |
Added skins/README.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 |
Built-in Skins
==============
Each subdirectory under this folder describes a built-in "skin".
There are three files in each subdirectory for the CSS, the header,
and the footer for that skin.
To improve an existing built-in skin, simply edit the appropriate
files and recompile.
To add a new skin:
1. Create a new subdirectory under skins/. (The new directory is
called "skins/newskin" below but you should use a new original
name, of course.)
2. Add files skins/newskin/css.txt, skins/newskin/header.txt,
and skins/newskin/footer.txt. Be sure to "fossil add" these files.
3. Go to the src/ directory and rerun "tclsh makemake.tcl". This
step rebuilds the various makefiles so that they have dependencies
on the skin files you just installed.
4. Edit the BuiltinSkin[] array near the top of the src/skins.c source
file so that it describes and references the "newskin" skin.
5. Type "make" to rebuild.
Development Hints
-----------------
One way to develop a new skin is to copy the baseline files (css.txt,
footer.txt, and header.txt) into a working directory $WORKDIR then
launch Fossil with a command-line option "--skin $WORKDIR". Example:
cp -r skins/default newskin
fossil ui --skin ./newskin
When the argument to --skin contains one or more '/' characters, the
appropriate skin files are read from disk from the directory specified.
So after launching fossil as shown above, you can edit the newskin/css.txt,
newskin/header.txt, and newskin/footer.txt files using your favorite
text editor, then press Reload on your browser to see immediate results.
|
Added skins/black_and_white/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin:0px 0px 0px 0px;
padding:0px;
font-family:verdana, arial, helvetica, "sans serif";
color:#333;
background-color:white;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* consistent colours */
h2 {
color: #333;
}
h3 {
color: #333;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-cell;
text-align: left;
vertical-align: bottom;
font-weight: bold;
color: #333;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 2em;
font-weight: bold;
text-align: center;
color: #333;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
padding-right: 10px;
text-align: right;
vertical-align: bottom;
padding-bottom: 5px;
color: #333;
font-size: 0.8em;
font-weight: bold;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
margin:10px 0px 10px 0px;
padding:1px 0px 0px 20px;
border-style:solid;
border-color:black;
border-width:1px 0px;
background-color:#eee;
}
/* The main menu bar that appears at the top left of the page beneath
** the header. Width must be co-ordinated with the container below */
div.mainmenu {
float: left;
margin-left: 10px;
margin-right: 10px;
font-size: 0.9em;
font-weight: bold;
padding:5px;
background-color:#eee;
border:1px solid #999;
width:8em;
}
/* Main menu is now a list */
div.mainmenu ul {
padding: 0;
list-style:none;
}
div.mainmenu a, div.mainmenu a:visited{
padding: 1px 10px 1px 10px;
color: #333;
text-decoration: none;
}
div.mainmenu a:hover {
color: #eee;
background-color: #333;
}
/* Container for the sub-menu and content so they don't spread
** out underneath the main menu */
#container {
padding-left: 9em;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 10px;
font-size: 0.9em;
text-align: center;
border:1px solid #999;
border-width:1px 0px;
background-color: #eee;
color: #333;
}
div.submenu a, div.submenu a:visited, div.sectionmenu>a.button:link,
div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: #333;
text-decoration: none;
}
div.submenu a:hover, div.sectionmenu>a.button:hover {
color: #eee;
background-color: #333;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 2ex 1ex 0ex 2ex;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
border-style:solid;
border-color:#999;
border-width:1px 0px;
background-color: #eee;
color: #333;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #eee;
border: 2px #999 solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
color: #333;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
font-size: 0.8em;
margin-top: 12px;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #eee;
color: #555;
}
/* <verbatim> blocks */
pre.verbatim {
background-color: #f5f5f5;
padding: 0.5em;
white-space: pre-wrap;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
|
Added skins/black_and_white/footer.txt.
> > > > | 1 2 3 4 | <div class="footer"> Fossil version $manifest_version $manifest_date </div> </body></html> |
Added skins/black_and_white/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss">
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen">
</head>
<body>
<div class="header">
<div class="logo">
<img src="$logo_image_url" alt="logo">
<br />$<project_name>
</div>
<div class="title">$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></ul></div>
|
Added skins/default/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin: 0ex 1ex;
padding: 0px;
background-color: white;
font-family: sans-serif;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-cell;
text-align: center;
vertical-align: bottom;
font-weight: bold;
color: #558195;
min-width: 200px;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 2em;
font-weight: bold;
text-align: center;
padding: 0 0 0 1em;
color: #558195;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: #558195;
font-size: 0.8em;
font-weight: bold;
min-width: 200px;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
display: table;
width: 100%;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
padding: 5px 10px 5px 10px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
letter-spacing: 1px;
background-color: #558195;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
color: white;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 0px;
font-size: 0.9em;
text-align: center;
background-color: #456878;
color: white;
}
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
color: #558195;
background-color: white;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 0ex 1ex 1ex 1ex;
border: solid #aaa;
border-width: 1px;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
background-color: #558195;
color: white;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #a1c4d4;
border: 2px #558195 solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
clear: both;
font-size: 0.8em;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #558195;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
color: white;
}
/* Hyperlink colors in the footer */
div.footer a { color: white; }
div.footer a:link { color: white; }
div.footer a:visited { color: white; }
div.footer a:hover { background-color: white; color: #558195; }
/* verbatim blocks */
pre.verbatim {
background-color: #f5f5f5;
padding: 0.5em;
white-space: pre-wrap;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
|
Added skins/default/footer.txt.
> > > > > > | 1 2 3 4 5 6 |
<div class="footer">
This page was generated in about
<th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by
Fossil version $manifest_version $manifest_date
</div>
</body></html>
|
Added skins/default/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss" />
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen" />
</head>
<body>
<div class="header">
<div class="logo">
<img src="$logo_image_url" alt="logo" />
</div>
<div class="title"><small>$<project_name></small><br />$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Added skins/eagle/README.md.
> > > > | 1 2 3 4 | For this skin to look exactly as it was intended to, the **white-foreground** setting should be enabled. This skin was contributed by Joe Mistachkin. |
Added skins/eagle/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin: 0ex 1ex;
padding: 0px;
background-color: #485D7B;
font-family: sans-serif;
color: white;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-cell;
text-align: center;
vertical-align: bottom;
font-weight: bold;
color: white;
padding: 5 0 5 0em;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 2em;
font-weight: bold;
text-align: left;
padding: 0 0 0 1em;
color: white;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: white;
font-size: 0.8em;
font-weight: bold;
min-width: 200px;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
display: table;
width: 100%;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
padding: 5px 10px 5px 10px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
letter-spacing: 1px;
background-color: #76869D;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
color: white;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 0px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
background-color: #485D7B;
color: white;
}
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
text-decoration: underline;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 0ex 1ex 0ex 2ex;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
background-color: #485D7B;
color: white;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #9DB0CC;
color: white;
border: 2px white solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
clear: both;
font-size: 0.8em;
margin-top: 12px;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #485D7B;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
color: white;
}
/* Hyperlink colors in the footer */
a { color: white; }
a:link { color: white; }
a:visited { color: white; }
a:hover { color: #9DB0CC; }
/* verbatim blocks */
pre.verbatim {
background-color: #485D7B;
color: white;
padding: 0.5em;
white-space: pre-wrap;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
/* The nomenclature sidebox for branches,.. */
div.sidebox {
float: right;
background-color: #485D7B;
border-width: medium;
border-style: double;
margin: 10px;
}
/* the format for the timeline data table */
table.timelineTable {
cellspacing: 0;
border: 0;
cellpadding: 0;
font-family: "courier new";
border-collapse: collapse;
}
/* Side-by-side diff */
table.sbsdiff {
background-color: #485D7B;
font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
font-size: 8pt;
border-collapse:collapse;
white-space: pre;
width: 98%;
border: 1px #000 dashed;
margin-left: auto;
margin-right: auto;
}
/* format for the layout table, used for the captcha display */
table.captcha {
margin: auto;
padding: 10px;
border-width: 4px;
border-style: double;
border-color: white;
}
/* format for the user list table on the user setup page */
table.usetupUserList {
outline-style: double;
outline-width: 1px;
outline-color: white;
padding: 10px;
}
/* color for capabilities, inherited by reader */
span.ueditInheritReader {
color: white;
}
/* format for values on ticket display page */
td.tktDspValue {
text-align: left;
vertical-align: top;
background-color: #485D7B;
}
/* format for example table cells on the report edit page */
td.rpteditex {
border-width: thin;
border-color: white;
border-style: solid;
}
/* List of files in a timeline */
ul.filelist {
margin-top: 3px;
line-height: 100%;
}
/* side-by-side diff display */
div.sbsdiff {
font-family: monospace;
font-size: smaller;
white-space: pre;
}
/* context diff display */
div.udiff {
font-family: monospace;
white-space: pre;
}
/* changes in a diff */
span.diffchng {
background-color: rgb(170, 170, 140);
}
/* added code in a diff */
span.diffadd {
background-color: rgb(100, 200, 100);
}
/* deleted in a diff */
span.diffrm {
background-color: rgb(230, 110, 110);
}
/* suppressed lines in a diff */
span.diffhr {
display: inline-block;
margin: .5em 0 1em;
color: rgb(150, 150, 140);
}
/* line numbers in a diff */
span.diffln {
color: white;
}
#canvas {
background-color: #485D7B;
}
|
Added skins/eagle/footer.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<div class="footer">
<th1>
proc getTclVersion {} {
if {[catch {tclEval info patchlevel} tclVersion] == 0} {
return "<a href=\"http://www.tcl.tk/\">Tcl</a> version $tclVersion"
}
return ""
}
proc getVersion { version } {
set length [string length $version]
return [string range $version 1 [expr {$length - 2}]]
}
set version [getVersion $manifest_version]
set tclVersion [getTclVersion]
set fossilUrl https://www.fossil-scm.org
set fossilDate [string range $manifest_date 0 9]T[string range $manifest_date 11 end]
</th1>
This page was generated in about
<th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by
<a href="$fossilUrl/">Fossil</a>
version $release_version $tclVersion
<a href="$fossilUrl/index.html/info/$version">$manifest_version</a>
<a href="$fossilUrl/index.html/timeline?c=$fossilDate&y=ci">$manifest_date</a>
</div>
</body></html>
|
Added skins/eagle/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss" />
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen" />
</head>
<body>
<div class="header">
<div class="logo">
<th1>
##
## NOTE: The purpose of this procedure is to take the base URL of the
## Fossil project and return the root of the entire web site using
## the same URI scheme as the base URL (e.g. http or https).
##
proc getLogoUrl { baseurl } {
set idx(first) [string first // $baseurl]
if {$idx(first) != -1} {
##
## NOTE: Skip second slash.
##
set idx(first+1) [expr {$idx(first) + 2}]
##
## NOTE: (part 1) The [string first] command does NOT actually
## support the optional startIndex argument as specified
## in the TH1 support manual; therefore, we fake it by
## using the [string range] command and then adding the
## necessary offset to the resulting index manually
## (below). In Tcl, we could use the following instead:
##
## set idx(next) [string first / $baseurl $idx(first+1)]
##
set idx(nextRange) [string range $baseurl $idx(first+1) end]
set idx(next) [string first / $idx(nextRange)]
if {$idx(next) != -1} {
##
## NOTE: (part 2) Add the necessary offset to the result of
## the search for the next slash (i.e. the one after
## the initial search for the two slashes).
##
set idx(next) [expr {$idx(next) + $idx(first+1)}]
##
## NOTE: Back up one character from the next slash.
##
set idx(next-1) [expr {$idx(next) - 1}]
##
## NOTE: Extract the URI scheme and host from the base URL.
##
set scheme [string range $baseurl 0 $idx(first)]
set host [string range $baseurl $idx(first+1) $idx(next-1)]
##
## NOTE: Try to stay in SSL mode if we are there now.
##
if {[string compare $scheme http:/] == 0} {
set scheme http://
} else {
set scheme https://
}
set logourl $scheme$host/
} else {
set logourl $baseurl
}
} else {
set logourl $baseurl
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
</a>
</div>
<div class="title">$<title></div>
<div class="status"><nobr><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></nobr><small><div id="clock"></div></small></div>
</div>
<script>
function updateClock(){
var e = document.getElementById("clock");
if(e){
var d = new Date();
function f(n) {
return n < 10 ? '0' + n : n;
}
e.innerHTML = d.getUTCFullYear()+ '-' +
f(d.getUTCMonth() + 1) + '-' +
f(d.getUTCDate()) + ' ' +
f(d.getUTCHours()) + ':' +
f(d.getUTCMinutes());
setTimeout("updateClock();",(60-d.getUTCSeconds())*1000);
}
}
updateClock();
</script>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
html "<a href='$home/help'>Help</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Added skins/enhanced1/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin: 0ex 1ex;
padding: 0px;
background-color: white;
font-family: sans-serif;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-cell;
text-align: center;
vertical-align: bottom;
font-weight: bold;
color: #558195;
min-width: 200px;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 2em;
font-weight: bold;
text-align: center;
padding: 0 0 0 1em;
color: #558195;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: #558195;
font-size: 0.8em;
font-weight: bold;
min-width: 200px;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
display: table;
width: 100%;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
padding: 5px 10px 5px 10px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
letter-spacing: 1px;
background-color: #558195;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
color: white;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 0px;
font-size: 0.9em;
text-align: center;
background-color: #456878;
color: white;
}
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
color: #558195;
background-color: white;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 0ex 1ex 1ex 1ex;
border: solid #aaa;
border-width: 1px;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
background-color: #558195;
color: white;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #a1c4d4;
border: 2px #558195 solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
clear: both;
font-size: 0.8em;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #558195;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
color: white;
}
/* Hyperlink colors in the footer */
div.footer a { color: white; }
div.footer a:link { color: white; }
div.footer a:visited { color: white; }
div.footer a:hover { background-color: white; color: #558195; }
/* verbatim blocks */
pre.verbatim {
background-color: #f5f5f5;
padding: 0.5em;
white-space: pre-wrap;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
|
Added skins/enhanced1/footer.txt.
> > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<div class="footer">
<th1>
proc getTclVersion {} {
if {[catch {tclEval info patchlevel} tclVersion] == 0} {
return "<a href=\"http://www.tcl.tk/\">Tcl</a> version $tclVersion"
}
return ""
}
proc getVersion { version } {
set length [string length $version]
return [string range $version 1 [expr {$length - 2}]]
}
set version [getVersion $manifest_version]
set tclVersion [getTclVersion]
set fossilUrl https://www.fossil-scm.org
</th1>
This page was generated in about
<th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by
<a href="$fossilUrl/">Fossil</a>
version $release_version $tclVersion
<a href="$fossilUrl/index.html/info/$version">$manifest_version</a>
<a href="$fossilUrl/index.html/timeline?c=$manifest_date&y=ci">$manifest_date</a>
</div>
</body></html>
|
Added skins/enhanced1/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss" />
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen" />
</head>
<body>
<div class="header">
<div class="logo">
<th1>
##
## NOTE: The purpose of this procedure is to take the base URL of the
## Fossil project and return the root of the entire web site using
## the same URI scheme as the base URL (e.g. http or https).
##
proc getLogoUrl { baseurl } {
set idx(first) [string first // $baseurl]
if {$idx(first) != -1} {
##
## NOTE: Skip second slash.
##
set idx(first+1) [expr {$idx(first) + 2}]
##
## NOTE: (part 1) The [string first] command does NOT actually
## support the optional startIndex argument as specified
## in the TH1 support manual; therefore, we fake it by
## using the [string range] command and then adding the
## necessary offset to the resulting index manually
## (below). In Tcl, we could use the following instead:
##
## set idx(next) [string first / $baseurl $idx(first+1)]
##
set idx(nextRange) [string range $baseurl $idx(first+1) end]
set idx(next) [string first / $idx(nextRange)]
if {$idx(next) != -1} {
##
## NOTE: (part 2) Add the necessary offset to the result of
## the search for the next slash (i.e. the one after
## the initial search for the two slashes).
##
set idx(next) [expr {$idx(next) + $idx(first+1)}]
##
## NOTE: Back up one character from the next slash.
##
set idx(next-1) [expr {$idx(next) - 1}]
##
## NOTE: Extract the URI scheme and host from the base URL.
##
set scheme [string range $baseurl 0 $idx(first)]
set host [string range $baseurl $idx(first+1) $idx(next-1)]
##
## NOTE: Try to stay in SSL mode if we are there now.
##
if {[string compare $scheme http:/] == 0} {
set scheme http://
} else {
set scheme https://
}
set logourl $scheme$host/
} else {
set logourl $baseurl
}
} else {
set logourl $baseurl
}
return $logourl
}
set logourl [getLogoUrl $baseurl]
</th1>
<a href="$logourl">
<img src="$logo_image_url" border="0" alt="$project_name">
</a>
</div>
<div class="title">$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></nobr><small><div id="clock"></div></small></div>
</div>
<script>
function updateClock(){
var e = document.getElementById("clock");
if(e){
var d = new Date();
function f(n) {
return n < 10 ? '0' + n : n;
}
e.innerHTML = d.getUTCFullYear()+ '-' +
f(d.getUTCMonth() + 1) + '-' +
f(d.getUTCDate()) + ' ' +
f(d.getUTCHours()) + ':' +
f(d.getUTCMinutes());
setTimeout("updateClock();",(60-d.getUTCSeconds())*1000);
}
}
updateClock();
</script>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
html "<a href='$home/help'>Help</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Added skins/etienne1/README.md.
> | 1 | This skin was contributed by Étienne Deparis. |
Added skins/etienne1/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
body {
margin: 0 auto;
min-width: 800px;
padding: 0px 20px;
font-family: sans-serif;
font-size:14pt;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
color: #4183C4;
text-decoration: underline;
}
hr {
color: #eee;
}
.title {
color: #4183C4;
float:left;
padding-top: 30px;
padding-bottom: 10px;
}
.title h1 {
display:inline;
}
.title h1:after {
content: " / ";
color: #777;
font-weight: normal;
}
.content h1 {
font-size: 1.25em;
}
.content h2 {
font-size: 1.15em;
}
.content h2 {
font-size: 1.05em;
font-weight: bold;
}
.section {
font-size: 1em;
font-weight: bold;
background-color: #f5f5f5;
border: 1px solid #d8d8d8;
border-radius: 3px 3px 0 0;
padding: 9px 10px 10px;
margin: 10px 0;
}
.sectionmenu {
border: 1px solid #d8d8d8;
border-radius: 0 0 3px 3px;
border-top: 0;
margin-top: -10px;
margin-bottom: 10px;
padding: 10px;
}
.sectionmenu a {
display: inline-block;
margin-right: 1em;
}
.status {
float:right;
font-size:.7em;
padding-top:50px;
}
.mainmenu {
font-size:.8em;
clear:both;
padding:10px;
background:#eaeaea linear-gradient(#fafafa, #eaeaea) repeat-x;
border:1px solid #eaeaea;
border-radius:5px;
}
.mainmenu a {
padding: 10px 20px;
text-decoration:none;
color: #777;
border-right:1px solid #eaeaea;
}
.mainmenu a.active,
.mainmenu a:hover {
color: #000;
border-bottom:2px solid #D26911;
}
.submenu {
font-size: .7em;
margin-top: 10px;
padding: 10px;
border-bottom: 1px solid #ccc;
}
.submenu a {
padding: 10px 11px;
text-decoration:none;
color: #777;
}
.submenu a:hover {
padding: 6px 10px;
border: 1px solid #ccc;
border-radius: 5px;
color: #000;
}
.content {
padding-top: 10px;
font-size:.8em;
color: #444;
}
.udiff, .sbsdiff {
font-size: .85em !important;
overflow: auto;
border: 1px solid #ccc;
border-radius: 5px;
}
.content blockquote {
padding: 0 15px;
}
table.report {
cursor: auto;
border-radius: 5px;
border: 1px solid #ccc;
margin: 1em 0;
}
.report td, .report th {
border: 0;
font-size: .8em;
padding: 10px;
}
.report td:first-child {
border-top-left-radius: 5px;
}
.report tbody tr:last-child td:first-child {
border-bottom-left-radius: 5px;
}
.report td:last-child {
border-top-right-radius: 5px;
}
.report tbody tr:last-child {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.report tbody tr:last-child td:last-child {
border-bottom-right-radius: 5px;
}
.report th {
cursor: pointer;
}
.report thead+tbody tr:hover {
background-color: #f5f9fc !important;
}
td.tktDspLabel {
width: 70px;
text-align: right;
overflow: hidden;
}
td.tktDspValue {
text-align: left;
vertical-align: top;
background-color: #f8f8f8;
border: 1px solid #ccc;
}
td.tktDspValue pre {
white-space: pre-wrap;
}
.footer {
border-top: 1px solid #ccc;
padding: 10px;
font-size:.7em;
margin-top: 10px;
color: #ccc;
}
div.timelineDate {
font-weight: bold;
white-space: nowrap;
}
span.submenuctrl, span.submenuctrl input, select.submenuctrl {
color: #777;
}
|
Added skins/etienne1/footer.txt.
> > > > > > | 1 2 3 4 5 6 |
<div class="footer">
This page was generated in about
<th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by
Fossil version $manifest_version $manifest_date
</div>
</body></html>
|
Added skins/etienne1/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss" />
<link rel="stylesheet" href="$home/style.css?default" type="text/css"
media="screen" />
</head>
<body>
<div class="header">
<div class="title"><h1>$<project_name></h1>$<title></div>
<div class="status"><th1>
if {[info exists login]} {
html "$login — <a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
proc menulink {url name} {
upvar current_page current
upvar home home
if {[string range $url 0 [string length $current]] eq "/$current"} {
html "<a href='$home$url' class='active'>$name</a>\n"
} else {
html "<a href='$home$url'>$name</a>\n"
}
}
menulink $index_page Home
if {[anycap jor]} {
menulink /timeline Timeline
}
if {[hascap oh]} {
menulink /dir?ci=tip Files
}
if {[hascap o]} {
menulink /brlist Branches
menulink /taglist Tags
}
if {[hascap r]} {
menulink /ticket Tickets
}
if {[hascap j]} {
menulink /wiki Wiki
}
if {[hascap s]} {
menulink /setup Admin
} elseif {[hascap a]} {
menulink /setup_ulist Users
}
</th1></div>
|
Added skins/khaki/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin: 0ex 0ex;
padding: 0px;
background-color: #fef3bc;
font-family: sans-serif;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: inline;
text-align: center;
vertical-align: bottom;
font-weight: bold;
font-size: 2.5em;
color: #a09048;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 2em;
font-weight: bold;
text-align: left;
padding: 0 0 0 5px;
color: #a09048;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: #a09048;
padding: 5px 5px 0 0;
font-size: 0.8em;
font-weight: bold;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
display: table;
width: 100%;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
padding: 5px 10px 5px 10px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
letter-spacing: 1px;
background-color: #a09048;
color: black;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 0px;
font-size: 0.9em;
text-align: center;
background-color: #c0af58;
color: white;
}
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
color: #a09048;
background-color: white;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 1ex 5px;
}
div.content a { color: #706532; }
div.content a:link { color: #706532; }
div.content a:visited { color: #704032; }
div.content a:hover { background-color: white; color: #706532; }
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 3px 3px 0 3px;
font-size: 1.2em;
font-weight: bold;
background-color: #a09048;
color: white;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #e1d498;
border: 2px #a09048 solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
font-size: 0.8em;
margin-top: 12px;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #a09048;
color: white;
}
/* Hyperlink colors */
div.footer a { color: white; }
div.footer a:link { color: white; }
div.footer a:visited { color: white; }
div.footer a:hover { background-color: white; color: #558195; }
/* <verbatim> blocks */
pre.verbatim {
background-color: #f5f5f5;
padding: 0.5em;
white-space: pre-wrap;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
|
Added skins/khaki/footer.txt.
> > > > | 1 2 3 4 | <div class="footer"> Fossil version $manifest_version $manifest_date </div> </body></html> |
Added skins/khaki/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss">
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen">
</head>
<body>
<div class="header">
<div class="title">$<title></div>
<div class="status">
<div class="logo">$<project_name></div><br/>
<th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Added skins/plain_gray/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
body {
margin: 0ex 1ex;
padding: 0px;
background-color: white;
font-family: sans-serif;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-row;
text-align: center;
/* vertical-align: bottom;*/
font-size: 2em;
font-weight: bold;
background-color: #707070;
color: #ffffff;
min-width: 200px;
white-space: nowrap;
}
/* The page title centered at the top of each page */
div.title {
display: table-cell;
font-size: 1.5em;
font-weight: bold;
text-align: center;
padding: 0 0 0 10px;
color: #404040;
vertical-align: bottom;
width: 100%;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: #404040;
font-size: 0.8em;
font-weight: bold;
min-width: 200px;
white-space: nowrap;
}
/* The header across the top of the page */
div.header {
display: table;
width: 100%;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
padding: 5px 10px 5px 10px;
font-size: 0.9em;
font-weight: bold;
text-align: center;
letter-spacing: 1px;
background-color: #404040;
color: white;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu, div.sectionmenu {
padding: 3px 10px 3px 0px;
font-size: 0.9em;
text-align: center;
background-color: #606060;
color: white;
}
div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.mainmenu a:hover, div.submenu a:hover, div.sectionmenu>a.button:hover {
color: #404040;
background-color: white;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
padding: 0ex 0ex 0ex 0ex;
}
/* Hyperlink colors */
div.content a { color: #604000; }
div.content a:link { color: #604000;}
div.content a:visited { color: #600000; }
/* <verbatim> blocks */
pre.verbatim {
background-color: #ffffff;
padding: 0.5em;
white-space: pre-wrap;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0px;
margin-top: 1em;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
background-color: #404040;
color: white;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
background: #a0a0a0;
border: 2px #505050 solid;
font-size: 1em; font-weight: normal;
padding: .25em;
margin: .2em 0 .2em 0;
float: left;
clear: left;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
font-size: 0.8em;
margin-top: 12px;
padding: 5px 10px 5px 10px;
text-align: right;
background-color: #404040;
color: white;
}
/* The label/value pairs on (for example) the vinfo page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
|
Added skins/plain_gray/footer.txt.
> > > > | 1 2 3 4 | <div class="footer"> Fossil version $manifest_version $manifest_date </div> </body></html> |
Added skins/plain_gray/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss">
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen">
</head>
<body>
<div class="header">
<div class="title"><small>$<project_name></small><br />$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Added skins/rounded1/css.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
/* General settings for the entire page */
html {
min-height: 100%;
}
body {
margin: 0ex 1ex;
padding: 0px;
background-color: white;
color: #333;
font-family: Verdana, sans-serif;
font-size: 0.8em;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
-mx-text-size-adjust: none;
}
/* The project logo in the upper left-hand corner of each page */
div.logo {
display: table-cell;
text-align: right;
vertical-align: bottom;
font-weight: normal;
white-space: nowrap;
}
/* Widths */
div.header, div.mainmenu, div.submenu, div.content, div.footer {
max-width: 900px;
margin: auto;
padding: 3px 20px 3px 20px;
clear: both;
}
/* The page title at the top of each page */
div.title {
display: table-cell;
padding-left: 10px;
font-size: 2em;
margin: 10px 0 10px -20px;
vertical-align: bottom;
text-align: left;
width: 80%;
font-family: Verdana, sans-serif;
font-weight: bold;
color: #558195;
text-shadow: 0px 2px 2px #999999;
}
/* The login status message in the top right-hand corner */
div.status {
display: table-cell;
text-align: right;
vertical-align: bottom;
color: #333;
margin-right: -20px;
white-space: nowrap;
}
/* The main menu bar that appears at the top of the page beneath
** the header */
div.mainmenu {
text-align: center;
color: white;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
vertical-align: middle;
padding-top: 8px;
padding-bottom: 8px;
background-color: #446979;
box-shadow: 0px 3px 4px #333333;
}
/* The submenu bar that *sometimes* appears below the main menu */
div.submenu {
padding-top:10px;
padding-bottom:0;
text-align: right;
color: #000;
background-color: #fff;
height: 1.5em;
vertical-align:middle;
box-shadow: 0px 3px 4px #999;
}
div.mainmenu a, div.mainmenu a:visited {
padding: 3px 10px 3px 10px;
color: white;
text-decoration: none;
}
div.submenu a, div.submenu a:visited, a.button,
div.sectionmenu>a.button:link, div.sectionmenu>a.button:visited {
padding: 2px 8px;
color: #000;
font-family: Arial;
text-decoration: none;
margin:auto;
border-radius: 5px;
background-color: #e0e0e0;
text-shadow: 0px -1px 0px #eee;
border: 1px solid #000;
}
div.mainmenu a:hover {
color: #000;
background-color: white;
}
div.submenu a:hover, div.sectionmenu>a.button:hover {
background-color: #c0c0c0;
}
/* All page content from the bottom of the menu or submenu down to
** the footer */
div.content {
background-color: #fff;
box-shadow: 0px 3px 4px #999;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
padding-bottom: 1em;
min-height:40%;
}
/* Some pages have section dividers */
div.section {
margin-bottom: 0.5em;
margin-top: 1em;
margin-right: auto;
padding: 1px 1px 1px 1px;
font-size: 1.2em;
font-weight: bold;
text-align: center;
color: white;
border-radius: 5px;
background-color: #446979;
box-shadow: 0px 3px 4px #333333;
white-space: nowrap;
}
/* The "Date" that occurs on the left hand side of timelines */
div.divider {
font-size: 1.2em;
font-family: Georgia, serif;
font-weight: bold;
margin-top: 1em;
white-space: nowrap;
}
/* The footer at the very bottom of the page */
div.footer {
font-size: 0.9em;
text-align: right;
margin-bottom: 1em;
color: #666;
}
/* Hyperlink colors in the footer */
div.footer a { color: white; }
div.footer a:link { color: white; }
div.footer a:visited { color: white; }
div.footer a:hover { background-color: white; color: #558195; }
/* <verbatim> blocks */
pre.verbatim, blockquote pre {
font-family: Dejavu Sans Mono, Monaco, Lucida Console, monospace;
background-color: #f3f3f3;
padding: 0.5em;
white-space: pre-wrap;
}
blockquote pre {
border: 1px #000 dashed;
}
/* The label/value pairs on (for example) the ci page */
table.label-value th {
vertical-align: top;
text-align: right;
padding: 0.2ex 2ex;
}
table.report tr th {
padding: 3px 5px;
text-transform: capitalize;
cursor: pointer;
}
table.report tr td {
padding: 3px 5px;
}
textarea {
font-size: 1em;
}
.fullsize-text {
font-size: 1.25em;
}
|
Added skins/rounded1/footer.txt.
> > > > | 1 2 3 4 | <div class="footer"> Fossil version $manifest_version $manifest_date </div> </body></html> |
Added skins/rounded1/header.txt.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss">
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen">
</head>
<body>
<div class="header">
<div class="logo">
<img src="$logo_image_url" alt="logo">
<br />$<project_name>
</div>
<div class="title">$<title></div>
<div class="status"><th1>
if {[info exists login]} {
puts "Logged in as $login"
} else {
puts "Not logged in"
}
</th1></div>
</div>
<div class="mainmenu">
<th1>
html "<a href='$home$index_page'>Home</a>\n"
if {[anycap jor]} {
html "<a href='$home/timeline'>Timeline</a>\n"
}
if {[anoncap oh]} {
html "<a href='$home/tree?ci=tip'>Files</a>\n"
}
if {[anoncap o]} {
html "<a href='$home/brlist'>Branches</a>\n"
html "<a href='$home/taglist'>Tags</a>\n"
}
if {[anoncap r]} {
html "<a href='$home/ticket'>Tickets</a>\n"
}
if {[anoncap j]} {
html "<a href='$home/wiki'>Wiki</a>\n"
}
if {[hascap s]} {
html "<a href='$home/setup'>Admin</a>\n"
} elseif {[hascap a]} {
html "<a href='$home/setup_ulist'>Users</a>\n"
}
if {[info exists login]} {
html "<a href='$home/login'>Logout</a>\n"
} else {
html "<a href='$home/login'>Login</a>\n"
}
</th1></div>
|
Changes to src/add.c.
| ︙ | ︙ | |||
151 152 153 154 155 156 157 158 159 160 |
}
if( db_exists("SELECT 1 FROM vfile"
" WHERE pathname=%Q %s", zPath, filename_collation()) ){
db_multi_exec("UPDATE vfile SET deleted=0"
" WHERE pathname=%Q %s", zPath, filename_collation());
}else{
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)"
"VALUES(%d,0,0,0,%Q,%d,%d)",
| > | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
}
if( db_exists("SELECT 1 FROM vfile"
" WHERE pathname=%Q %s", zPath, filename_collation()) ){
db_multi_exec("UPDATE vfile SET deleted=0"
" WHERE pathname=%Q %s", zPath, filename_collation());
}else{
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
int isExe = file_wd_isexe(zFullname);
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)"
"VALUES(%d,0,0,0,%Q,%d,%d)",
vid, zPath, isExe, file_wd_islink(0));
fossil_free(zFullname);
}
if( db_changes() ){
fossil_print("ADDED %s\n", zPath);
return 1;
}else{
fossil_print("SKIP %s\n", zPath);
|
| ︙ | ︙ | |||
234 235 236 237 238 239 240 | ** ** The --case-sensitive option determines whether or not filenames should ** be treated case sensitive or not. If the option is not given, the default ** depends on the global setting, or the operating system default, if not set. ** ** Options: ** | | | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
**
** The --case-sensitive option determines whether or not filenames should
** be treated case sensitive or not. If the option is not given, the default
** depends on the global setting, or the operating system default, if not set.
**
** Options:
**
** --case-sensitive <BOOL> Override the case-sensitive setting.
** --dotfiles include files beginning with a dot (".")
** -f|--force Add files without prompting
** --ignore <CSG> Ignore files matching patterns from the
** comma separated list of glob patterns.
** --clean <CSG> Also ignore files matching patterns from
** the comma separated list of glob patterns.
**
** See also: addremove, rm
*/
void add_cmd(void){
int i; /* Loop counter */
int vid; /* Currently checked out version */
|
| ︙ | ︙ | |||
342 343 344 345 346 347 348 | ** Remove one or more files or directories from the repository. ** ** This command does NOT remove the files from disk. It just marks the ** files as no longer being part of the project. In other words, future ** changes to the named files will not be versioned. ** ** Options: | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
** Remove one or more files or directories from the repository.
**
** This command does NOT remove the files from disk. It just marks the
** files as no longer being part of the project. In other words, future
** changes to the named files will not be versioned.
**
** Options:
** --case-sensitive <BOOL> Override the case-sensitive setting.
**
** See also: addremove, add
*/
void delete_cmd(void){
int i;
Stmt loop;
|
| ︙ | ︙ | |||
487 488 489 490 491 492 493 | ** the --dotfiles option is used. ** ** The --ignore option overrides the "ignore-glob" setting, as do the ** --case-sensitive option with the "case-sensitive" setting and the ** --clean option with the "clean-glob" setting. See the documentation ** on the "settings" command for further information. ** | | > | | | | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
** the --dotfiles option is used.
**
** The --ignore option overrides the "ignore-glob" setting, as do the
** --case-sensitive option with the "case-sensitive" setting and the
** --clean option with the "clean-glob" setting. See the documentation
** on the "settings" command for further information.
**
** The -n|--dry-run option shows what would happen without actually doing
** anything.
**
** This command can be used to track third party software.
**
** Options:
** --case-sensitive <BOOL> Override the case-sensitive setting.
** --dotfiles Include files beginning with a dot (".")
** --ignore <CSG> Ignore files matching patterns from the
** comma separated list of glob patterns.
** --clean <CSG> Also ignore files matching patterns from
** the comma separated list of glob patterns.
** -n|--dry-run If given, display instead of run actions.
**
** See also: add, rm
*/
void addremove_cmd(void){
Blob path;
const char *zCleanFlag = find_option("clean",0,1);
const char *zIgnoreFlag = find_option("ignore",0,1);
|
| ︙ | ︙ | |||
584 585 586 587 588 589 590 | /* ** Rename a single file. ** ** The original name of the file is zOrig. The new filename is zNew. */ | | > > > > | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
*/
static void mv_one_file(
int vid,
const char *zOrig,
const char *zNew
){
int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s",
zNew, filename_collation());
if( x>=0 ){
if( x==0 ){
fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'"
" is currently under management", zOrig, zNew, zNew);
}else{
|
| ︙ | ︙ | |||
618 619 620 621 622 623 624 | ** You can either rename a file or directory or move it to another subdirectory. ** ** This command does NOT rename or move the files on disk. This command merely ** records the fact that filenames have changed so that appropriate notations ** can be made at the next commit/checkin. ** ** Options: | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
** You can either rename a file or directory or move it to another subdirectory.
**
** This command does NOT rename or move the files on disk. This command merely
** records the fact that filenames have changed so that appropriate notations
** can be made at the next commit/checkin.
**
** Options:
** --case-sensitive <BOOL> Override the case-sensitive setting.
**
** See also: changes, status
*/
void mv_cmd(void){
int i;
int vid;
char *zDest;
|
| ︙ | ︙ |
Changes to src/allrepo.c.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | ** ** dbstat Run the "dbstat" command on all repositories. ** ** extras Shows "extra" files from all local checkouts. The command ** line options supported by the extra command itself, if any ** are present, are passed along verbatim. ** | < < < < < < < < > > > > > > > > > > > > > > > | 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 | ** ** dbstat Run the "dbstat" command on all repositories. ** ** extras Shows "extra" files from all local checkouts. The command ** line options supported by the extra command itself, if any ** are present, are passed along verbatim. ** ** info Run the "info" command on all repositories. ** ** pull Run a "pull" operation on all repositories. Only the ** --verbose option is supported. ** ** push Run a "push" on all repositories. Only the --verbose ** option is supported. ** ** rebuild Rebuild on all repositories. The command line options ** supported by the rebuild command itself, if any are ** present, are passed along verbatim. The --force and ** --randomize options are not supported. ** ** sync Run a "sync" on all repositories. Only the --verbose ** option is supported. ** ** setting Run the "setting", "set", or "unset" commands on all ** set repositories. These command are particularly useful in ** unset conjunction with the "max-loadavg" setting which cannot ** otherwise be set globally. ** ** In addition, the following maintenance operations are supported: ** ** add Add all the repositories named to the set of repositories ** tracked by Fossil. Normally Fossil is able to keep up with ** this list by itself, but sometime it can benefit from this ** hint if you rename repositories. ** ** ignore Arguments are repositories that should be ignored by ** subsequent clean, extras, list, pull, push, rebuild, and ** sync operations. The -c|--ckout option causes the listed ** local checkouts to be ignored instead. ** ** list | ls Display the location of all repositories. The -c|--ckout ** option causes all local checkouts to be listed instead. ** ** Repositories are automatically added to the set of known repositories ** when one of the following commands are run against the repository: ** clone, info, pull, push, or sync. Even previously ignored repositories ** are added back to the list of repositories by these commands. ** ** Options: ** --showfile Show the repository or checkout being operated upon. |
| ︙ | ︙ | |||
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 |
collect_argument(&extra, "noverify",0);
collect_argument_value(&extra, "pagesize");
collect_argument(&extra, "vacuum",0);
collect_argument(&extra, "deanalyze",0);
collect_argument(&extra, "analyze",0);
collect_argument(&extra, "wal",0);
collect_argument(&extra, "stats",0);
}else if( strncmp(zCmd, "setting", n)==0 ){
zCmd = "setting -R";
collect_argv(&extra, 3);
}else if( strncmp(zCmd, "unset", n)==0 ){
zCmd = "unset -R";
collect_argv(&extra, 3);
}else if( strncmp(zCmd, "sync", n)==0 ){
zCmd = "sync -autourl -R";
collect_argument(&extra, "verbose","v");
}else if( strncmp(zCmd, "test-integrity", n)==0 ){
collect_argument(&extra, "parse", 0);
zCmd = "test-integrity";
}else if( strncmp(zCmd, "test-orphans", n)==0 ){
zCmd = "test-orphans -R";
}else if( strncmp(zCmd, "test-missing", n)==0 ){
zCmd = "test-missing -q -R";
collect_argument(&extra, "notshunned",0);
}else if( strncmp(zCmd, "changes", n)==0 ){
zCmd = "changes --quiet --header --chdir";
useCheckouts = 1;
stopOnError = 0;
quiet = 1;
}else if( strncmp(zCmd, "ignore", n)==0 ){
int j;
useCheckouts = find_option("ckout","c",0)!=0;
verify_all_options();
db_begin_transaction();
| > > > > > > > > | | < | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > | 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 |
collect_argument(&extra, "noverify",0);
collect_argument_value(&extra, "pagesize");
collect_argument(&extra, "vacuum",0);
collect_argument(&extra, "deanalyze",0);
collect_argument(&extra, "analyze",0);
collect_argument(&extra, "wal",0);
collect_argument(&extra, "stats",0);
collect_argument(&extra, "index",0);
collect_argument(&extra, "noindex",0);
collect_argument(&extra, "ifneeded", 0);
}else if( strncmp(zCmd, "setting", n)==0 ){
zCmd = "setting -R";
collect_argv(&extra, 3);
}else if( strncmp(zCmd, "unset", n)==0 ){
zCmd = "unset -R";
collect_argv(&extra, 3);
}else if( strncmp(zCmd, "fts-config", n)==0 ){
zCmd = "fts-config -R";
collect_argv(&extra, 3);
}else if( strncmp(zCmd, "sync", n)==0 ){
zCmd = "sync -autourl -R";
collect_argument(&extra, "verbose","v");
}else if( strncmp(zCmd, "test-integrity", n)==0 ){
collect_argument(&extra, "parse", 0);
zCmd = "test-integrity";
}else if( strncmp(zCmd, "test-orphans", n)==0 ){
zCmd = "test-orphans -R";
}else if( strncmp(zCmd, "test-missing", n)==0 ){
zCmd = "test-missing -q -R";
collect_argument(&extra, "notshunned",0);
}else if( strncmp(zCmd, "changes", n)==0 ){
zCmd = "changes --quiet --header --chdir";
useCheckouts = 1;
stopOnError = 0;
quiet = 1;
}else if( strncmp(zCmd, "ignore", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
useCheckouts = find_option("ckout","c",0)!=0;
verify_all_options();
db_begin_transaction();
for(j=3; j<g.argc; j++, blob_reset(&sql), blob_reset(&fn)){
file_canonical_name(g.argv[j], &fn, 0);
blob_append_sql(&sql,
"DELETE FROM global_config WHERE name GLOB '%s:%q'",
useCheckouts?"ckout":"repo", blob_str(&fn)
);
if( dryRunFlag ){
fossil_print("%s\n", blob_sql_text(&sql));
}else{
db_multi_exec("%s", blob_sql_text(&sql));
}
}
db_end_transaction(0);
return;
}else if( strncmp(zCmd, "add", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
verify_all_options();
db_begin_transaction();
for(j=3; j<g.argc; j++, blob_reset(&fn), blob_reset(&sql)){
sqlite3 *db;
int rc;
const char *z;
file_canonical_name(g.argv[j], &fn, 0);
z = blob_str(&fn);
if( !file_isfile(z) ) continue;
rc = sqlite3_open(z, &db);
if( rc!=SQLITE_OK ){ sqlite3_close(db); continue; }
rc = sqlite3_exec(db, "SELECT rcvid FROM blob, delta LIMIT 1", 0, 0, 0);
sqlite3_close(db);
if( rc!=SQLITE_OK ) continue;
blob_append_sql(&sql,
"INSERT INTO global_config(name,value)VALUES('repo:%q',1)", z
);
if( dryRunFlag ){
fossil_print("%s\n", blob_sql_text(&sql));
}else{
db_multi_exec("%s", blob_sql_text(&sql));
}
}
db_end_transaction(0);
return;
}else if( strncmp(zCmd, "info", n)==0 ){
zCmd = "info";
showLabel = 1;
quiet = 1;
|
| ︙ | ︙ |
Changes to src/attach.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 |
"SELECT datetime(mtime%s), src, target, filename,"
" comment, user,"
" (SELECT uuid FROM blob WHERE rid=attachid), attachid"
" FROM attachment",
timeline_utc()
);
if( zPage ){
| | | | > > > | 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 |
"SELECT datetime(mtime%s), src, target, filename,"
" comment, user,"
" (SELECT uuid FROM blob WHERE rid=attachid), attachid"
" FROM attachment",
timeline_utc()
);
if( zPage ){
if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
style_header("Attachments To %h", zPage);
blob_append_sql(&sql, " WHERE target=%Q", zPage);
}else if( zTkt ){
if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
style_header("Attachments To Ticket %S", zTkt);
blob_append_sql(&sql, " WHERE target GLOB '%q*'", zTkt);
}else{
if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ){
login_needed(g.anon.RdTkt || g.anon.RdWiki);
return;
}
style_header("All Attachments");
}
blob_append_sql(&sql, " ORDER BY mtime DESC");
db_prepare(&q, "%s", blob_sql_text(&sql));
@ <ol>
while( db_step(&q)==SQLITE_ROW ){
const char *zDate = db_column_text(&q, 0);
|
| ︙ | ︙ | |||
84 85 86 87 88 89 90 |
}
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename);
}else{
zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
}
@ <li><p>
| | | | | | | 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 |
}
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename);
}else{
zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
}
@ <li><p>
@ Attachment %z(href("%R/ainfo/%!S",zUuid))%S(zUuid)</a>
if( moderation_pending(attachid) ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
@ <br><a href="%R/attachview?%s(zUrlTail)">%h(zFilename)</a>
@ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
if( zComment && zComment[0] ){
@ %!w(zComment)<br />
}
if( zPage==0 && zTkt==0 ){
if( zSrc==0 || zSrc[0]==0 ){
zSrc = "Deleted from";
}else {
zSrc = "Added to";
}
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget, UUID_SIZE) ){
@ %s(zSrc) ticket <a href="%R/tktview?name=%s(zTarget)">
@ %S(zTarget)</a>
}else{
@ %s(zSrc) wiki page <a href="%R/wiki?name=%t(zTarget)">
@ %h(zTarget)</a>
}
}else{
if( zSrc==0 || zSrc[0]==0 ){
@ Deleted
}else {
@ Added
|
| ︙ | ︙ | |||
148 149 150 151 152 153 154 |
int attachid = atoi(PD("attachid","0"));
char *zUUID;
if( zPage && zTkt ) zTkt = 0;
if( zFile==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
| | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
int attachid = atoi(PD("attachid","0"));
char *zUUID;
if( zPage && zTkt ) zTkt = 0;
if( zFile==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; }
zTarget = zPage;
}else if( zTkt ){
if( g.perm.RdTkt==0 ){ login_needed(g.anon.RdTkt); return; }
zTarget = zTkt;
}else{
fossil_redirect_home();
}
if( attachid>0 ){
zUUID = db_text(0,
"SELECT coalesce(src,'x') FROM attachment"
|
| ︙ | ︙ | |||
241 242 243 244 245 246 247 |
int goodCaptcha = 1;
if( P("cancel") ) cgi_redirect(zFrom);
if( zPage && zTkt ) fossil_redirect_home();
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
| | > > > | | | > > > | | | 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 |
int goodCaptcha = 1;
if( P("cancel") ) cgi_redirect(zFrom);
if( zPage && zTkt ) fossil_redirect_home();
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
login_check_credentials();
if( zPage ){
if( g.perm.ApndWiki==0 || g.perm.Attach==0 ){
login_needed(g.anon.ApndWiki && g.anon.Attach);
return;
}
if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
fossil_redirect_home();
}
zTarget = zPage;
zTargetType = mprintf("Wiki Page <a href=\"%R/wiki?name=%h\">%h</a>",
zPage, zPage);
}else{
if( g.perm.ApndTkt==0 || g.perm.Attach==0 ){
login_needed(g.anon.ApndTkt && g.anon.Attach);
return;
}
if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
" WHERE tagname GLOB 'tkt-%q*'", zTkt);
if( zTkt==0 ) fossil_redirect_home();
}
zTarget = zTkt;
zTargetType = mprintf("Ticket <a href=\"%R/tktview/%s\">%S</a>",
zTkt, zTkt);
}
if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
if( P("cancel") ){
cgi_redirect(zFrom);
}
if( P("ok") && szContent>0 && (goodCaptcha = captcha_is_correct()) ){
Blob content;
|
| ︙ | ︙ | |||
367 368 369 370 371 372 373 |
int isModerator; /* TRUE if user is the moderator */
const char *zMime; /* MIME Type */
Blob attach; /* Content of the attachment */
int fShowContent = 0;
const char *zLn = P("ln");
login_check_credentials();
| | > > > | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
int isModerator; /* TRUE if user is the moderator */
const char *zMime; /* MIME Type */
Blob attach; /* Content of the attachment */
int fShowContent = 0;
const char *zLn = P("ln");
login_check_credentials();
if( !g.perm.RdTkt && !g.perm.RdWiki ){
login_needed(g.anon.RdTkt || g.anon.RdWiki);
return;
}
rid = name_to_rid_www("name");
if( rid==0 ){ fossil_redirect_home(); }
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
#if 0
/* Shunning here needs to get both the attachment control artifact and
** the object that is attached. */
if( g.perm.Admin ){
|
| ︙ | ︙ | |||
397 398 399 400 401 402 403 |
zDesc = pAttach->zComment;
zMime = mimetype_from_name(zName);
fShowContent = zMime ? strncmp(zMime,"text/", 5)==0 : 0;
if( validate16(zTarget, strlen(zTarget))
&& db_exists("SELECT 1 FROM ticket WHERE tkt_uuid='%q'", zTarget)
){
zTktUuid = zTarget;
| | | | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
zDesc = pAttach->zComment;
zMime = mimetype_from_name(zName);
fShowContent = zMime ? strncmp(zMime,"text/", 5)==0 : 0;
if( validate16(zTarget, strlen(zTarget))
&& db_exists("SELECT 1 FROM ticket WHERE tkt_uuid='%q'", zTarget)
){
zTktUuid = zTarget;
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
if( g.perm.WrTkt ){
style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid);
}
}else if( db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'",zTarget) ){
zWikiName = zTarget;
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
if( g.perm.WrWiki ){
style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid);
}
}
zDate = db_text(0, "SELECT datetime(%.12f)", pAttach->rDate);
if( P("confirm")
|
| ︙ | ︙ | |||
441 442 443 444 445 446 447 |
db_end_transaction(0);
@ <p>The attachment below has been deleted.</p>
}
if( P("del")
&& ((zTktUuid && g.perm.WrTkt) || (zWikiName && g.perm.WrWiki))
){
| | | | | 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 |
db_end_transaction(0);
@ <p>The attachment below has been deleted.</p>
}
if( P("del")
&& ((zTktUuid && g.perm.WrTkt) || (zWikiName && g.perm.WrWiki))
){
form_begin(0, "%R/ainfo/%!S", zUuid);
@ <p>Confirm you want to delete the attachment shown below.
@ <input type="submit" name="confirm" value="Confirm">
@ </form>
}
isModerator = g.perm.Admin ||
(zTktUuid && g.perm.ModTkt) ||
(zWikiName && g.perm.ModWiki);
if( isModerator && (zModAction = P("modaction"))!=0 ){
if( strcmp(zModAction,"delete")==0 ){
moderation_disapprove(rid);
if( zTktUuid ){
cgi_redirectf("%R/tktview/%!S", zTktUuid);
}else{
cgi_redirectf("%R/wiki?name=%t", zWikiName);
}
return;
}
if( strcmp(zModAction,"approve")==0 ){
moderation_approve(rid);
}
}
style_header("Attachment Details");
style_submenu_element("Raw", "Raw", "%R/artifact/%s", zUuid);
if(fShowContent){
style_submenu_element("Line Numbers", "Line Numbers",
"%R/ainfo/%s%s",zUuid,
((zLn&&*zLn) ? "" : "?ln=0"));
}
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
if( g.perm.Setup ){
@ (%d(rid))
}
modPending = moderation_pending(rid);
if( modPending ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
|
| ︙ | ︙ | |||
577 578 579 580 581 582 583 |
const char *zSrc = db_column_text(&q, 4);
const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
if( cnt==0 ){
@ %s(zHeader)
}
cnt++;
@ <li>
| | | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
const char *zSrc = db_column_text(&q, 4);
const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
if( cnt==0 ){
@ %s(zHeader)
}
cnt++;
@ <li>
@ %z(href("%R/artifact/%!S",zSrc))%h(zFile)</a>
@ added by %h(zDispUser) on
hyperlink_to_date(zDate, ".");
@ [%z(href("%R/ainfo/%!S",zUuid))details</a>]
@ </li>
}
if( cnt ){
@ </ul>
}
db_finalize(&q);
}
|
Changes to src/blob.c.
| ︙ | ︙ | |||
751 752 753 754 755 756 757 | /* ** Initialize a blob to be the content of a file. If the filename ** is blank or "-" then read from standard input. ** ** Any prior content of the blob is discarded, not freed. ** | | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
/*
** Initialize a blob to be the content of a file. If the filename
** is blank or "-" then read from standard input.
**
** Any prior content of the blob is discarded, not freed.
**
** Return the number of bytes read. Calls fossil_fatal() on error (i.e.
** it exit()s and does not return).
*/
int blob_read_from_file(Blob *pBlob, const char *zFilename){
int size, got;
FILE *in;
if( zFilename==0 || zFilename[0]==0
|| (zFilename[0]=='-' && zFilename[1]==0) ){
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
157 158 159 160 161 162 163 |
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){
fossil_fatal("%s\n", g.zErrMsg);
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
| | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){
fossil_fatal("%s\n", g.zErrMsg);
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
fossil_print("New branch: %S\n", zUuid);
if( g.argc==3 ){
fossil_print(
"\n"
"Note: the local check-out has not been updated to the new\n"
" branch. To begin working on the new branch, do this:\n"
"\n"
" %s update %s\n",
|
| ︙ | ︙ | |||
300 301 302 303 304 305 306 |
db_finalize(&q);
}else{
fossil_fatal("branch subcommand should be one of: "
"new list ls");
}
}
| | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
db_finalize(&q);
}else{
fossil_fatal("branch subcommand should be one of: "
"new list ls");
}
}
static const char brlistQuery[] =
@ SELECT
@ tagxref.value,
@ max(event.mtime),
@ EXISTS(SELECT 1 FROM tagxref AS tx
@ WHERE tx.rid=tagxref.rid
@ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed')
@ AND tx.tagtype>0),
|
| ︙ | ︙ | |||
337 338 339 340 341 342 343 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
login_check_credentials();
| | > | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_adunit_config(ADUNIT_RIGHT_OK);
login_anonymous_available();
db_prepare(&q, brlistQuery/*works-like:""*/);
rNow = db_double(0.0, "SELECT julianday('now')");
@ <div class="brlist"><table id="branchlisttable">
@ <thead><tr>
@ <th>Branch Name</th>
@ <th>Age</th>
@ <th>Checkins</th>
|
| ︙ | ︙ | |||
364 365 366 367 368 369 370 |
const char *zLastCkin = db_column_text(&q, 5);
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
@ <tr>
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
| | | | | 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 |
const char *zLastCkin = db_column_text(&q, 5);
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
@ <tr>
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
@ <td>%d(nCkin)</td>
fossil_free(zAge);
@ <td>%s(isClosed?"closed":"")</td>
if( zMergeTo ){
@ <td>merged into
@ %z(href("%R/timeline?f=%!S",zLastCkin))%h(zMergeTo)</a></td>
}else{
@ <td></td>
}
@ </tr>
}
@ </tbody></table></div>
db_finalize(&q);
output_table_sorting_javascript("branchlisttable","tkNtt",2);
style_footer();
}
/*
** WEBPAGE: brlist
** Show a list of branches
** Query parameters:
|
| ︙ | ︙ | |||
405 406 407 408 409 410 411 |
int brFlags = BRL_OPEN_ONLY;
if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
new_brlist_page();
return;
}
login_check_credentials();
| | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
int brFlags = BRL_OPEN_ONLY;
if( showClosed==0 && showAll==0 && showOpen==0 && colorTest==0 ){
new_brlist_page();
return;
}
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( colorTest ){
showClosed = 0;
showAll = 1;
}
if( showAll ) brFlags = BRL_BOTH;
if( showClosed ) brFlags = BRL_CLOSED_ONLY;
|
| ︙ | ︙ | |||
512 513 514 515 516 517 518 |
**
** Show a timeline of all branches
*/
void brtimeline_page(void){
Stmt q;
login_check_credentials();
| | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
**
** Show a timeline of all branches
*/
void brtimeline_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_submenu_element("List", "List", "brlist");
login_anonymous_available();
@ <h2>The initial check-in for each branch:</h2>
db_prepare(&q,
"%s AND blob.rid IN (SELECT rid FROM tagxref"
" WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
" ORDER BY event.mtime DESC",
timeline_query_for_www(), TAG_BRANCH
);
www_print_timeline(&q, 0, 0, 0, 0, brtimeline_extra);
db_finalize(&q);
style_footer();
}
|
Changes to src/browse.c.
| ︙ | ︙ | |||
83 84 85 86 87 88 89 |
int i, j;
char *zSep = "";
for(i=0; zPath[i]; i=j){
for(j=i; zPath[j] && zPath[j]!='/'; j++){}
if( zPath[j] && g.perm.Hyperlink ){
if( zCI ){
| | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
int i, j;
char *zSep = "";
for(i=0; zPath[i]; i=j){
for(j=i; zPath[j] && zPath[j]!='/'; j++){}
if( zPath[j] && g.perm.Hyperlink ){
if( zCI ){
char *zLink = href("%R/%s?name=%#T%s&ci=%!S", zURI, j, zPath, zREx,zCI);
blob_appendf(pOut, "%s%z%#h</a>",
zSep, zLink, j-i, &zPath[i]);
}else{
char *zLink = href("%R/%s?name=%#T%s", zURI, j, zPath, zREx);
blob_appendf(pOut, "%s%z%#h</a>",
zSep, zLink, j-i, &zPath[i]);
}
|
| ︙ | ︙ | |||
126 127 128 129 130 131 132 | Blob dirname; Manifest *pM = 0; const char *zSubdirLink; int linkTrunk = 1; int linkTip = 1; HQuery sURI; | | | > > < < | | | | 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 |
Blob dirname;
Manifest *pM = 0;
const char *zSubdirLink;
int linkTrunk = 1;
int linkTip = 1;
HQuery sURI;
if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; }
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
style_header("File List");
style_adunit_config(ADUNIT_RIGHT_OK);
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
pathelementFunc, 0, 0);
url_initialize(&sURI, "dir");
cgi_query_parameters_to_url(&sURI);
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
** files from all check-ins to be displayed.
*/
if( zCI ){
pM = manifest_get_by_name(zCI, &rid);
if( pM ){
int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
linkTrunk = trunkRid && rid != trunkRid;
linkTip = rid != symbolic_name_to_rid("tip", "ci");
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}else{
zCI = 0;
}
}
/* Compute the title of the page */
blob_zero(&dirname);
if( zD ){
blob_append(&dirname, "in directory ", -1);
hyperlinked_path(zD, &dirname, zCI, "dir", "");
zPrefix = mprintf("%s/", zD);
style_submenu_element("Top-Level", "Top-Level", "%s",
url_render(&sURI, "name", 0, 0, 0));
}else{
blob_append(&dirname, "in the top-level directory", -1);
zPrefix = "";
}
if( linkTrunk ){
style_submenu_element("Trunk", "Trunk", "%s",
url_render(&sURI, "ci", "trunk", 0, 0));
}
if( linkTip ){
style_submenu_element("Tip", "Tip", "%s",
url_render(&sURI, "ci", "tip", 0, 0));
}
if( zCI ){
@ <h2>Files of check-in [%z(href("vinfo?name=%!S",zUuid))%S(zUuid)</a>]
@ %s(blob_str(&dirname))</h2>
zSubdirLink = mprintf("%R/dir?ci=%!S&name=%T", zUuid, zPrefix);
if( nD==0 ){
style_submenu_element("File Ages", "File Ages", "%R/fileage?name=%!S",
zUuid);
}
}else{
@ <h2>The union of all files from all check-ins
@ %s(blob_str(&dirname))</h2>
zSubdirLink = mprintf("%R/dir?name=%T", zPrefix);
}
|
| ︙ | ︙ | |||
279 280 281 282 283 284 285 |
if( zFN[0]=='/' ){
zFN++;
@ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li>
}else{
const char *zLink;
if( zCI ){
const char *zUuid = db_column_text(&q, 1);
| | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
if( zFN[0]=='/' ){
zFN++;
@ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li>
}else{
const char *zLink;
if( zCI ){
const char *zUuid = db_column_text(&q, 1);
zLink = href("%R/artifact/%!S",zUuid);
}else{
zLink = href("%R/finfo?name=%T%T",zPrefix,zFN);
}
@ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li>
}
}
db_finalize(&q);
|
| ︙ | ︙ | |||
537 538 539 540 541 542 543 |
FileTree sTree; /* The complete tree of files */
HQuery sURI; /* Hyperlink */
int startExpanded; /* True to start out with the tree expanded */
int showDirOnly; /* Show directories only. Omit files */
int nDir = 0; /* Number of directories. Used for ID attributes */
char *zProjectName = db_get("project-name", 0);
| | | > | < > | < < < < < < < < < | < < > > > > > | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
FileTree sTree; /* The complete tree of files */
HQuery sURI; /* Hyperlink */
int startExpanded; /* True to start out with the tree expanded */
int showDirOnly; /* Show directories only. Omit files */
int nDir = 0; /* Number of directories. Used for ID attributes */
char *zProjectName = db_get("project-name", 0);
if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; }
memset(&sTree, 0, sizeof(sTree));
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
pathelementFunc, 0, 0);
url_initialize(&sURI, "tree");
cgi_query_parameters_to_url(&sURI);
if( PB("nofiles") ){
showDirOnly = 1;
style_header("Folder Hierarchy");
}else{
showDirOnly = 0;
style_header("File Tree");
}
style_adunit_config(ADUNIT_RIGHT_OK);
if( PB("expand") ){
startExpanded = 1;
}else{
startExpanded = 0;
}
/* If a regular expression is specified, compile it */
zRE = P("re");
if( zRE ){
re_compile(&pRE, zRE, 0);
zREx = mprintf("&re=%T", zRE);
}
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
** files from all check-ins to be displayed.
*/
if( zCI ){
pM = manifest_get_by_name(zCI, &rid);
if( pM ){
int trunkRid = symbolic_name_to_rid("tag:trunk", "ci");
linkTrunk = trunkRid && rid != trunkRid;
linkTip = rid != symbolic_name_to_rid("tip", "ci");
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
zNow = db_text("", "SELECT datetime(mtime,'localtime')"
" FROM event WHERE objid=%d", rid);
}else{
zCI = 0;
}
}
if( zCI==0 ){
rNow = db_double(0.0, "SELECT max(mtime) FROM event");
zNow = db_text("", "SELECT datetime(max(mtime),'localtime') FROM event");
}
/* Compute the title of the page */
blob_zero(&dirname);
if( zD ){
blob_append(&dirname, "within directory ", -1);
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
style_submenu_element("Top-Level", "Top-Level", "%s",
url_render(&sURI, "name", 0, 0, 0));
}else{
if( zRE ){
blob_appendf(&dirname, "matching \"%s\"", zRE);
}
}
style_submenu_binary("mtime","Sort By Time","Sort By Filename", 0);
if( zCI ){
style_submenu_element("All", "All", "%s",
url_render(&sURI, "ci", 0, 0, 0));
if( nD==0 && !showDirOnly ){
style_submenu_element("File Ages", "File Ages", "%R/fileage?name=%s",
zUuid);
}
}
if( linkTrunk ){
style_submenu_element("Trunk", "Trunk", "%s",
url_render(&sURI, "ci", "trunk", 0, 0));
}
if( linkTip ){
style_submenu_element("Tip", "Tip", "%s",
url_render(&sURI, "ci", "tip", 0, 0));
}
style_submenu_element("Flat-View", "Flat-View", "%s",
url_render(&sURI, "type", "flat", 0, 0));
/* Compute the file hierarchy.
*/
if( zCI ){
Stmt q;
compute_fileage(rid, 0);
db_prepare(&q,
"SELECT filename.name, blob.uuid, fileage.mtime\n"
" FROM fileage, filename, blob\n"
" WHERE filename.fnid=fileage.fnid\n"
" AND blob.rid=fileage.fid\n"
" ORDER BY filename.name COLLATE nocase;"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zFile = db_column_text(&q,0);
const char *zUuid = db_column_text(&q,1);
double mtime = db_column_double(&q,2);
if( nD>0 && (fossil_strncmp(zFile, zD, nD-1)!=0 || zFile[nD-1]!='/') ){
continue;
}
if( pRE && re_match(pRE, (const unsigned char*)zFile, -1)==0 ) continue;
tree_add_node(&sTree, zFile, zUuid, mtime);
nFile++;
}
db_finalize(&q);
}else{
Stmt q;
|
| ︙ | ︙ | |||
696 697 698 699 700 701 702 |
}
if( zCI ){
@ <h2>%s(zObjType) from
if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
@ "%h(zCI)"
}
| | | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
}
if( zCI ){
@ <h2>%s(zObjType) from
if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
@ "%h(zCI)"
}
@ [%z(href("vinfo?name=%!S",zUuid))%S(zUuid)</a>] %s(blob_str(&dirname))
}else{
int n = db_int(0, "SELECT count(*) FROM plink");
@ <h2>%s(zObjType) from all %d(n) check-ins %s(blob_str(&dirname))
}
if( useMtime ){
@ sorted by modification time</h2>
}else{
|
| ︙ | ︙ | |||
758 759 760 761 762 763 764 |
@ <ul id="dir%d(nDir)" class="collapsed">
}
nDir++;
}else if( !showDirOnly ){
const char *zFileClass = fileext_class(p->zName);
char *zLink;
if( zCI ){
| | | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 |
@ <ul id="dir%d(nDir)" class="collapsed">
}
nDir++;
}else if( !showDirOnly ){
const char *zFileClass = fileext_class(p->zName);
char *zLink;
if( zCI ){
zLink = href("%R/artifact/%!S",p->zUuid);
}else{
zLink = href("%R/finfo?name=%T",p->zFullName);
}
@ <li class="%z(zFileClass)%s(zLastClass)"><div class="filetreeline">
@ %z(zLink)%h(p->zName)</a>
if( p->mtime>0 ){
char *zAge = human_readable_age(rNow - p->mtime);
|
| ︙ | ︙ | |||
879 880 881 882 883 884 885 | return zClass; } /* ** SQL used to compute the age of all files in checkin :ckin whose ** names match :glob */ | | | | > | > > > | < < | | > | | | > > | > < | | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
return zClass;
}
/*
** SQL used to compute the age of all files in checkin :ckin whose
** names match :glob
*/
static const char zComputeFileAgeSetup[] =
@ CREATE TABLE IF NOT EXISTS temp.fileage(
@ fnid INTEGER PRIMARY KEY,
@ fid INTEGER,
@ mid INTEGER,
@ mtime DATETIME,
@ pathname TEXT
@ );
@ CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;
;
static const char zComputeFileAgeRun[] =
@ WITH RECURSIVE
@ ckin(x,m) AS (SELECT objid, mtime FROM event WHERE objid=:ckin
@ UNION
@ SELECT plink.pid, event.mtime
@ FROM ckin, plink, event
@ WHERE plink.cid=ckin.x AND event.objid=plink.pid
@ ORDER BY 2 DESC)
@ INSERT OR IGNORE INTO fileage(fnid, fid, mid, mtime, pathname)
@ SELECT filename.fnid, mlink.fid, mlink.mid, event.mtime, filename.name
@ FROM foci, filename, blob, mlink, event
@ WHERE foci.checkinID=:ckin
@ AND foci.filename GLOB :glob
@ AND filename.name=foci.filename
@ AND blob.uuid=foci.uuid
@ AND mlink.fid=blob.rid
@ AND mlink.fid!=mlink.pid
@ AND mlink.mid IN (SELECT x FROM ckin)
@ AND event.objid=mlink.mid
@ ORDER BY event.mtime ASC;
;
/*
** Look at all file containing in the version "vid". Construct a
** temporary table named "fileage" that contains the file-id for each
** files, the pathname, the check-in where the file was added, and the
** mtime on that checkin. If zGlob and *zGlob then only files matching
** the given glob are computed.
*/
int compute_fileage(int vid, const char* zGlob){
Stmt q;
db_multi_exec(zComputeFileAgeSetup /*works-like:"constant"*/);
db_prepare(&q, zComputeFileAgeRun /*works-like:"constant"*/);
db_bind_int(&q, ":ckin", vid);
db_bind_text(&q, ":glob", zGlob && zGlob[0] ? zGlob : "*");
db_exec(&q);
db_finalize(&q);
return 0;
}
|
| ︙ | ︙ | |||
988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
/*
** WEBPAGE: fileage
**
** Parameters:
** name=VERSION Selects the checkin version (default=tip).
** glob=STRING Only shows files matching this glob pattern
** (e.g. *.c or *.txt).
*/
void fileage_page(void){
int rid;
const char *zName;
const char *zGlob;
const char *zUuid;
const char *zNow; /* Time of checkin */
Stmt q1, q2;
double baseTime;
login_check_credentials();
| > > | | > | | | | > > > > | > | > > > | | | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 |
/*
** WEBPAGE: fileage
**
** Parameters:
** name=VERSION Selects the checkin version (default=tip).
** glob=STRING Only shows files matching this glob pattern
** (e.g. *.c or *.txt).
** showid Show RID values for debugging
*/
void fileage_page(void){
int rid;
const char *zName;
const char *zGlob;
const char *zUuid;
const char *zNow; /* Time of checkin */
int showId = PB("showid");
Stmt q1, q2;
double baseTime;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
zName = P("name");
if( zName==0 ) zName = "tip";
rid = symbolic_name_to_rid(zName, "ci");
if( rid==0 ){
fossil_fatal("not a valid check-in: %s", zName);
}
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid);
zNow = db_text("", "SELECT datetime(mtime,'localtime') FROM event"
" WHERE objid=%d", rid);
style_submenu_element("Tree-View", "Tree-View",
"%R/tree?ci=%T&mtime=1&type=tree",
zName);
style_header("File Ages");
zGlob = P("glob");
compute_fileage(rid,zGlob);
db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);");
@ <h2>Files in
@ %z(href("%R/info/%!S",zUuid))[%S(zUuid)]</a>
if( zGlob && zGlob[0] ){
@ that match "%h(zGlob)" and
}
@ ordered by check-in time</h2>
@
@ <p>Times are relative to the checkin time for
@ %z(href("%R/ci/%!S",zUuid))[%S(zUuid)]</a> which is
@ %z(href("%R/timeline?c=%t",zNow))%s(zNow)</a>.</p>
@
@ <div class='fileage'><table>
@ <tr><th>Time</th><th>Files</th><th>Checkin</th></tr>
db_prepare(&q1,
"SELECT event.mtime, event.objid, blob.uuid,\n"
" coalesce(event.ecomment,event.comment),\n"
" coalesce(event.euser,event.user),\n"
" coalesce((SELECT value FROM tagxref\n"
" WHERE tagtype>0 AND tagid=%d\n"
" AND rid=event.objid),'trunk')\n"
" FROM event, blob\n"
" WHERE event.objid IN (SELECT mid FROM fileage)\n"
" AND blob.rid=event.objid\n"
" ORDER BY event.mtime DESC;",
TAG_BRANCH
);
db_prepare(&q2,
"SELECT blob.uuid, filename.name, fileage.fid\n"
" FROM fileage, blob, filename\n"
" WHERE fileage.mid=:mid AND filename.fnid=fileage.fnid"
" AND blob.rid=fileage.fid;"
);
while( db_step(&q1)==SQLITE_ROW ){
double age = baseTime - db_column_double(&q1, 0);
int mid = db_column_int(&q1, 1);
const char *zUuid = db_column_text(&q1, 2);
const char *zComment = db_column_text(&q1, 3);
const char *zUser = db_column_text(&q1, 4);
const char *zBranch = db_column_text(&q1, 5);
char *zAge = human_readable_age(age);
@ <tr><td>%s(zAge)</td>
@ <td>
db_bind_int(&q2, ":mid", mid);
while( db_step(&q2)==SQLITE_ROW ){
const char *zFUuid = db_column_text(&q2,0);
const char *zFile = db_column_text(&q2,1);
int fid = db_column_int(&q2,2);
if( showId ){
@ %z(href("%R/artifact/%!S",zFUuid))%h(zFile)</a> (%d(fid))<br>
}else{
@ %z(href("%R/artifact/%!S",zFUuid))%h(zFile)</a><br>
}
}
db_reset(&q2);
@ </td>
@ <td>
@ %z(href("%R/info/%!S",zUuid))[%S(zUuid)]</a>
if( showId ){
@ (%d(mid))
}
@ %W(zComment) (user:
@ %z(href("%R/timeline?u=%t&c=%!S&nd&n=200",zUser,zUuid))%h(zUser)</a>,
@ branch:
@ %z(href("%R/timeline?r=%t&c=%!S&nd&n=200",zBranch,zUuid))%h(zBranch)</a>)
@ </td></tr>
@
fossil_free(zAge);
}
@ </table></div>
db_finalize(&q1);
db_finalize(&q2);
style_footer();
}
|
Changes to src/builtin.c.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 |
*/
#include "builtin_data.h"
/*
** Return a pointer to built-in content
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
| | | > > > > > > > > | 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 |
*/
#include "builtin_data.h"
/*
** Return a pointer to built-in content
*/
const unsigned char *builtin_file(const char *zFilename, int *piSize){
int lwr, upr, i, c;
lwr = 0;
upr = sizeof(aBuiltinFiles)/sizeof(aBuiltinFiles[0]) - 1;
while( upr>=lwr ){
i = (upr+lwr)/2;
c = strcmp(aBuiltinFiles[i].zName,zFilename);
if( c<0 ){
lwr = i+1;
}else if( c>0 ){
upr = i-1;
}else{
if( piSize ) *piSize = aBuiltinFiles[i].nByte;
return aBuiltinFiles[i].pData;
}
}
if( piSize ) *piSize = 0;
return 0;
}
const char *builtin_text(const char *zFilename){
return (char*)builtin_file(zFilename, 0);
}
/*
** COMMAND: test-builtin-list
**
** List the names and sizes of all built-in resources
*/
|
| ︙ | ︙ |
Changes to src/cache.c.
| ︙ | ︙ | |||
328 329 330 331 332 333 334 |
*/
void cache_page(void){
sqlite3 *db;
sqlite3_stmt *pStmt;
char zBuf[100];
login_check_credentials();
| | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
*/
void cache_page(void){
sqlite3 *db;
sqlite3_stmt *pStmt;
char zBuf[100];
login_check_credentials();
if( !g.perm.Setup ){ login_needed(0); return; }
style_header("Web Cache Status");
db = cacheOpen(0);
if( db==0 ){
@ The web-page cache is disabled for this repository
}else{
char *zDbName = cacheName();
cache_register_sizename(db);
|
| ︙ | ︙ | |||
376 377 378 379 380 381 382 |
** This page is normally a hyperlink from the /cachestat page.
*/
void cache_getpage(void){
const char *zKey;
Blob content;
login_check_credentials();
| | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
** This page is normally a hyperlink from the /cachestat page.
*/
void cache_getpage(void){
const char *zKey;
Blob content;
login_check_credentials();
if( !g.perm.Setup ){ login_needed(0); return; }
zKey = PD("key","");
blob_zero(&content);
if( cache_read(&content, zKey)==0 ){
style_header("Cache Download Error");
@ The cache does not contain any entry with this key: "%h(zKey)"
style_footer();
return;
}
cgi_set_content(&content);
cgi_set_content_type("application/x-compressed");
}
|
Changes to src/cgi.c.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y")
** does the same except "y" is returned in place of NULL if there is not match.
*/
#define P(x) cgi_parameter((x),0)
#define PD(x,y) cgi_parameter((x),(y))
#define PT(x) cgi_parameter_trimmed((x),0)
#define PDT(x,y) cgi_parameter_trimmed((x),(y))
/*
** Destinations for output text.
*/
#define CGI_HEADER 0
#define CGI_BODY 1
| > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y")
** does the same except "y" is returned in place of NULL if there is not match.
*/
#define P(x) cgi_parameter((x),0)
#define PD(x,y) cgi_parameter((x),(y))
#define PT(x) cgi_parameter_trimmed((x),0)
#define PDT(x,y) cgi_parameter_trimmed((x),(y))
#define PB(x) cgi_parameter_boolean(x)
/*
** Destinations for output text.
*/
#define CGI_HEADER 0
#define CGI_BODY 1
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
/*
** Check to see if the header contains the zNeedle string. Return true
** if it does and false if it does not.
*/
int cgi_header_contains(const char *zNeedle){
return strstr(blob_str(&cgiContent[0]), zNeedle)!=0;
}
/*
** Append reply content to what already exists.
*/
void cgi_append_content(const char *zData, int nAmt){
blob_append(pContent, zData, nAmt);
}
| > > > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
/*
** Check to see if the header contains the zNeedle string. Return true
** if it does and false if it does not.
*/
int cgi_header_contains(const char *zNeedle){
return strstr(blob_str(&cgiContent[0]), zNeedle)!=0;
}
int cgi_body_contains(const char *zNeedle){
return strstr(blob_str(&cgiContent[1]), zNeedle)!=0;
}
/*
** Append reply content to what already exists.
*/
void cgi_append_content(const char *zData, int nAmt){
blob_append(pContent, zData, nAmt);
}
|
| ︙ | ︙ | |||
431 432 433 434 435 436 437 |
static int nUsedQP = 0; /* Space actually used in aParamQP[] */
static int sortQP = 0; /* True if aParamQP[] needs sorting */
static int seqQP = 0; /* Sequence numbers */
static struct QParam { /* One entry for each query parameter or cookie */
const char *zName; /* Parameter or cookie name */
const char *zValue; /* Value of the query parameter or cookie */
int seq; /* Order of insertion */
| | > | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
static int nUsedQP = 0; /* Space actually used in aParamQP[] */
static int sortQP = 0; /* True if aParamQP[] needs sorting */
static int seqQP = 0; /* Sequence numbers */
static struct QParam { /* One entry for each query parameter or cookie */
const char *zName; /* Parameter or cookie name */
const char *zValue; /* Value of the query parameter or cookie */
int seq; /* Order of insertion */
char isQP; /* True for query parameters */
char cTag; /* Tag on query parameters */
} *aParamQP; /* An array of all parameters and cookies */
/*
** Add another query parameter or cookie to the parameter set.
** zName is the name of the query parameter or cookie and zValue
** is its fully decoded value.
**
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
aParamQP[nUsedQP].zName = zName;
aParamQP[nUsedQP].zValue = zValue;
if( g.fHttpTrace ){
fprintf(stderr, "# cgi: %s = [%s]\n", zName, zValue);
}
aParamQP[nUsedQP].seq = seqQP++;
aParamQP[nUsedQP].isQP = isQP;
nUsedQP++;
sortQP = 1;
}
/*
** Add another query parameter or cookie to the parameter set.
** zName is the name of the query parameter or cookie and zValue
| > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
aParamQP[nUsedQP].zName = zName;
aParamQP[nUsedQP].zValue = zValue;
if( g.fHttpTrace ){
fprintf(stderr, "# cgi: %s = [%s]\n", zName, zValue);
}
aParamQP[nUsedQP].seq = seqQP++;
aParamQP[nUsedQP].isQP = isQP;
aParamQP[nUsedQP].cTag = 0;
nUsedQP++;
sortQP = 1;
}
/*
** Add another query parameter or cookie to the parameter set.
** zName is the name of the query parameter or cookie and zValue
|
| ︙ | ︙ | |||
485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
for(i=0; i<nUsedQP; i++){
if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
aParamQP[i].zValue = zValue;
return;
}
}
cgi_set_parameter_nocopy(zName, zValue, 0);
}
/*
** Add a query parameter. The zName portion is fixed but a copy
** must be made of zValue.
*/
void cgi_setenv(const char *zName, const char *zValue){
| > > > > > > > > > > > | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
for(i=0; i<nUsedQP; i++){
if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
aParamQP[i].zValue = zValue;
return;
}
}
cgi_set_parameter_nocopy(zName, zValue, 0);
}
void cgi_replace_query_parameter(const char *zName, const char *zValue){
int i;
for(i=0; i<nUsedQP; i++){
if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
aParamQP[i].zValue = zValue;
assert( aParamQP[i].isQP );
return;
}
}
cgi_set_parameter_nocopy(zName, zValue, 1);
}
/*
** Add a query parameter. The zName portion is fixed but a copy
** must be made of zValue.
*/
void cgi_setenv(const char *zName, const char *zValue){
|
| ︙ | ︙ | |||
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
if( zIn==0 ) zIn = zDefault;
while( fossil_isspace(zIn[0]) ) zIn++;
zOut = fossil_strdup(zIn);
for(i=0; zOut[i]; i++){}
while( i>0 && fossil_isspace(zOut[i-1]) ) zOut[--i] = 0;
return zOut;
}
/*
** Return the name of the i-th CGI parameter. Return NULL if there
** are fewer than i registered CGI parameters.
*/
const char *cgi_parameter_name(int i){
if( i>=0 && i<nUsedQP ){
| > > > > > > > > > > | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 |
if( zIn==0 ) zIn = zDefault;
while( fossil_isspace(zIn[0]) ) zIn++;
zOut = fossil_strdup(zIn);
for(i=0; zOut[i]; i++){}
while( i>0 && fossil_isspace(zOut[i-1]) ) zOut[--i] = 0;
return zOut;
}
/*
** Return true if the CGI parameter zName exists and is not equal to 0,
** or "no" or "off".
*/
int cgi_parameter_boolean(const char *zName){
const char *zIn = cgi_parameter(zName, 0);
if( zIn==0 ) return 0;
return zIn[0]==0 || is_truth(zIn);
}
/*
** Return the name of the i-th CGI parameter. Return NULL if there
** are fewer than i registered CGI parameters.
*/
const char *cgi_parameter_name(int i){
if( i>=0 && i<nUsedQP ){
|
| ︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 |
if( fossil_strnicmp("fossil-",zName,7)==0 ) continue;
}
cgi_printf("%h = %h <br />\n", zName, aParamQP[i].zValue);
}
}
/*
| | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
if( fossil_strnicmp("fossil-",zName,7)==0 ) continue;
}
cgi_printf("%h = %h <br />\n", zName, aParamQP[i].zValue);
}
}
/*
** Export all untagged query parameters (but not cookies or environment
** variables) as hidden values of a form.
*/
void cgi_query_parameters_to_hidden(void){
int i;
const char *zN, *zV;
for(i=0; i<nUsedQP; i++){
if( aParamQP[i].isQP==0 || aParamQP[i].cTag ) continue;
zN = aParamQP[i].zName;
zV = aParamQP[i].zValue;
@ <input type="hidden" name="%h(zN)" value="%h(zV)">
}
}
/*
** Export all untagged query parameters (but not cookies or environment
** variables) to the HQuery object.
*/
void cgi_query_parameters_to_url(HQuery *p){
int i;
for(i=0; i<nUsedQP; i++){
if( aParamQP[i].isQP==0 || aParamQP[i].cTag ) continue;
url_add_parameter(p, aParamQP[i].zName, aParamQP[i].zValue);
}
}
/*
** Tag query parameter zName so that it is not exported by
** cgi_query_parameters_to_hidden(). Or if zName==0, then
** untag all query parameters.
*/
void cgi_tag_query_parameter(const char *zName){
int i;
if( zName==0 ){
for(i=0; i<nUsedQP; i++) aParamQP[i].cTag = 0;
}else{
for(i=0; i<nUsedQP; i++){
if( strcmp(zName,aParamQP[i].zName)==0 ) aParamQP[i].cTag = 1;
}
}
}
/*
** This routine works like "printf" except that it has the
** extra formatting capabilities such as %h and %t.
*/
void cgi_printf(const char *zFormat, ...){
va_list ap;
|
| ︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 | /* ** Bitmap values for the flags parameter to cgi_http_server(). */ #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ #define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ #define HTTP_SERVER_HAD_REPOSITORY 0x0004 /* Was the repository open? */ #define HTTP_SERVER_HAD_CHECKOUT 0x0008 /* Was a checkout open? */ #endif /* INTERFACE */ /* ** Maximum number of child processes that we can have running ** at one time before we start slowing things down. */ | > | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | /* ** Bitmap values for the flags parameter to cgi_http_server(). */ #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ #define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ #define HTTP_SERVER_HAD_REPOSITORY 0x0004 /* Was the repository open? */ #define HTTP_SERVER_HAD_CHECKOUT 0x0008 /* Was a checkout open? */ #define HTTP_SERVER_REPOLIST 0x0010 /* Allow repo listing */ #endif /* INTERFACE */ /* ** Maximum number of child processes that we can have running ** at one time before we start slowing things down. */ |
| ︙ | ︙ | |||
1751 1752 1753 1754 1755 1756 1757 |
int nErr = 0, fd;
close(0);
fd = dup(connection);
if( fd!=0 ) nErr++;
close(1);
fd = dup(connection);
if( fd!=1 ) nErr++;
| | | 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 |
int nErr = 0, fd;
close(0);
fd = dup(connection);
if( fd!=0 ) nErr++;
close(1);
fd = dup(connection);
if( fd!=1 ) nErr++;
if( !g.fAnyTrace ){
close(2);
fd = dup(connection);
if( fd!=2 ) nErr++;
}
close(connection);
return nErr;
}
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 |
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid"
" WHERE id=-4");
while( db_step(&q)==SQLITE_ROW ){
const char *zIntegrateUuid = db_column_text(&q, 0);
if( is_a_leaf(db_column_int(&q, 1)) ){
| | | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 |
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid"
" WHERE id=-4");
while( db_step(&q)==SQLITE_ROW ){
const char *zIntegrateUuid = db_column_text(&q, 0);
if( is_a_leaf(db_column_int(&q, 1)) ){
fossil_print("Closed: %S\n", zIntegrateUuid);
}else{
fossil_print("Not_Closed: %S (not a leaf any more)\n", zIntegrateUuid);
}
}
db_finalize(&q);
fossil_print("New_Version: %S\n", zUuid);
if( outputManifest ){
zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
blob_zero(&muuid);
blob_appendf(&muuid, "%s\n", zUuid);
blob_write_to_file(&muuid, zManifestFile);
free(zManifestFile);
blob_reset(&muuid);
|
| ︙ | ︙ |
Changes to src/clone.c.
| ︙ | ︙ | |||
136 137 138 139 140 141 142 |
/* We should be done with options.. */
verify_all_options();
if( g.argc < 4 ){
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
}
db_open_config(0);
| | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
/* We should be done with options.. */
verify_all_options();
if( g.argc < 4 ){
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
}
db_open_config(0);
if( -1 != file_size(g.argv[3]) ){
fossil_fatal("file already exists: %s", g.argv[3]);
}
url_parse(g.argv[2], urlFlags);
if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
if( g.url.isFile ){
file_copy(g.url.name, g.argv[3]);
|
| ︙ | ︙ |
Changes to src/codecheck1.c.
| ︙ | ︙ | |||
274 275 276 277 278 279 280 |
/* A string literal is safe for use with %s */
if( is_string_lit(z) ) return 1;
/* Certain functions are guaranteed to return a string that is safe
** for use with %s */
z = next_non_whitespace(z, &len, &eType);
for(i=0; i<sizeof(azSafeFunc)/sizeof(azSafeFunc[0]); i++){
| | | | 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 |
/* A string literal is safe for use with %s */
if( is_string_lit(z) ) return 1;
/* Certain functions are guaranteed to return a string that is safe
** for use with %s */
z = next_non_whitespace(z, &len, &eType);
for(i=0; i<sizeof(azSafeFunc)/sizeof(azSafeFunc[0]); i++){
if( eType==TK_ID
&& strncmp(z, azSafeFunc[i], len)==0
&& strlen(azSafeFunc[i])==len
){
return 1;
}
}
/* Expressions of the form: EXPR ? "..." : "...." can count as
** a string literal. */
if( is_string_expr(z) ) return 1;
/* If the "safe-for-%s" comment appears in the argument, then
** let it through */
if( strstr(z, "/*safe-for-%s*/")!=0 ) return 1;
return 0;
}
/*
** Processing flags
*/
#define FMT_NO_S 0x00001 /* Do not allow %s substitutions */
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
if( z[len]==0 ) break;
z[len] = 0;
for(i=len-1; i>0 && isspace(z[i]); i--){ z[i] = 0; }
z += len + 1;
}
acType = (char*)&azArg[nArg];
if( fmtArg>nArg ){
| | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
if( z[len]==0 ) break;
z[len] = 0;
for(i=len-1; i>0 && isspace(z[i]); i--){ z[i] = 0; }
z += len + 1;
}
acType = (char*)&azArg[nArg];
if( fmtArg>nArg ){
printf("%s:%d: too few arguments to %.*s()\n",
zFilename, lnFCall, szFName, zFCall);
nErr++;
}else{
const char *zFmt = azArg[fmtArg-1];
const char *zOverride = strstr(zFmt, "/*works-like:");
if( zOverride ) zFmt = zOverride + sizeof("/*works-like:")-1;
if( !is_string_lit(zFmt) ){
|
| ︙ | ︙ | |||
535 536 537 538 539 540 541 |
nCurly++;
}else if( z[0]=='}' ){
nCurly--;
}else if( nCurly>0 && z[0]=='(' && ePrev==TK_ID
&& (x = isFormatFunc(zPrev,szPrev,&fmtFlags))>0 ){
nErr += checkFormatFunc(zName, zPrev, lnPrev, x, fmtFlags);
}
| | | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 |
nCurly++;
}else if( z[0]=='}' ){
nCurly--;
}else if( nCurly>0 && z[0]=='(' && ePrev==TK_ID
&& (x = isFormatFunc(zPrev,szPrev,&fmtFlags))>0 ){
nErr += checkFormatFunc(zName, zPrev, lnPrev, x, fmtFlags);
}
}
zPrev = z;
ePrev = eToken;
szPrev = szToken;
lnPrev = ln;
}
return nErr;
}
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
88 89 90 91 92 93 94 |
{ "css", CONFIGSET_CSS },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
| < > > | 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 |
{ "css", CONFIGSET_CSS },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
{ "adunit", CONFIGSET_SKIN },
{ "adunit-omit-if-admin", CONFIGSET_SKIN },
{ "adunit-omit-if-user", CONFIGSET_SKIN },
{ "white-foreground", CONFIGSET_SKIN },
#ifdef FOSSIL_ENABLE_TH1_DOCS
{ "th1-docs", CONFIGSET_TH1 },
#endif
#ifdef FOSSIL_ENABLE_TH1_HOOKS
{ "th1-hooks", CONFIGSET_TH1 },
#endif
{ "th1-setup", CONFIGSET_TH1 },
{ "th1-uri-regexp", CONFIGSET_TH1 },
#ifdef FOSSIL_ENABLE_TCL
{ "tcl", CONFIGSET_TH1 },
{ "tcl-setup", CONFIGSET_TH1 },
#endif
{ "project-name", CONFIGSET_PROJ },
{ "short-project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_PROJ },
{ "manifest", CONFIGSET_PROJ },
{ "binary-glob", CONFIGSET_PROJ },
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
|
| ︙ | ︙ | |||
988 989 990 991 992 993 994 |
}else
{
fossil_fatal("METHOD should be one of:"
" export import merge pull push reset");
}
configure_rebuild();
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 |
}else
{
fossil_fatal("METHOD should be one of:"
" export import merge pull push reset");
}
configure_rebuild();
}
/*
** COMMAND: test-var-list
**
** Usage: %fossil test-var-list ?PATTERN? ?--unset? ?--mtime?
**
** Show the content of the CONFIG table in a repository. If PATTERN is
** specified, then only show the entries that match that glob pattern.
** Last modification time is shown if the --mtime option is present.
**
** If the --unset option is included, then entries are deleted rather than
** being displayed. WARNING! This cannot be undone. Be sure you know what
** you are doing! The --unset option only works if there is a PATTERN.
** Probably you should run the command once without --unset to make sure
** you know exactly what is being deleted.
**
** If not in an open check-out, use the -R REPO option to specify a
** a repository.
*/
void test_var_list_cmd(void){
Stmt q;
int i, j;
const char *zPattern = 0;
int doUnset;
int showMtime;
Blob sql;
Blob ans;
unsigned char zTrans[1000];
doUnset = find_option("unset",0,0)!=0;
showMtime = find_option("mtime",0,0)!=0;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
verify_all_options();
if( g.argc>=3 ){
zPattern = g.argv[2];
}
blob_init(&sql,0,0);
blob_appendf(&sql, "SELECT name, value, datetime(mtime,'unixepoch')"
" FROM config");
if( zPattern ){
blob_appendf(&sql, " WHERE name GLOB %Q", zPattern);
}
if( showMtime ){
blob_appendf(&sql, " ORDER BY mtime, name");
}else{
blob_appendf(&sql, " ORDER BY name");
}
db_prepare(&q, "%s", blob_str(&sql)/*safe-for-%s*/);
blob_reset(&sql);
#define MX_VAL 40
#define MX_NM 28
#define MX_LONGNM 60
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q,0);
int nName = db_column_bytes(&q,0);
const char *zValue = db_column_text(&q,1);
int szValue = db_column_bytes(&q,1);
const char *zMTime = db_column_text(&q,2);
for(i=j=0; j<MX_VAL && zValue[i]; i++){
unsigned char c = (unsigned char)zValue[i];
if( c>=' ' && c<='~' ){
zTrans[j++] = c;
}else{
zTrans[j++] = '\\';
if( c=='\n' ){
zTrans[j++] = 'n';
}else if( c=='\r' ){
zTrans[j++] = 'r';
}else if( c=='\t' ){
zTrans[j++] = 't';
}else{
zTrans[j++] = '0' + ((c>>6)&7);
zTrans[j++] = '0' + ((c>>3)&7);
zTrans[j++] = '0' + (c&7);
}
}
}
zTrans[j] = 0;
if( i<szValue ){
sqlite3_snprintf(sizeof(zTrans)-j, (char*)zTrans+j, "...+%d", szValue-i);
j += (int)strlen((char*)zTrans+j);
}
if( showMtime ){
fossil_print("%s:%*s%s\n", zName, 58-nName, "", zMTime);
}else if( nName<MX_NM-2 ){
fossil_print("%s:%*s%s\n", zName, MX_NM-1-nName, "", zTrans);
}else if( nName<MX_LONGNM-2 && j<10 ){
fossil_print("%s:%*s%s\n", zName, MX_LONGNM-1-nName, "", zTrans);
}else{
fossil_print("%s:\n%*s%s\n", zName, MX_NM, "", zTrans);
}
}
db_finalize(&q);
if( zPattern && doUnset ){
prompt_user("Delete all of the above? (y/N)? ", &ans);
if( blob_str(&ans)[0]=='y' || blob_str(&ans)[0]=='Y' ){
db_multi_exec("DELETE FROM config WHERE name GLOB %Q", zPattern);
}
blob_reset(&ans);
}
}
/*
** COMMAND: test-var-get
**
** Usage: %fossil test-var-get VAR ?FILE?
**
** Write the text of the VAR variable into FILE. If FILE is "-"
** or is omitted then output goes to standard output. VAR can be a
** GLOB pattern.
**
** If not in an open check-out, use the -R REPO option to specify a
** a repository.
*/
void test_var_get_cmd(void){
const char *zVar;
const char *zFile;
int n;
Blob x;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
verify_all_options();
if( g.argc<3 ){
usage("VAR ?FILE?");
}
zVar = g.argv[2];
zFile = g.argc>=4 ? g.argv[3] : "-";
n = db_int(0, "SELECT count(*) FROM config WHERE name GLOB %Q", zVar);
if( n==0 ){
fossil_fatal("no match for %Q", zVar);
}
if( n>1 ){
fossil_fatal("multiple matches: %s",
db_text(0, "SELECT group_concat(quote(name),', ') FROM ("
" SELECT name FROM config WHERE name GLOB %Q ORDER BY 1)",
zVar));
}
blob_init(&x,0,0);
db_blob(&x, "SELECT value FROM config WHERE name GLOB %Q", zVar);
blob_write_to_file(&x, zFile);
}
/*
** COMMAND: test-var-set
**
** Usage: %fossil test-var-set VAR ?VALUE? ?--file FILE?
**
** Store VALUE or the content of FILE (exactly one of which must be
** supplied) into variable VAR. Use a FILE of "-" to read from
** standard input.
**
** WARNING: changing the value of a variable can interfere with the
** operation of Fossil. Be sure you know what you are doing.
**
** Use "--blob FILE" instead of "--file FILE" to load a binary blob
** such as a GIF.
*/
void test_var_set_cmd(void){
const char *zVar;
const char *zFile;
const char *zBlob;
Blob x;
Stmt ins;
zFile = find_option("file",0,1);
zBlob = find_option("blob",0,1);
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
verify_all_options();
if( g.argc<3 || (zFile==0 && zBlob==0 && g.argc<4) ){
usage("VAR ?VALUE? ?--file FILE?");
}
zVar = g.argv[2];
if( zFile ){
if( zBlob ) fossil_fatal("cannot do both --file or --blob");
blob_read_from_file(&x, zFile);
}else if( zBlob ){
blob_read_from_file(&x, zBlob);
}else{
blob_init(&x,g.argv[3],-1);
}
db_prepare(&ins,
"REPLACE INTO config(name,value,mtime)"
"VALUES(%Q,:val,now())", zVar);
if( zBlob ){
db_bind_blob(&ins, ":val", &x);
}else{
db_bind_text(&ins, ":val", blob_str(&x));
}
db_step(&ins);
db_finalize(&ins);
blob_reset(&x);
}
|
Changes to src/db.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 |
/*
** Call this routine when a database error occurs.
*/
static void db_err(const char *zFormat, ...){
va_list ap;
char *z;
int rc = 1;
| < < < < | < | | 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 |
/*
** Call this routine when a database error occurs.
*/
static void db_err(const char *zFormat, ...){
va_list ap;
char *z;
int rc = 1;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
#ifdef FOSSIL_ENABLE_JSON
if( g.json.isJsonMode ){
json_err( 0, z, 1 );
if( g.isHTTP ){
rc = 0 /* avoid HTTP 500 */;
}
}
else
#endif /* FOSSIL_ENABLE_JSON */
if( g.xferPanic ){
cgi_reset_content();
@ error Database\serror:\s%F(z)
cgi_reply();
}
else if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<h1>Database Error</h1>\n<p>%h</p>\n", z);
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", g.argv[0], z);
}
free(z);
db_force_rollback();
fossil_exit(rc);
}
/*
|
| ︙ | ︙ | |||
162 163 164 165 166 167 168 169 170 |
if( g.db==0 ) return;
if( db.nBegin<=0 ) return;
if( rollbackFlag ) db.doRollback = 1;
db.nBegin--;
if( db.nBegin==0 ){
int i;
if( db.doRollback==0 && db.nPriorChanges<sqlite3_total_changes(g.db) ){
while( db.nBeforeCommit ){
db.nBeforeCommit--;
| > | | > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
if( g.db==0 ) return;
if( db.nBegin<=0 ) return;
if( rollbackFlag ) db.doRollback = 1;
db.nBegin--;
if( db.nBegin==0 ){
int i;
if( db.doRollback==0 && db.nPriorChanges<sqlite3_total_changes(g.db) ){
i = 0;
while( db.nBeforeCommit ){
db.nBeforeCommit--;
sqlite3_exec(g.db, db.azBeforeCommit[i], 0, 0, 0);
sqlite3_free(db.azBeforeCommit[i]);
i++;
}
leaf_do_pending_checks();
}
for(i=0; db.doRollback==0 && i<db.nCommitHook; i++){
db.doRollback |= db.aHook[i].xHook();
}
while( db.pAllStmt ){
|
| ︙ | ︙ | |||
545 546 547 548 549 550 551 |
va_start(ap, zSql);
blob_vappendf(&sql, zSql, ap);
va_end(ap);
z = blob_str(&sql);
while( rc==SQLITE_OK && z[0] ){
pStmt = 0;
rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
| | > | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
va_start(ap, zSql);
blob_vappendf(&sql, zSql, ap);
va_end(ap);
z = blob_str(&sql);
while( rc==SQLITE_OK && z[0] ){
pStmt = 0;
rc = sqlite3_prepare_v2(g.db, z, -1, &pStmt, &zEnd);
if( rc ){
db_err("%s: {%s}", sqlite3_errmsg(g.db), z);
}else if( pStmt ){
db.nPrepare++;
while( sqlite3_step(pStmt)==SQLITE_ROW ){}
rc = sqlite3_finalize(pStmt);
if( rc ) db_err("%s: {%.*s}", sqlite3_errmsg(g.db), (int)(zEnd-z), z);
}
z = zEnd;
}
|
| ︙ | ︙ | |||
768 769 770 771 772 773 774 |
**
*/
void db_sym2rid_function(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
| | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 |
**
*/
void db_sym2rid_function(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *arg;
const char *type;
if(1 != argc && 2 != argc){
sqlite3_result_error(context, "Expecting one or two arguments", -1);
return;
}
arg = (const char*)sqlite3_value_text(argv[0]);
if(!arg){
sqlite3_result_error(context, "Expecting a STRING argument", -1);
|
| ︙ | ︙ | |||
793 794 795 796 797 798 799 |
}else{
sqlite3_result_int64(context, rid);
}
}
}
/*
| | > > | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
}else{
sqlite3_result_int64(context, rid);
}
}
}
/*
** Register the SQL functions that are useful both to the internal
** representation and to the "fossil sql" command.
*/
void db_add_aux_functions(sqlite3 *db){
sqlite3_create_function(db, "checkin_mtime", 2, SQLITE_UTF8, 0,
db_checkin_mtime_function, 0, 0);
sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
db_sym2rid_function, 0, 0);
sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
db_sym2rid_function, 0, 0);
sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
db_now_function, 0, 0);
}
/*
** Open a database file. Return a pointer to the new database
** connection. An error results in process abort.
*/
|
| ︙ | ︙ | |||
825 826 827 828 829 830 831 |
g.zVfsName
);
if( rc!=SQLITE_OK ){
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
}
sqlite3_busy_timeout(db, 5000);
sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
| < < | | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
g.zVfsName
);
if( rc!=SQLITE_OK ){
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
}
sqlite3_busy_timeout(db, 5000);
sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
sqlite3_create_function(
db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
);
sqlite3_create_function(
db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
);
if( g.fSqlTrace ) sqlite3_trace(db, db_sql_trace, 0);
db_add_aux_functions(db);
re_add_sql_func(db); /* The REGEXP operator */
foci_register(db); /* The "files_of_checkin" virtual table */
sqlite3_exec(db, "PRAGMA foreign_keys=OFF;", 0, 0, 0);
return db;
}
|
| ︙ | ︙ | |||
925 926 927 928 929 930 931 932 |
void db_open_config(int useAttach){
char *zDbName;
char *zHome;
if( g.zConfigDbName ){
if( useAttach==g.useAttach ) return;
db_close_config();
}
#if defined(_WIN32) || defined(__CYGWIN__)
| > > | | | | | | | | | > | | | > | > | | | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 |
void db_open_config(int useAttach){
char *zDbName;
char *zHome;
if( g.zConfigDbName ){
if( useAttach==g.useAttach ) return;
db_close_config();
}
zHome = fossil_getenv("FOSSIL_HOME");
#if defined(_WIN32) || defined(__CYGWIN__)
if( zHome==0 ){
zHome = fossil_getenv("LOCALAPPDATA");
if( zHome==0 ){
zHome = fossil_getenv("APPDATA");
if( zHome==0 ){
char *zDrive = fossil_getenv("HOMEDRIVE");
char *zPath = fossil_getenv("HOMEPATH");
if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath);
}
}
}
if( zHome==0 ){
fossil_fatal("cannot locate home directory - please set the "
"FOSSIL_HOME, LOCALAPPDATA, APPDATA, or HOMEPATH "
"environment variables");
}
#else
if( zHome==0 ){
zHome = fossil_getenv("HOME");
}
if( zHome==0 ){
fossil_fatal("cannot locate home directory - please set the "
"FOSSIL_HOME or HOME environment variables");
}
#endif
if( file_isdir(zHome)!=1 ){
fossil_fatal("invalid home directory: %s", zHome);
}
#if defined(_WIN32) || defined(__CYGWIN__)
/* . filenames give some window systems problems and many apps problems */
|
| ︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 |
}
}
g.zRepositoryName = mprintf("%s", zDbName);
db_open_or_attach(g.zRepositoryName, "repository", 0);
g.repositoryOpen = 1;
/* Cache "allow-symlinks" option, because we'll need it on every stat call */
g.allowSymlinks = db_get_boolean("allow-symlinks", 0);
}
/*
** Flags for the db_find_and_open_repository() function.
*/
#if INTERFACE
#define OPEN_OK_NOT_FOUND 0x001 /* Do not error out if not found */
| > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 |
}
}
g.zRepositoryName = mprintf("%s", zDbName);
db_open_or_attach(g.zRepositoryName, "repository", 0);
g.repositoryOpen = 1;
/* Cache "allow-symlinks" option, because we'll need it on every stat call */
g.allowSymlinks = db_get_boolean("allow-symlinks", 0);
g.zAuxSchema = db_get("aux-schema","");
/* Verify that the PLINK table has a new column added by the
** 2014-11-28 schema change. Create it if necessary. This code
** can be removed in the future, once all users have upgraded to the
** 2014-11-28 or later schema.
*/
if( !db_table_has_column("repository","plink","baseid") ){
db_multi_exec(
"ALTER TABLE %s.plink ADD COLUMN baseid;", db_name("repository")
);
}
/* Verify that the MLINK table has the newer columns added by the
** 2015-01-24 schema change. Create them if necessary. This code
** can be removed in the future, once all users have upgraded to the
** 2015-01-24 or later schema.
*/
if( !db_table_has_column("repository","mlink","isaux") ){
db_begin_transaction();
db_multi_exec(
"ALTER TABLE %s.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
"ALTER TABLE %s.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;",
db_name("repository"), db_name("repository")
);
db_end_transaction(0);
}
}
/*
** Flags for the db_find_and_open_repository() function.
*/
#if INTERFACE
#define OPEN_OK_NOT_FOUND 0x001 /* Do not error out if not found */
|
| ︙ | ︙ | |||
1235 1236 1237 1238 1239 1240 1241 |
return zDb;
}
/*
** Return TRUE if the schema is out-of-date
*/
int db_schema_is_outofdate(void){
| < | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 |
return zDb;
}
/*
** Return TRUE if the schema is out-of-date
*/
int db_schema_is_outofdate(void){
return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
|| strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
}
/*
** Return true if the database is writeable
*/
|
| ︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 |
fprintf(stderr, "-- prepared statements %10d\n", db.nPrepare);
}
while( db.pAllStmt ){
db_finalize(db.pAllStmt);
}
db_end_transaction(1);
pStmt = 0;
| | | | > > > > > > > | > | > > > > > | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 |
fprintf(stderr, "-- prepared statements %10d\n", db.nPrepare);
}
while( db.pAllStmt ){
db_finalize(db.pAllStmt);
}
db_end_transaction(1);
pStmt = 0;
db_close_config();
/* If the localdb (the check-out database) is open and if it has
** a lot of unused free space, then VACUUM it as we shut down.
*/
if( g.localOpen && strcmp(db_name("localdb"),"main")==0 ){
int nFree = db_int(0, "PRAGMA main.freelist_count");
int nTotal = db_int(0, "PRAGMA main.page_count");
if( nFree>nTotal/4 ){
db_multi_exec("VACUUM;");
}
}
if( g.db ){
int rc;
sqlite3_wal_checkpoint(g.db, 0);
rc = sqlite3_close(g.db);
if( rc==SQLITE_BUSY && reportErrors ){
while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
}
}
g.db = 0;
g.zMainDbType = 0;
}
g.repositoryOpen = 0;
g.localOpen = 0;
assert( g.dbConfig==0 );
assert( g.useAttach==0 );
|
| ︙ | ︙ | |||
1420 1421 1422 1423 1424 1425 1426 |
db_multi_exec(
"UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))"
" WHERE login=%Q", zUser
);
if( !setupUserOnly ){
db_multi_exec(
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
| | | | 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 |
db_multi_exec(
"UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))"
" WHERE login=%Q", zUser
);
if( !setupUserOnly ){
db_multi_exec(
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');"
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('nobody','','gjorz','Nobody');"
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('developer','','dei','Dev');"
"INSERT OR IGNORE INTO user(login,pw,cap,info)"
" VALUES('reader','','kptw','Reader');"
);
}
}
|
| ︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 |
const char *db_setting_inop_rhs(){
Blob x;
int i;
const char *zSep = "";
blob_zero(&x);
blob_append_sql(&x, "(");
| | | | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 |
const char *db_setting_inop_rhs(){
Blob x;
int i;
const char *zSep = "";
blob_zero(&x);
blob_append_sql(&x, "(");
for(i=0; aSetting[i].name; i++){
blob_append_sql(&x, "%s%Q", zSep/*safe-for-%s*/, aSetting[i].name);
zSep = ",";
}
blob_append_sql(&x, ")");
return blob_sql_text(&x);
}
/*
|
| ︙ | ︙ | |||
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 |
find_option("empty", 0, 0); /* deprecated */
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ){
usage("REPOSITORY-NAME");
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_transaction();
db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes);
db_end_transaction(0);
| > > > > > | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 |
find_option("empty", 0, 0); /* deprecated */
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ){
usage("REPOSITORY-NAME");
}
if( -1 != file_size(g.argv[2]) ){
fossil_fatal("file already exists: %s", g.argv[2]);
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_transaction();
db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes);
db_end_transaction(0);
|
| ︙ | ︙ | |||
1868 1869 1870 1871 1872 1873 1874 |
g.zMainDbType = g.zConfigDbType;
g.dbConfig = dbTemp;
g.zConfigDbType = zTempDbType;
}
}
/*
| < | > > > > > | | > | | 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 |
g.zMainDbType = g.zConfigDbType;
g.dbConfig = dbTemp;
g.zConfigDbType = zTempDbType;
}
}
/*
** Try to read a versioned setting string from .fossil-settings/<name>.
**
** Return the text of the string if it is found. Return NULL if not
** found.
**
** If the zNonVersionedSetting parameter is not NULL then it holds the
** non-versioned value for this setting. If both a versioned and ad
** non-versioned value exist and are not equal, then a warning message
** might be generated.
*/
char *db_get_versioned(const char *zName, char *zNonVersionedSetting){
char *zVersionedSetting = 0;
int noWarn = 0;
struct _cacheEntry {
struct _cacheEntry *next;
const char *zName, *zValue;
} *cacheEntry = 0;
static struct _cacheEntry *cache = 0;
|
| ︙ | ︙ | |||
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 |
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
** repository and local databases.
*/
char *db_get(const char *zName, char *zDefault){
char *z = 0;
| > > > > > < < < < < | < < < | | > > > | > | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 |
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
** repository and local databases.
**
** If no such variable exists, return zDefault. Or, if zName is the name
** of a setting, then the zDefault is ignored and the default value of the
** setting is returned instead. If zName is a versioned setting, then
** versioned value takes priority.
*/
char *db_get(const char *zName, char *zDefault){
char *z = 0;
const Setting *pSetting = db_find_setting(zName, 0);
if( g.repositoryOpen ){
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
}
if( z==0 && g.zConfigDbName ){
db_swap_connections();
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
db_swap_connections();
}
if( pSetting!=0 && pSetting->versionable ){
/* This is a versionable setting, try and get the info from a
** checked out file */
z = db_get_versioned(zName, z);
}
if( z==0 ){
if( zDefault==0 && pSetting && pSetting->def[0] ){
z = fossil_strdup(pSetting->def);
}else{
z = zDefault;
}
}
return z;
}
char *db_get_mtime(const char *zName, char *zFormat, char *zDefault){
char *z = 0;
if( g.repositoryOpen ){
z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName);
|
| ︙ | ︙ | |||
2240 2241 2242 2243 2244 2245 2246 |
checkout_cmd();
}
g.argc = 2;
info_cmd();
}
/*
| | > | < < < | | | | | | | > | > > | > > < | | > < > > | 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 |
checkout_cmd();
}
g.argc = 2;
info_cmd();
}
/*
** Print the current value of a setting identified by the pSetting
** pointer.
*/
static void print_setting(const Setting *pSetting){
Stmt q;
if( g.repositoryOpen ){
db_prepare(&q,
"SELECT '(local)', value FROM config WHERE name=%Q"
" UNION ALL "
"SELECT '(global)', value FROM global_config WHERE name=%Q",
pSetting->name, pSetting->name
);
}else{
db_prepare(&q,
"SELECT '(global)', value FROM global_config WHERE name=%Q",
pSetting->name
);
}
if( db_step(&q)==SQLITE_ROW ){
fossil_print("%-20s %-8s %s\n", pSetting->name, db_column_text(&q, 0),
db_column_text(&q, 1));
}else{
fossil_print("%-20s\n", pSetting->name);
}
if( pSetting->versionable && g.localOpen ){
/* Check to see if this is overridden by a versionable settings file */
Blob versionedPathname;
blob_zero(&versionedPathname);
blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
g.zLocalRoot, pSetting->name);
if( file_size(blob_str(&versionedPathname))>=0 ){
fossil_print(" (overridden by contents of file .fossil-settings/%s)\n",
pSetting->name);
}
}
db_finalize(&q);
}
#if INTERFACE
/*
** Define all settings, which can be controlled via the set/unset
** command.
**
** var is the name of the internal configuration name for db_(un)set.
** If var is 0, the settings name is used.
**
** width is the length for the edit field on the behavior page, 0
** is used for on/off checkboxes.
**
** The behaviour page doesn't use a special layout. It lists all
** set-commands and displays the 'set'-help as info.
*/
struct Setting {
const char *name; /* Name of the setting */
const char *var; /* Internal variable name used by db_set() */
int width; /* Width of display. 0 for boolean values. */
int versionable; /* Is this setting versionable? */
int forceTextArea; /* Force using a text area for display? */
const char *def; /* Default value */
};
#endif /* INTERFACE */
const Setting aSetting[] = {
{ "access-log", 0, 0, 0, 0, "off" },
{ "admin-log", 0, 0, 0, 0, "off" },
{ "allow-clean-x", 0, 0, 0, 0, "off" },
{ "allow-symlinks", 0, 0, 1, 0, "off" },
{ "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
{ "auto-hyperlink", 0, 0, 0, 0, "on", },
{ "auto-shun", 0, 0, 0, 0, "on" },
{ "autosync", 0, 0, 0, 0, "on" },
{ "autosync-tries", 0, 16, 0, 0, "1" },
{ "binary-glob", 0, 40, 1, 0, "" },
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
defined(__APPLE__)
{ "case-sensitive", 0, 0, 0, 0, "off" },
#else
{ "case-sensitive", 0, 0, 0, 0, "on" },
#endif
{ "clean-glob", 0, 40, 1, 0, "" },
{ "clearsign", 0, 0, 0, 0, "off" },
{ "crnl-glob", 0, 40, 1, 0, "" },
{ "default-perms", 0, 16, 0, 0, "u" },
{ "diff-binary", 0, 0, 0, 0, "on" },
{ "diff-command", 0, 40, 0, 0, "" },
{ "dont-push", 0, 0, 0, 0, "off" },
{ "editor", 0, 32, 0, 0, "" },
{ "empty-dirs", 0, 40, 1, 0, "" },
{ "encoding-glob", 0, 40, 1, 0, "" },
{ "gdiff-command", 0, 40, 0, 0, "gdiff" },
{ "gmerge-command", 0, 40, 0, 0, "" },
{ "hash-digits", 0, 5, 0, 0, "10" },
{ "http-port", 0, 16, 0, 0, "8080" },
{ "https-login", 0, 0, 0, 0, "off" },
{ "ignore-glob", 0, 40, 1, 0, "" },
{ "keep-glob", 0, 40, 1, 0, "" },
{ "localauth", 0, 0, 0, 0, "off" },
{ "main-branch", 0, 40, 0, 0, "trunk" },
{ "manifest", 0, 0, 1, 0, "off" },
|
| ︙ | ︙ | |||
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 |
#endif
{ "th1-setup", 0, 40, 1, 1, "" },
{ "th1-uri-regexp", 0, 40, 1, 0, "" },
{ "web-browser", 0, 32, 0, 0, "" },
{ "white-foreground", 0, 0, 0, 0, "off" },
{ 0,0,0,0,0,0 }
};
/*
** COMMAND: settings
** COMMAND: unset*
**
** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
** %fossil unset PROPERTY ?OPTIONS?
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 |
#endif
{ "th1-setup", 0, 40, 1, 1, "" },
{ "th1-uri-regexp", 0, 40, 1, 0, "" },
{ "web-browser", 0, 32, 0, 0, "" },
{ "white-foreground", 0, 0, 0, 0, "off" },
{ 0,0,0,0,0,0 }
};
/*
** Look up a control setting by its name. Return a pointer to the Setting
** object, or NULL if there is no such setting.
**
** If allowPrefix is true, then the Setting returned is the first one for
** which zName is a prefix of the Setting name.
*/
const Setting *db_find_setting(const char *zName, int allowPrefix){
int lwr, mid, upr, c;
int n = (int)strlen(zName) + !allowPrefix;
lwr = 0;
upr = ArraySize(aSetting)-2;
while( upr>=lwr ){
mid = (upr+lwr)/2;
c = fossil_strncmp(zName, aSetting[mid].name, n);
if( c<0 ){
upr = mid - 1;
}else if( c>0 ){
lwr = mid + 1;
}else{
if( allowPrefix ){
while( mid>lwr && fossil_strncmp(zName, aSetting[mid-1].name, n)==0 ){
mid--;
}
}
return &aSetting[mid];
}
}
return 0;
}
/*
** COMMAND: settings
** COMMAND: unset*
**
** %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
** %fossil unset PROPERTY ?OPTIONS?
|
| ︙ | ︙ | |||
2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 | ** diff. If undefined, text diff will be used. ** ** gmerge-command A graphical merge conflict resolver command operating ** on four files. ** Ex: kdiff3 "%baseline" "%original" "%merge" -o "%output" ** Ex: xxdiff "%original" "%baseline" "%merge" -M "%output" ** Ex: meld "%baseline" "%original" "%merge" "%output" ** ** http-port The TCP/IP port number to use by the "server" ** and "ui" commands. Default: 8080 ** ** https-login Send login credentials using HTTPS instead of HTTP ** even if the login page request came via HTTP. ** | > > > | 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 | ** diff. If undefined, text diff will be used. ** ** gmerge-command A graphical merge conflict resolver command operating ** on four files. ** Ex: kdiff3 "%baseline" "%original" "%merge" -o "%output" ** Ex: xxdiff "%original" "%baseline" "%merge" -M "%output" ** Ex: meld "%baseline" "%original" "%merge" "%output" ** ** hash-digits The number of hexadecimal digits of the SHA1 hash to ** display. (Default: 10; Minimum: 6) ** ** http-port The TCP/IP port number to use by the "server" ** and "ui" commands. Default: 8080 ** ** https-login Send login credentials using HTTPS instead of HTTP ** even if the login page request came via HTTP. ** |
| ︙ | ︙ | |||
2618 2619 2620 2621 2622 2623 2624 2625 |
}
if( !g.repositoryOpen ){
globalFlag = 1;
}
if( unsetFlag && g.argc!=3 ){
usage("PROPERTY ?-global?");
}
if( g.argc==2 ){
| > > > > > > > > > > > > < | | < | | < < | | < > | | > | < < | | | < | < | > > | > > | | | | | > > < | < < | | < < < | 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 |
}
if( !g.repositoryOpen ){
globalFlag = 1;
}
if( unsetFlag && g.argc!=3 ){
usage("PROPERTY ?-global?");
}
/* Verify that the aSetting[] entries are in sorted order. This is
** necessary for the binary search in db_find_setting() to work correctly.
*/
for(i=1; aSetting[i].name; i++){
if( fossil_strcmp(aSetting[i-1].name, aSetting[i].name)>=0 ){
fossil_panic("Internal Error: aSetting[] entries for \"%s\""
" and \"%s\" are out of order.",
aSetting[i-1].name, aSetting[i].name);
}
}
if( g.argc==2 ){
for(i=0; aSetting[i].name; i++){
print_setting(&aSetting[i]);
}
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int n = (int)strlen(zName);
const Setting *pSetting = db_find_setting(zName, 1);
if( pSetting==0 ){
fossil_fatal("no such setting: %s", zName);
}
if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
fossil_fatal("cannot set 'manifest' globally");
}
if( unsetFlag || g.argc==4 ){
int isManifest = fossil_strcmp(pSetting->name, "manifest")==0;
if( n!=strlen(pSetting[0].name) && pSetting[1].name &&
fossil_strncmp(pSetting[1].name, zName, n)==0 ){
Blob x;
int i;
blob_init(&x,0,0);
for(i=0; pSetting[i].name; i++){
if( fossil_strncmp(pSetting[i].name,zName,n)!=0 ) break;
blob_appendf(&x, " %s", pSetting[i].name);
}
fossil_fatal("ambiguous setting \"%s\" - might be:%s",
zName, blob_str(&x));
}
if( globalFlag && isManifest ){
fossil_fatal("cannot set 'manifest' globally");
}
if( unsetFlag ){
db_unset(pSetting->name, globalFlag);
}else{
db_set(pSetting->name, g.argv[3], globalFlag);
}
if( isManifest && g.localOpen ){
manifest_to_disk(db_lget_int("checkout", 0));
}
}else{
while( pSetting->name && fossil_strncmp(pSetting->name,zName,n)==0 ){
print_setting(pSetting);
pSetting++;
}
}
}else{
usage("?PROPERTY? ?VALUE? ?-global?");
}
}
/*
|
| ︙ | ︙ |
Changes to src/descendants.c.
| ︙ | ︙ | |||
437 438 439 440 441 442 443 |
void leaves_page(void){
Blob sql;
Stmt q;
int showAll = P("all")!=0;
int showClosed = P("closed")!=0;
login_check_credentials();
| | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
void leaves_page(void){
Blob sql;
Stmt q;
int showAll = P("all")!=0;
int showClosed = P("closed")!=0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( !showAll ){
style_submenu_element("All", "All", "leaves?all");
}
if( !showClosed ){
style_submenu_element("Closed", "Closed", "leaves?closed");
}
|
| ︙ | ︙ | |||
480 481 482 483 484 485 486 |
if( showClosed ){
blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid"));
}else if( !showAll ){
blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
}
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
blob_reset(&sql);
| | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
if( showClosed ){
blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid"));
}else if( !showAll ){
blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
}
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
blob_reset(&sql);
www_print_timeline(&q, TIMELINE_LEAFONLY, 0, 0, 0, 0);
db_finalize(&q);
@ <br />
style_footer();
}
#if INTERFACE
/* Flag parameters to compute_uses_file() */
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
2232 2233 2234 2235 2236 2237 2238 |
struct AnnVers *p;
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
showLog = atoi(PD("log","1"));
login_check_credentials();
| | | 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 |
struct AnnVers *p;
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
showLog = atoi(PD("log","1"));
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( exclude_spiders("annotate") ) return;
load_control();
mid = name_to_typed_rid(PD("checkin","0"),"ci");
zFilename = P("filename");
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
iLimit = atoi(PD("limit","20"));
|
| ︙ | ︙ | |||
2292 2293 2294 2295 2296 2297 2298 |
z2 = sqlite3_mprintf("%d", iLimit+20);
style_submenu_element(z1, z1, "%s", url_render(&url, "limit", z2, 0, 0));
}
if( iLimit>20 ){
style_submenu_element("20 Ancestors", "20 Ancestors",
"%s", url_render(&url, "limit", "20", 0, 0));
}
| | | | | | 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 |
z2 = sqlite3_mprintf("%d", iLimit+20);
style_submenu_element(z1, z1, "%s", url_render(&url, "limit", z2, 0, 0));
}
if( iLimit>20 ){
style_submenu_element("20 Ancestors", "20 Ancestors",
"%s", url_render(&url, "limit", "20", 0, 0));
}
if( skin_white_foreground() ){
clr1 = 0xa04040;
clr2 = 0x4059a0;
}else{
clr1 = 0xffb5b5; /* Recent changes: red (hot) */
clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
}
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
}
if( showLog ){
char *zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
@ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
@ <ol>
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
@ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
@ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
@ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
@ </span>
#if 0
if( i>0 ){
char *zLink = xhref("target='infowindow'",
"%R/fdiff?v1=%S&v2=%S&sbs=1",
p->zFUuid,ann.aVers[0].zFUuid);
@ %z(zLink)[diff-to-top]</a>
|
| ︙ | ︙ | |||
2333 2334 2335 2336 2337 2338 2339 |
#endif
}
@ </ol>
@ <hr>
}
if( !ann.bLimit ){
@ <h2>Origin for each line in
| | | | | | | | 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 |
#endif
}
@ </ol>
@ <hr>
}
if( !ann.bLimit ){
@ <h2>Origin for each line in
@ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
iLimit = ann.nVers+10;
}else{
@ <h2>Lines added by the %d(iLimit) most recent ancestors of
@ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
}
@ <pre>
for(i=0; i<ann.nOrig; i++){
int iVers = ann.aOrig[i].iVers;
char *z = (char*)ann.aOrig[i].z;
int n = ann.aOrig[i].n;
char zPrefix[300];
z[n] = 0;
if( iLimit>ann.nVers && iVers<0 ) iVers = ann.nVers-1;
if( bBlame ){
if( iVers>=0 ){
struct AnnVers *p = ann.aVers+iVers;
char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid);
sqlite3_snprintf(sizeof(zPrefix), zPrefix,
"<span style='background-color:%s'>"
"%s%.10s</a> %s</span> %13.13s:",
p->zBgColor, zLink, p->zMUuid, p->zDate, p->zUser);
fossil_free(zLink);
}else{
sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%36s", "");
}
}else{
if( iVers>=0 ){
struct AnnVers *p = ann.aVers+iVers;
char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid);
sqlite3_snprintf(sizeof(zPrefix), zPrefix,
"<span style='background-color:%s'>"
"%s%.10s</a> %s</span> %4d:",
p->zBgColor, zLink, p->zMUuid, p->zDate, i+1);
fossil_free(zLink);
}else{
sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%22s%4d:", "", i+1);
|
| ︙ | ︙ | |||
2432 2433 2434 2435 2436 2437 2438 |
annFlags = DIFF_IGNORE_EOLWS;
}
if( find_option("ignore-all-space","w",0)!=0 ){
annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
}
fileVers = find_option("filevers",0,0)!=0;
db_must_be_within_tree();
| | | 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 |
annFlags = DIFF_IGNORE_EOLWS;
}
if( find_option("ignore-all-space","w",0)!=0 ){
annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
}
fileVers = find_option("filevers",0,0)!=0;
db_must_be_within_tree();
/* We should be done with options.. */
verify_all_options();
if( g.argc<3 ) {
usage("FILENAME");
}
file_tree_name(g.argv[2], &treename, 1);
|
| ︙ | ︙ |
Changes to src/diff.tcl.
1 2 3 4 5 6 7 |
set prog {
package require Tk
array set CFG {
TITLE {Fossil Diff}
LN_COL_BG #dddddd
LN_COL_FG #444444
| > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# The "diff --tk" command outputs prepends a "set fossilcmd {...}" line
# to this file, then runs this file using "tclsh" in order to display the
# graphical diff in a separate window. A typical "set fossilcmd" line
# looks like this:
#
# set fossilcmd {| "./fossil" diff --html -y -i -v}
#
# This header comment is stripped off by the "mkbuiltin.c" program.
#
set prog {
package require Tk
array set CFG {
TITLE {Fossil Diff}
LN_COL_BG #dddddd
LN_COL_FG #444444
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
107 108 109 110 111 112 113 |
const char *zName2; /* Name of zFile2 for display */
/* Read content of zFile2 into memory */
blob_zero(&file2);
if( file_wd_size(zFile2)<0 ){
zName2 = NULL_DEVICE;
}else{
| | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
const char *zName2; /* Name of zFile2 for display */
/* Read content of zFile2 into memory */
blob_zero(&file2);
if( file_wd_size(zFile2)<0 ){
zName2 = NULL_DEVICE;
}else{
if( file_wd_islink(0) ){
blob_read_link(&file2, zFile2);
}else{
blob_read_from_file(&file2, zFile2);
}
zName2 = zName;
}
|
| ︙ | ︙ | |||
154 155 156 157 158 159 160 |
glob_free(pBinary);
return;
}
glob_free(pBinary);
}
blob_zero(&file2);
if( file_wd_size(zFile2)>=0 ){
| | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
glob_free(pBinary);
return;
}
glob_free(pBinary);
}
blob_zero(&file2);
if( file_wd_size(zFile2)>=0 ){
if( file_wd_islink(0) ){
blob_read_link(&file2, zFile2);
}else{
blob_read_from_file(&file2, zFile2);
}
}
if( looks_like_binary(&file2) ){
fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
|
| ︙ | ︙ | |||
839 840 841 842 843 844 845 |
** WEBPAGE: vpatch
** URL vpatch?from=UUID&to=UUID
*/
void vpatch_page(void){
const char *zFrom = P("from");
const char *zTo = P("to");
login_check_credentials();
| | | 839 840 841 842 843 844 845 846 847 848 849 850 851 |
** WEBPAGE: vpatch
** URL vpatch?from=UUID&to=UUID
*/
void vpatch_page(void){
const char *zFrom = P("from");
const char *zTo = P("to");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
cgi_set_content_type("text/plain");
diff_all_two_versions(zFrom, zTo, 0, 0, 0, DIFF_VERBOSE);
}
|
Changes to src/doc.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 |
if( isBinary[c] ){
break;
}
}
if( i>=n ){
return 0; /* Plain text */
}
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | | 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 |
if( isBinary[c] ){
break;
}
}
if( i>=n ){
return 0; /* Plain text */
}
for(i=0; i<ArraySize(aMime); i++){
if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
return aMime[i].zMimetype;
}
}
return "unknown/unknown";
}
/* A table of mimetypes based on file suffixes.
** Suffixes must be in sorted order so that we can do a binary
** search to find the mime-type
*/
static const struct {
const char *zSuffix; /* The file suffix */
int size; /* Length of the suffix */
const char *zMimetype; /* The corresponding mimetype */
} aMime[] = {
{ "ai", 2, "application/postscript" },
{ "aif", 3, "audio/x-aiff" },
{ "aifc", 4, "audio/x-aiff" },
{ "aiff", 4, "audio/x-aiff" },
{ "arj", 3, "application/x-arj-compressed" },
{ "asc", 3, "text/plain" },
{ "asf", 3, "video/x-ms-asf" },
{ "asx", 3, "video/x-ms-asx" },
{ "au", 2, "audio/ulaw" },
{ "avi", 3, "video/x-msvideo" },
{ "bat", 3, "application/x-msdos-program" },
{ "bcpio", 5, "application/x-bcpio" },
{ "bin", 3, "application/octet-stream" },
{ "c", 1, "text/plain" },
{ "cc", 2, "text/plain" },
{ "ccad", 4, "application/clariscad" },
{ "cdf", 3, "application/x-netcdf" },
{ "class", 5, "application/octet-stream" },
{ "cod", 3, "application/vnd.rim.cod" },
{ "com", 3, "application/x-msdos-program" },
{ "cpio", 4, "application/x-cpio" },
{ "cpt", 3, "application/mac-compactpro" },
{ "csh", 3, "application/x-csh" },
{ "css", 3, "text/css" },
{ "csv", 3, "text/csv" },
{ "dcr", 3, "application/x-director" },
{ "deb", 3, "application/x-debian-package" },
{ "dir", 3, "application/x-director" },
{ "dl", 2, "video/dl" },
{ "dms", 3, "application/octet-stream" },
{ "doc", 3, "application/msword" },
{ "docx", 4, "application/vnd.openxmlformats-"
"officedocument.wordprocessingml.document"},
{ "dot", 3, "application/msword" },
{ "dotx", 4, "application/vnd.openxmlformats-"
"officedocument.wordprocessingml.template"},
{ "drw", 3, "application/drafting" },
{ "dvi", 3, "application/x-dvi" },
{ "dwg", 3, "application/acad" },
{ "dxf", 3, "application/dxf" },
{ "dxr", 3, "application/x-director" },
{ "eps", 3, "application/postscript" },
{ "etx", 3, "text/x-setext" },
{ "exe", 3, "application/octet-stream" },
{ "ez", 2, "application/andrew-inset" },
{ "f", 1, "text/plain" },
{ "f90", 3, "text/plain" },
{ "fli", 3, "video/fli" },
{ "flv", 3, "video/flv" },
{ "gif", 3, "image/gif" },
{ "gl", 2, "video/gl" },
{ "gtar", 4, "application/x-gtar" },
{ "gz", 2, "application/x-gzip" },
{ "h", 1, "text/plain" },
{ "hdf", 3, "application/x-hdf" },
{ "hh", 2, "text/plain" },
{ "hqx", 3, "application/mac-binhex40" },
{ "htm", 3, "text/html" },
{ "html", 4, "text/html" },
{ "ice", 3, "x-conference/x-cooltalk" },
{ "ief", 3, "image/ief" },
{ "iges", 4, "model/iges" },
{ "igs", 3, "model/iges" },
{ "ips", 3, "application/x-ipscript" },
{ "ipx", 3, "application/x-ipix" },
{ "jad", 3, "text/vnd.sun.j2me.app-descriptor" },
{ "jar", 3, "application/java-archive" },
{ "jpe", 3, "image/jpeg" },
{ "jpeg", 4, "image/jpeg" },
{ "jpg", 3, "image/jpeg" },
{ "js", 2, "application/x-javascript" },
{ "kar", 3, "audio/midi" },
{ "latex", 5, "application/x-latex" },
{ "lha", 3, "application/octet-stream" },
{ "lsp", 3, "application/x-lisp" },
{ "lzh", 3, "application/octet-stream" },
{ "m", 1, "text/plain" },
{ "m3u", 3, "audio/x-mpegurl" },
{ "man", 3, "application/x-troff-man" },
{ "markdown", 8, "text/x-markdown" },
{ "md", 2, "text/x-markdown" },
{ "me", 2, "application/x-troff-me" },
{ "mesh", 4, "model/mesh" },
{ "mid", 3, "audio/midi" },
{ "midi", 4, "audio/midi" },
{ "mif", 3, "application/x-mif" },
{ "mime", 4, "www/mime" },
{ "mkd", 3, "text/x-markdown" },
{ "mov", 3, "video/quicktime" },
{ "movie", 5, "video/x-sgi-movie" },
{ "mp2", 3, "audio/mpeg" },
{ "mp3", 3, "audio/mpeg" },
{ "mp4", 3, "video/mp4" },
{ "mpe", 3, "video/mpeg" },
{ "mpeg", 4, "video/mpeg" },
{ "mpg", 3, "video/mpeg" },
{ "mpga", 4, "audio/mpeg" },
{ "ms", 2, "application/x-troff-ms" },
{ "msh", 3, "model/mesh" },
{ "nc", 2, "application/x-netcdf" },
{ "oda", 3, "application/oda" },
{ "odp", 3, "application/vnd.oasis.opendocument.presentation" },
{ "ods", 3, "application/vnd.oasis.opendocument.spreadsheet" },
{ "odt", 3, "application/vnd.oasis.opendocument.text" },
{ "ogg", 3, "application/ogg" },
{ "ogm", 3, "application/ogg" },
{ "pbm", 3, "image/x-portable-bitmap" },
{ "pdb", 3, "chemical/x-pdb" },
{ "pdf", 3, "application/pdf" },
{ "pgm", 3, "image/x-portable-graymap" },
{ "pgn", 3, "application/x-chess-pgn" },
{ "pgp", 3, "application/pgp" },
{ "pl", 2, "application/x-perl" },
{ "pm", 2, "application/x-perl" },
{ "png", 3, "image/png" },
{ "pnm", 3, "image/x-portable-anymap" },
{ "pot", 3, "application/mspowerpoint" },
{ "potx", 4, "application/vnd.openxmlformats-"
"officedocument.presentationml.template"},
{ "ppm", 3, "image/x-portable-pixmap" },
{ "pps", 3, "application/mspowerpoint" },
{ "ppsx", 4, "application/vnd.openxmlformats-"
"officedocument.presentationml.slideshow"},
{ "ppt", 3, "application/mspowerpoint" },
{ "pptx", 4, "application/vnd.openxmlformats-"
"officedocument.presentationml.presentation"},
{ "ppz", 3, "application/mspowerpoint" },
{ "pre", 3, "application/x-freelance" },
{ "prt", 3, "application/pro_eng" },
{ "ps", 2, "application/postscript" },
{ "qt", 2, "video/quicktime" },
{ "ra", 2, "audio/x-realaudio" },
{ "ram", 3, "audio/x-pn-realaudio" },
{ "rar", 3, "application/x-rar-compressed" },
{ "ras", 3, "image/cmu-raster" },
{ "rgb", 3, "image/x-rgb" },
{ "rm", 2, "audio/x-pn-realaudio" },
{ "roff", 4, "application/x-troff" },
{ "rpm", 3, "audio/x-pn-realaudio-plugin" },
{ "rtf", 3, "text/rtf" },
{ "rtx", 3, "text/richtext" },
{ "scm", 3, "application/x-lotusscreencam" },
{ "set", 3, "application/set" },
{ "sgm", 3, "text/sgml" },
{ "sgml", 4, "text/sgml" },
{ "sh", 2, "application/x-sh" },
{ "shar", 4, "application/x-shar" },
{ "silo", 4, "model/mesh" },
{ "sit", 3, "application/x-stuffit" },
{ "skd", 3, "application/x-koan" },
{ "skm", 3, "application/x-koan" },
{ "skp", 3, "application/x-koan" },
{ "skt", 3, "application/x-koan" },
{ "smi", 3, "application/smil" },
{ "smil", 4, "application/smil" },
{ "snd", 3, "audio/basic" },
{ "sol", 3, "application/solids" },
{ "spl", 3, "application/x-futuresplash" },
{ "src", 3, "application/x-wais-source" },
{ "step", 4, "application/STEP" },
{ "stl", 3, "application/SLA" },
{ "stp", 3, "application/STEP" },
{ "sv4cpio", 7, "application/x-sv4cpio" },
{ "sv4crc", 6, "application/x-sv4crc" },
{ "svg", 3, "image/svg+xml" },
{ "swf", 3, "application/x-shockwave-flash" },
{ "t", 1, "application/x-troff" },
{ "tar", 3, "application/x-tar" },
{ "tcl", 3, "application/x-tcl" },
{ "tex", 3, "application/x-tex" },
{ "texi", 4, "application/x-texinfo" },
{ "texinfo", 7, "application/x-texinfo" },
{ "tgz", 3, "application/x-tar-gz" },
{ "th1", 3, "application/x-th1" },
{ "tif", 3, "image/tiff" },
{ "tiff", 4, "image/tiff" },
{ "tr", 2, "application/x-troff" },
{ "tsi", 3, "audio/TSP-audio" },
{ "tsp", 3, "application/dsptype" },
{ "tsv", 3, "text/tab-separated-values" },
{ "txt", 3, "text/plain" },
{ "unv", 3, "application/i-deas" },
{ "ustar", 5, "application/x-ustar" },
{ "vcd", 3, "application/x-cdlink" },
{ "vda", 3, "application/vda" },
{ "viv", 3, "video/vnd.vivo" },
{ "vivo", 4, "video/vnd.vivo" },
{ "vrml", 4, "model/vrml" },
{ "wav", 3, "audio/x-wav" },
{ "wax", 3, "audio/x-ms-wax" },
{ "wiki", 4, "text/x-fossil-wiki" },
{ "wma", 3, "audio/x-ms-wma" },
{ "wmv", 3, "video/x-ms-wmv" },
{ "wmx", 3, "video/x-ms-wmx" },
{ "wrl", 3, "model/vrml" },
{ "wvx", 3, "video/x-ms-wvx" },
{ "xbm", 3, "image/x-xbitmap" },
{ "xlc", 3, "application/vnd.ms-excel" },
{ "xll", 3, "application/vnd.ms-excel" },
{ "xlm", 3, "application/vnd.ms-excel" },
{ "xls", 3, "application/vnd.ms-excel" },
{ "xlsx", 4, "application/vnd.openxmlformats-"
"officedocument.spreadsheetml.sheet"},
{ "xlw", 3, "application/vnd.ms-excel" },
{ "xml", 3, "text/xml" },
{ "xpm", 3, "image/x-xpixmap" },
{ "xwd", 3, "image/x-xwindowdump" },
{ "xyz", 3, "chemical/x-pdb" },
{ "zip", 3, "application/zip" },
};
/*
** Verify that all entries in the aMime[] table are in sorted order.
** Abort with a fatal error if any is out-of-order.
*/
static void mimetype_verify(void){
int i;
for(i=1; i<ArraySize(aMime); i++){
if( fossil_strcmp(aMime[i-1].zSuffix,aMime[i].zSuffix)>=0 ){
fossil_fatal("mimetypes out of sequence: %s before %s",
aMime[i-1].zSuffix, aMime[i].zSuffix);
}
}
}
/*
** Guess the mime-type of a document based on its name.
*/
const char *mimetype_from_name(const char *zName){
const char *z;
int i;
int first, last;
int len;
char zSuffix[20];
#ifdef FOSSIL_DEBUG
/* This is test code to make sure the table above is in the correct
** order
*/
if( fossil_strcmp(zName, "mimetype-test")==0 ){
mimetype_verify();
return "ok";
}
#endif
z = zName;
for(i=0; zName[i]; i++){
if( zName[i]=='.' ) z = &zName[i+1];
}
len = strlen(z);
if( len<sizeof(zSuffix)-1 ){
sqlite3_snprintf(sizeof(zSuffix), zSuffix, "%s", z);
for(i=0; zSuffix[i]; i++) zSuffix[i] = fossil_tolower(zSuffix[i]);
first = 0;
last = ArraySize(aMime) - 1;
while( first<=last ){
int c;
i = (first+last)/2;
c = fossil_strcmp(zSuffix, aMime[i].zSuffix);
if( c==0 ) return aMime[i].zMimetype;
if( c<0 ){
last = i-1;
|
| ︙ | ︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
**
** If Fossil is compiled with -DFOSSIL_DEBUG then the "mimetype-test"
** filename is special and verifies the integrity of the mimetype table.
** It should return "ok".
*/
void mimetype_test_cmd(void){
int i;
for(i=2; i<g.argc; i++){
fossil_print("%-20s -> %s\n", g.argv[i], mimetype_from_name(g.argv[i]));
}
}
/*
** WEBPAGE: doc
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | > | < | | > > > > > > > > > > > > > > > > > > | | > > > > | > > > | | | > | < | > | | > > | | > | > > | | | | | | | | | | | < < < | | | | | | < < | < > | < < | < < | < | < < < < < < < < < | | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > < > | > > > > > > > > < > > | | > > > > | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
**
** If Fossil is compiled with -DFOSSIL_DEBUG then the "mimetype-test"
** filename is special and verifies the integrity of the mimetype table.
** It should return "ok".
*/
void mimetype_test_cmd(void){
int i;
mimetype_verify();
for(i=2; i<g.argc; i++){
fossil_print("%-20s -> %s\n", g.argv[i], mimetype_from_name(g.argv[i]));
}
}
/*
** WEBPAGE: mimetype_list
**
** Show the built-in table used to guess embedded document mimetypes
** from file suffixes.
*/
void mimetype_list_page(void){
int i;
mimetype_verify();
style_header("Mimetype List");
@ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
@ suffixes and the following table to guess at the appropriate mimetype
@ for each document.</p>
@ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'>
@ <thead>
@ <tr><th>Suffix<th>Mimetype
@ </thead>
@ <tbody>
for(i=0; i<ArraySize(aMime); i++){
@ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr>
}
@ </tbody></table>
output_table_sorting_javascript("mimeTable","tt",1);
style_footer();
}
/*
** Check to see if the file in the pContent blob is "embedded HTML". Return
** true if it is, and fill pTitle with the document title.
**
** An "embedded HTML" file is HTML that lacks a header and a footer. The
** standard Fossil header is prepended and the standard Fossil footer is
** appended. Otherwise, the file is displayed without change.
**
** Embedded HTML must be contained in a <div class='fossil-doc'> element.
** If that <div> also contains a data-title attribute, then the
** value of that attribute is extracted into pTitle and becomes the title
** of the document.
*/
int doc_is_embedded_html(Blob *pContent, Blob *pTitle){
const char *zIn = blob_str(pContent);
const char *zAttr;
const char *zValue;
int nAttr, nValue;
int seenClass = 0;
int seenTitle = 0;
while( fossil_isspace(zIn[0]) ) zIn++;
if( fossil_strnicmp(zIn,"<div",4)!=0 ) return 0;
zIn += 4;
while( zIn[0] ){
if( fossil_isspace(zIn[0]) ) zIn++;
if( zIn[0]=='>' ) return 0;
zAttr = zIn;
while( fossil_isalnum(zIn[0]) || zIn[0]=='-' ) zIn++;
nAttr = (int)(zIn - zAttr);
while( fossil_isspace(zIn[0]) ) zIn++;
if( zIn[0]!='=' ) continue;
zIn++;
while( fossil_isspace(zIn[0]) ) zIn++;
if( zIn[0]=='"' || zIn[0]=='\'' ){
char cDelim = zIn[0];
zIn++;
zValue = zIn;
while( zIn[0] && zIn[0]!=cDelim ) zIn++;
if( zIn[0]==0 ) return 0;
nValue = (int)(zIn - zValue);
zIn++;
}else{
zValue = zIn;
while( zIn[0]!=0 && zIn[0]!='>' && zIn[0]!='/'
&& !fossil_isspace(zIn[0]) ) zIn++;
if( zIn[0]==0 ) return 0;
nValue = (int)(zIn - zValue);
}
if( nAttr==5 && fossil_strnicmp(zAttr,"class",5)==0 ){
if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0;
seenClass = 1;
if( seenTitle ) return 1;
}
if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){
blob_append(pTitle, zValue, nValue);
seenTitle = 1;
if( seenClass ) return 1;
}
}
return seenClass;
}
/*
** Look for a file named zName in the checkin with RID=vid. Load the content
** of that file into pContent and return the RID for the file. Or return 0
** if the file is not found or could not be loaded.
*/
int doc_load_content(int vid, const char *zName, Blob *pContent){
int rid; /* The RID of the file being loaded */
if( !db_table_exists("repository","vcache") ){
db_multi_exec(
"CREATE TABLE IF NOT EXISTS vcache(\n"
" vid INTEGER, -- checkin ID\n"
" fname TEXT, -- filename\n"
" rid INTEGER, -- artifact ID\n"
" PRIMARY KEY(vid,fname)\n"
") WITHOUT ROWID"
);
}
if( !db_exists("SELECT 1 FROM vcache WHERE vid=%d", vid) ){
db_multi_exec(
"DELETE FROM vcache;\n"
"CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;\n"
"INSERT INTO vcache(vid,fname,rid)"
" SELECT checkinID, filename, blob.rid FROM foci, blob"
" WHERE blob.uuid=foci.uuid"
" AND foci.checkinID=%d;",
vid
);
}
rid = db_int(0, "SELECT rid FROM vcache"
" WHERE vid=%d AND fname=%Q", vid, zName);
if( rid && content_get(rid, pContent)==0 ){
rid = 0;
}
return rid;
}
/*
** WEBPAGE: doc
** URL: /doc?name=CHECKIN/FILE
** URL: /doc/CHECKIN/FILE
**
** CHECKIN can be either tag or SHA1 hash or timestamp identifying a
** particular check, or the name of a branch (meaning the most recent
** check-in on that branch) or one of various magic words:
**
** "tip" means the most recent check-in
**
** "ckout" means the current check-out, if the server is run from
** within a check-out, otherwise it is the same as "tip"
**
** FILE is the name of a file to delivered up as a webpage. FILE is relative
** to the root of the source tree of the repository. The FILE must
** be a part of CHECKIN, except when CHECKIN=="ckout" when FILE is read
** directly from disk and need not be a managed file.
**
** The "ckout" CHECKIN is intended for development - to provide a mechanism
** for looking at what a file will look like using the /doc webpage after
** it gets checked in.
**
** The file extension is used to decide how to render the file.
**
** If FILE ends in "/" then names "FILE/index.html", "FILE/index.wiki",
** and "FILE/index.md" are in that order. If none of those are found,
** then FILE is completely replaced by "404.md" and tried. If that is
** not found, then a default 404 screen is generated.
*/
void doc_page(void){
const char *zName; /* Argument to the /doc page */
const char *zOrigName = "?"; /* Original document name */
const char *zMime; /* Document MIME type */
char *zCheckin = "tip"; /* The checkin holding the document */
int vid = 0; /* Artifact of checkin */
int rid = 0; /* Artifact of file */
int i; /* Loop counter */
Blob filebody; /* Content of the documentation file */
Blob title; /* Document title */
int nMiss = (-1); /* Failed attempts to find the document */
static const char *const azSuffix[] = {
"index.html", "index.wiki", "index.md"
};
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
blob_init(&title, 0, 0);
db_begin_transaction();
while( rid==0 && (++nMiss)<=ArraySize(azSuffix) ){
zName = PD("name", "tip/index.wiki");
for(i=0; zName[i] && zName[i]!='/'; i++){}
zCheckin = mprintf("%.*s", i, zName);
if( fossil_strcmp(zCheckin,"ckout")==0 && db_open_local(0)==0 ){
zCheckin = "tip";
}
if( nMiss==ArraySize(azSuffix) ){
zName = "404.md";
}else if( zName[i]==0 ){
assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
zName = azSuffix[nMiss];
}else{
zName += i;
}
while( zName[0]=='/' ){ zName++; }
g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
if( nMiss==0 ) zOrigName = zName;
if( !file_is_simple_pathname(zName, 1) ){
if( sqlite3_strglob("*/", zName)==0 ){
assert( nMiss>=0 && nMiss<ArraySize(azSuffix) );
zName = mprintf("%s%s", zName, azSuffix[nMiss]);
if( !file_is_simple_pathname(zName, 1) ){
goto doc_not_found;
}
}else{
goto doc_not_found;
}
}
if( fossil_strcmp(zCheckin,"ckout")==0 ){
/* Read from the local checkout */
char *zFullpath;
db_must_be_within_tree();
zFullpath = mprintf("%s/%s", g.zLocalRoot, zName);
if( file_isfile(zFullpath)
&& blob_read_from_file(&filebody, zFullpath)>0 ){
rid = 1; /* Fake RID just to get the loop to end */
}
fossil_free(zFullpath);
}else{
vid = name_to_typed_rid(zCheckin, "ci");
rid = doc_load_content(vid, zName, &filebody);
}
}
if( rid==0 ) goto doc_not_found;
blob_to_utf8_no_bom(&filebody, 0);
/* The file is now contained in the filebody blob. Deliver the
** file to the user
*/
zMime = nMiss==0 ? P("mimetype") : 0;
if( zMime==0 ){
zMime = mimetype_from_name(zName);
}
Th_Store("doc_name", zName);
Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'"
" FROM blob WHERE rid=%d", vid));
Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event"
" WHERE objid=%d AND type='ci'", vid));
if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
Blob tail;
style_adunit_config(ADUNIT_RIGHT_OK);
if( wiki_find_title(&filebody, &title, &tail) ){
style_header("%s", blob_str(&title));
wiki_convert(&tail, 0, WIKI_BUTTONS);
}else{
style_header("Documentation");
wiki_convert(&filebody, 0, WIKI_BUTTONS);
}
style_footer();
}else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(&filebody, &title, &tail);
if( blob_size(&title)>0 ){
style_header("%s", blob_str(&title));
}else{
style_header("%s", nMiss>=ArraySize(azSuffix)?
"Not Found" : "Documentation");
}
blob_append(cgi_output_blob(), blob_buffer(&tail), blob_size(&tail));
style_footer();
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
style_header("Documentation");
@ <blockquote><pre>
@ %h(blob_str(&filebody))
@ </pre></blockquote>
style_footer();
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(&filebody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zName,-1);
style_header("%s", blob_str(&title));
blob_append(cgi_output_blob(), blob_buffer(&filebody),blob_size(&filebody));
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
}else if( db_get_boolean("th1-docs", 0) &&
fossil_strcmp(zMime, "application/x-th1")==0 ){
style_header("%h", zName);
Th_Render(blob_str(&filebody));
style_footer();
#endif
}else{
cgi_set_content_type(zMime);
cgi_set_content(&filebody);
}
if( nMiss>=ArraySize(azSuffix) ) cgi_set_status(404, "Not Found");
db_end_transaction(0);
return;
/* Jump here when unable to locate the document */
doc_not_found:
db_end_transaction(0);
cgi_set_status(404, "Not Found");
style_header("Not Found");
@ <p>Document %h(zOrigName) not found
if( fossil_strcmp(zCheckin,"ckout")!=0 ){
@ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a>
}
style_footer();
db_end_transaction(0);
return;
}
/*
** The default logo.
*/
static const unsigned char aLogo[] = {
|
| ︙ | ︙ | |||
667 668 669 670 671 672 673 |
if( blob_size(&bgimg)==0 ){
blob_init(&bgimg, (char*)aBackground, sizeof(aBackground));
}
cgi_set_content_type(zMime);
cgi_set_content(&bgimg);
g.isConst = 1;
}
| > > > > > > > > > > > > > | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
if( blob_size(&bgimg)==0 ){
blob_init(&bgimg, (char*)aBackground, sizeof(aBackground));
}
cgi_set_content_type(zMime);
cgi_set_content(&bgimg);
g.isConst = 1;
}
/*
** WEBPAGE: /docsrch
**
** Search for documents that match a user-supplied pattern.
*/
void doc_search_page(void){
login_check_credentials();
style_header("Document Search");
search_screen(SRCH_DOC, 0);
style_footer();
}
|
Changes to src/event.c.
| ︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to do formatting of event messages: ** ** Milestones ** Blog posts ** New articles ** Process checkpoints ** Announcements */ #include "config.h" #include <assert.h> #include <ctype.h> #include "event.h" /* | > > > > > > > > | | | | | > | > > | | | | | | | | | | > | | | | | | | | | | > | > > > | > > > > > | > > | > | < | | < | > | | < | | < | | < | | | | | | | | > | > > > > > > > | | | | > > > > > | > > | | | > | | | | > > > > > > | | > > | > | | | | | | > | | > > > | 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 |
** drh@hwaci.com
** http://www.hwaci.com/drh/
**
*******************************************************************************
**
** This file contains code to do formatting of event messages:
**
** Technical Notes
** Milestones
** Blog posts
** New articles
** Process checkpoints
** Announcements
**
** Do not confuse "event" artifacts with the "event" table in the
** repository database. An "event" artifact is a technical-note: a
** wiki- or blog-like essay that appears on the timeline. The "event"
** table records all entries on the timeline, including tech-notes.
**
** (2015-02-14): Changing the name to "tech-note" most everywhere.
*/
#include "config.h"
#include <assert.h>
#include <ctype.h>
#include "event.h"
/*
** Output a hyperlink to an technote given its tagid.
*/
void hyperlink_to_event_tagid(int tagid){
char *zId;
zId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
tagid);
@ [%z(href("%R/technote/%s",zId))%S(zId)</a>]
free(zId);
}
/*
** WEBPAGE: technote
** WEBPAGE: event
**
** Display a "technical note" or "tech-note" (formerly called an "event").
**
** PARAMETERS:
**
** name=ID // Identify the tech-note to display. ID must be complete
** aid=ARTIFACTID // Which specific version of the tech-note. Optional.
** v=BOOLEAN // Show details if TRUE. Default is FALSE. Optional.
**
** Display an existing event identified by EVENTID
*/
void event_page(void){
int rid = 0; /* rid of the event artifact */
char *zUuid; /* UUID corresponding to rid */
const char *zId; /* Event identifier */
const char *zVerbose; /* Value of verbose option */
char *zETime; /* Time of the tech-note */
char *zATime; /* Time the artifact was created */
int specRid; /* rid specified by aid= parameter */
int prevRid, nextRid; /* Previous or next edits of this tech-note */
Manifest *pTNote; /* Parsed technote artifact */
Blob fullbody; /* Complete content of the technote body */
Blob title; /* Title extracted from the technote body */
Blob tail; /* Event body that comes after the title */
Stmt q1; /* Query to search for the technote */
int verboseFlag; /* True to show details */
const char *zMimetype = 0; /* Mimetype of the document */
/* wiki-read privilege is needed in order to read tech-notes.
*/
login_check_credentials();
if( !g.perm.RdWiki ){
login_needed(g.anon.RdWiki);
return;
}
zId = P("name");
if( zId==0 ){ fossil_redirect_home(); return; }
zUuid = (char*)P("aid");
specRid = zUuid ? uuid_to_rid(zUuid, 0) : 0;
rid = nextRid = prevRid = 0;
db_prepare(&q1,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname GLOB 'event-%q*')"
" ORDER BY mtime DESC",
zId
);
while( db_step(&q1)==SQLITE_ROW ){
nextRid = rid;
rid = db_column_int(&q1, 0);
if( specRid==0 || specRid==rid ){
if( db_step(&q1)==SQLITE_ROW ){
prevRid = db_column_int(&q1, 0);
}
break;
}
}
db_finalize(&q1);
if( rid==0 || (specRid!=0 && specRid!=rid) ){
style_header("No Such Tech-Note");
@ Cannot locate a technical note called <b>%h(zId)</b>.
style_footer();
return;
}
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
zVerbose = P("v");
if( !zVerbose ){
zVerbose = P("verbose");
}
if( !zVerbose ){
zVerbose = P("detail"); /* deprecated */
}
verboseFlag = (zVerbose!=0) && !is_false(zVerbose);
/* Extract the event content.
*/
pTNote = manifest_get(rid, CFTYPE_EVENT, 0);
if( pTNote==0 ){
fossil_fatal("Object #%d is not a tech-note", rid);
}
zMimetype = wiki_filter_mimetypes(PD("mimetype",pTNote->zMimetype));
blob_init(&fullbody, pTNote->zWiki, -1);
blob_init(&title, 0, 0);
blob_init(&tail, 0, 0);
if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
if( !wiki_find_title(&fullbody, &title, &tail) ){
blob_appendf(&title, "Tech-note %S", zId);
tail = fullbody;
}
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
markdown_to_html(&fullbody, &title, &tail);
if( blob_size(&title)==0 ){
blob_appendf(&title, "Tech-note %S", zId);
}
}else{
blob_appendf(&title, "Tech-note %S", zId);
tail = fullbody;
}
style_header("%s", blob_str(&title));
if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){
style_submenu_element("Edit", 0, "%R/technoteedit?name=%!S", zId);
}
zETime = db_text(0, "SELECT datetime(%.17g)", pTNote->rEventDate);
style_submenu_element("Context", 0, "%R/timeline?c=%.20s", zId);
if( g.perm.Hyperlink ){
if( verboseFlag ){
style_submenu_element("Plain", 0,
"%R/technote?name=%!S&aid=%s&mimetype=text/plain",
zId, zUuid);
if( nextRid ){
char *zNext;
zNext = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nextRid);
style_submenu_element("Next", 0,"%R/technote?name=%!S&aid=%s&v",
zId, zNext);
free(zNext);
}
if( prevRid ){
char *zPrev;
zPrev = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", prevRid);
style_submenu_element("Prev", 0, "%R/technote?name=%!S&aid=%s&v",
zId, zPrev);
free(zPrev);
}
}else{
style_submenu_element("Detail", 0, "%R/technote?name=%!S&aid=%s&v",
zId, zUuid);
}
}
if( verboseFlag && g.perm.Hyperlink ){
int i;
const char *zClr = 0;
Blob comment;
zATime = db_text(0, "SELECT datetime(%.17g)", pTNote->rDate);
@ <p>Tech-note [%z(href("%R/artifact/%!S",zUuid))%S(zUuid)</a>] at
@ [%z(href("%R/timeline?c=%T",zETime))%s(zETime)</a>]
@ entered by user <b>%h(pTNote->zUser)</b> on
@ [%z(href("%R/timeline?c=%T",zATime))%s(zATime)</a>]:</p>
@ <blockquote>
for(i=0; i<pTNote->nTag; i++){
if( fossil_strcmp(pTNote->aTag[i].zName,"+bgcolor")==0 ){
zClr = pTNote->aTag[i].zValue;
}
}
if( zClr && zClr[0]==0 ) zClr = 0;
if( zClr ){
@ <div style="background-color: %h(zClr);">
}else{
@ <div>
}
blob_init(&comment, pTNote->zComment, -1);
wiki_convert(&comment, 0, WIKI_INLINE);
blob_reset(&comment);
@ </div>
@ </blockquote><hr />
}
if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
wiki_convert(&fullbody, 0, 0);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
cgi_append_content(blob_buffer(&tail), blob_size(&tail));
}else{
@ <pre>
@ %h(blob_str(&fullbody))
@ </pre>
}
style_footer();
manifest_destroy(pTNote);
}
/*
** WEBPAGE: technoteedit
** WEBPAGE: eventedit
**
** Revise or create a technical note (formerly called an 'event').
**
** Parameters:
**
** name=ID Hex hash ID of the tech-note. If omitted, a new
** tech-note is created.
*/
void eventedit_page(void){
char *zTag;
int rid = 0;
Blob event;
const char *zId;
int n;
const char *z;
char *zBody = (char*)P("w");
char *zETime = (char*)P("t");
const char *zComment = P("c");
const char *zTags = P("g");
const char *zClr;
const char *zMimetype = P("mimetype");
int isNew = 0;
if( zBody ){
zBody = mprintf("%s", zBody);
}
login_check_credentials();
zId = P("name");
if( zId==0 ){
zId = db_text(0, "SELECT lower(hex(randomblob(20)))");
isNew = 1;
}else{
int nId = strlen(zId);
if( !validate16(zId, nId) ){
fossil_redirect_home();
return;
}
}
zTag = mprintf("event-%s", zId);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname GLOB '%q*')"
" ORDER BY mtime DESC", zTag
);
if( rid && strlen(zId)<40 ){
zId = db_text(0,
"SELECT substr(tagname,7) FROM tag WHERE tagname GLOB '%q*'",
zTag
);
}
free(zTag);
/* Need both check-in and wiki-write or wiki-create privileges in order
** to edit/create an event.
*/
if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki));
return;
}
/* Figure out the color */
if( rid ){
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
}else{
zClr = "";
isNew = 1;
}
zClr = PD("clr",zClr);
if( fossil_strcmp(zClr,"##")==0 ) zClr = PD("cclr","");
/* If editing an existing event, extract the key fields to use as
** a starting point for the edit.
*/
if( rid
&& (zBody==0 || zETime==0 || zComment==0 || zTags==0 || zMimetype==0)
){
Manifest *pTNote;
pTNote = manifest_get(rid, CFTYPE_EVENT, 0);
if( pTNote && pTNote->type==CFTYPE_EVENT ){
if( zBody==0 ) zBody = pTNote->zWiki;
if( zETime==0 ){
zETime = db_text(0, "SELECT datetime(%.17g)", pTNote->rEventDate);
}
if( zComment==0 ) zComment = pTNote->zComment;
if( zMimetype==0 ) zMimetype = pTNote->zMimetype;
}
if( zTags==0 ){
zTags = db_text(0,
"SELECT group_concat(substr(tagname,5),', ')"
" FROM tagxref, tag"
" WHERE tagxref.rid=%d"
" AND tagxref.tagid=tag.tagid"
" AND tag.tagname GLOB 'sym-*'",
rid
);
}
}
zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime);
if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){
char *zDate;
Blob cksum;
int nrid, n;
blob_init(&event, 0, 0);
db_begin_transaction();
login_verify_csrf_secret();
while( fossil_isspace(zComment[0]) ) zComment++;
n = strlen(zComment);
while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; }
if( n>0 ){
blob_appendf(&event, "C %#F\n", n, zComment);
}
zDate = date_in_standard_format("now");
blob_appendf(&event, "D %s\n", zDate);
free(zDate);
zETime[10] = 'T';
blob_appendf(&event, "E %s %s\n", zETime, zId);
zETime[10] = ' ';
if( rid ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
blob_appendf(&event, "P %s\n", zUuid);
free(zUuid);
}
if( zMimetype && zMimetype[0] ){
blob_appendf(&event, "N %s\n", zMimetype);
}
if( zClr && zClr[0] ){
blob_appendf(&event, "T +bgcolor * %F\n", zClr);
}
if( zTags && zTags[0] ){
Blob tags, one;
int i, j;
Stmt q;
|
| ︙ | ︙ | |||
348 349 350 351 352 353 354 |
}
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
| | > > > > > > > | | | > > > | > | | < < < < | < | | | | | | > > > > > | | 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 |
}
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){
db_end_transaction(1);
style_header("Error");
@ Internal error: Fossil tried to make an invalid artifact for
@ the edited technode.
style_footer();
return;
}
assert( blob_is_reset(&event) );
content_deltify(rid, nrid, 0);
db_end_transaction(0);
cgi_redirectf("technote?name=%T", zId);
}
if( P("cancel")!=0 ){
cgi_redirectf("technote?name=%T", zId);
return;
}
if( zBody==0 ){
zBody = mprintf("Insert new content here...");
}
if( isNew ){
style_header("New Tech-note %S", zId);
}else{
style_header("Edit Tech-note %S", zId);
}
if( P("preview")!=0 ){
Blob com;
@ <p><b>Timeline comment preview:</b></p>
@ <blockquote>
@ <table border="0">
if( zClr && zClr[0] ){
@ <tr><td style="background-color: %h(zClr);">
}else{
@ <tr><td>
}
blob_zero(&com);
blob_append(&com, zComment, -1);
wiki_convert(&com, 0, WIKI_INLINE|WIKI_NOBADLINKS);
@ </td></tr></table>
@ </blockquote>
@ <p><b>Page content preview:</b><p>
@ <blockquote>
blob_init(&event, 0, 0);
blob_append(&event, zBody, -1);
wiki_render_by_mimetype(&event, zMimetype);
@ </blockquote><hr />
blob_reset(&event);
}
for(n=2, z=zBody; z[0]; z++){
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>40 ) n = 40;
@ <form method="post" action="%R/technoteedit"><div>
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zId)" />
@ <table border="0" cellspacing="10">
@ <tr><th align="right" valign="top">Timestamp (UTC):</th>
@ <td valign="top">
@ <input type="text" name="t" size="25" value="%h(zETime)" />
@ </td></tr>
@ <tr><th align="right" valign="top">Timeline Comment:</th>
@ <td valign="top">
@ <textarea name="c" class="technoteedit" cols="80"
@ rows="3" wrap="virtual">%h(zComment)</textarea>
@ </td></tr>
@ <tr><th align="right" valign="top">Timeline Background Color:</th>
@ <td valign="top">
render_color_chooser(0, zClr, 0, "clr", "cclr");
@ </td></tr>
@ <tr><th align="right" valign="top">Tags:</th>
@ <td valign="top">
@ <input type="text" name="g" size="40" value="%h(zTags)" />
@ </td></tr>
@ <tr><th align="right" valign="top">Markup Style:</th>
@ <td valign="top">
mimetype_option_menu(zMimetype);
@ </td></tr>
@ <tr><th align="right" valign="top">Page Content:</th>
@ <td valign="top">
@ <textarea name="w" class="technoteedit" cols="80"
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
@ </td></tr>
@ <tr><td colspan="2">
@ <input type="submit" name="preview" value="Preview Your Changes" />
@ <input type="submit" name="submit" value="Apply These Changes" />
@ <input type="submit" name="cancel" value="Cancel" />
@ </td></tr></table>
@ </div></form>
style_footer();
}
|
Changes to src/file.c.
| ︙ | ︙ | |||
230 231 232 233 234 235 236 | blob_read_link(&content, zFrom); symlink_create(blob_str(&content), zTo); blob_reset(&content); } /* ** Return file permissions (normal, executable, or symlink): | | < | < < | | | < < < < < < | | > | | < | 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 |
blob_read_link(&content, zFrom);
symlink_create(blob_str(&content), zTo);
blob_reset(&content);
}
/*
** Return file permissions (normal, executable, or symlink):
** - PERM_EXE on Unix if file is executable;
** - PERM_LNK on Unix if file is symlink and allow-symlinks option is on;
** - PERM_REG for all other cases (regular file, directory, fifo, etc).
*/
int file_wd_perm(const char *zFilename){
#if !defined(_WIN32)
if( !getStat(zFilename, 1) ){
if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 )
return PERM_EXE;
else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) )
return PERM_LNK;
}
#endif
return PERM_REG;
}
/*
** Return TRUE if the named file is an executable. Return false
** for directories, devices, fifos, symlinks, etc.
*/
int file_wd_isexe(const char *zFilename){
|
| ︙ | ︙ | |||
430 431 432 433 434 435 436 |
int file_wd_setexe(const char *zFilename, int onoff){
int rc = 0;
#if !defined(_WIN32)
struct stat buf;
if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0;
if( onoff ){
int targetMode = (buf.st_mode & 0444)>>2;
| | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
int file_wd_setexe(const char *zFilename, int onoff){
int rc = 0;
#if !defined(_WIN32)
struct stat buf;
if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0;
if( onoff ){
int targetMode = (buf.st_mode & 0444)>>2;
if( (buf.st_mode & 0100) == 0 ){
chmod(zFilename, buf.st_mode | targetMode);
rc = 1;
}
}else{
if( (buf.st_mode & 0100) != 0 ){
chmod(zFilename, buf.st_mode & ~0111);
rc = 1;
}
}
#endif /* _WIN32 */
return rc;
}
|
| ︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 |
fossil_unicode_free(uName);
#else
char *zValue = getenv(zName);
#endif
if( zValue ) zValue = fossil_filename_to_utf8(zValue);
return zValue;
}
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
wchar_t *uMode = fossil_utf8_to_unicode(zMode);
| > > > > > > > > > > > > > > > > > > > | 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 |
fossil_unicode_free(uName);
#else
char *zValue = getenv(zName);
#endif
if( zValue ) zValue = fossil_filename_to_utf8(zValue);
return zValue;
}
/*
** Sets the value of an environment variable as UTF8.
*/
int fossil_setenv(const char *zName, const char *zValue){
int rc;
char *zString = mprintf("%s=%s", zName, zValue);
#ifdef _WIN32
wchar_t *uString = fossil_utf8_to_unicode(zString);
rc = _wputenv(uString);
fossil_unicode_free(uString);
fossil_free(zString);
#else
rc = putenv(zString);
/* NOTE: Cannot free the string on POSIX. */
/* fossil_free(zString); */
#endif
return rc;
}
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
wchar_t *uMode = fossil_utf8_to_unicode(zMode);
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
213 214 215 216 217 218 219 |
zOut = mprintf(
"[%S] %s (user: %s, artifact: [%S], branch: %s)",
zCiUuid, zCom, zUser, zFileUuid, zBr);
comment_print(zOut, zCom, 11, iWidth, g.comFmtFlags);
fossil_free(zOut);
}else{
blob_reset(&line);
| | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
zOut = mprintf(
"[%S] %s (user: %s, artifact: [%S], branch: %s)",
zCiUuid, zCom, zUser, zFileUuid, zBr);
comment_print(zOut, zCom, 11, iWidth, g.comFmtFlags);
fossil_free(zOut);
}else{
blob_reset(&line);
blob_appendf(&line, "%S ", zCiUuid);
blob_appendf(&line, "%.10s ", zDate);
blob_appendf(&line, "%8.8s ", zUser);
blob_appendf(&line, "%8.8s ", zBr);
blob_appendf(&line,"%-39.39s", zCom );
comment_print(blob_str(&line), zCom, 0, iWidth, g.comFmtFlags);
}
}
|
| ︙ | ︙ | |||
282 283 284 285 286 287 288 | ** ** a=DATE Only show changes after DATE ** b=DATE Only show changes before DATE ** n=NUM Show the first NUM changes only ** brbg Background color by branch name ** ubg Background color by user name ** ci=UUID Ancestors of a particular check-in | < | > < > | < < < > > > > > > > > > > > > > > | | | < < < < < < < < < < < < < < < | | < < < < | > > > > > > > | < > > | > < < < < < < < < < < | > > > | 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 |
**
** a=DATE Only show changes after DATE
** b=DATE Only show changes before DATE
** n=NUM Show the first NUM changes only
** brbg Background color by branch name
** ubg Background color by user name
** ci=UUID Ancestors of a particular check-in
*/
void finfo_page(void){
Stmt q;
const char *zFilename;
char zPrevDate[20];
const char *zA;
const char *zB;
int n;
int baseCheckin;
int fnid;
Bag ancestor;
Blob title;
Blob sql;
HQuery url;
GraphContext *pGraph;
int brBg = P("brbg")!=0;
int uBg = P("ubg")!=0;
int fDebug = atoi(PD("debug","0"));
int fShowId = P("showid")!=0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("File History");
login_anonymous_available();
url_initialize(&url, "finfo");
if( brBg ) url_add_parameter(&url, "brbg", 0);
if( uBg ) url_add_parameter(&url, "ubg", 0);
baseCheckin = name_to_rid_www("ci");
zPrevDate[0] = 0;
zFilename = PD("name","");
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
if( fnid==0 ){
@ No such file: %h(zFilename)
style_footer();
return;
}
if( baseCheckin ){
int baseFid = db_int(0,
"SELECT fid FROM mlink WHERE fnid=%d AND mid=%d",
fnid, baseCheckin
);
bag_init(&ancestor);
if( baseFid ) bag_insert(&ancestor, baseFid);
}
url_add_parameter(&url, "name", zFilename);
blob_zero(&sql);
blob_append_sql(&sql,
"SELECT"
" datetime(min(event.mtime)%s)," /* Date of change */
" coalesce(event.ecomment, event.comment)," /* Check-in comment */
" coalesce(event.euser, event.user)," /* User who made chng */
" mlink.pid," /* Parent file rid */
" mlink.fid," /* File rid */
" (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
" event.bgcolor," /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid)," /* Branchname */
" mlink.mid," /* check-in ID */
" mlink.pfnid" /* Previous filename */
" FROM mlink, event"
" WHERE mlink.fnid=%d"
" AND event.objid=mlink.mid",
timeline_utc(), TAG_BRANCH, fnid
);
if( (zA = P("a"))!=0 ){
blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA);
url_add_parameter(&url, "a", zA);
}
if( (zB = P("b"))!=0 ){
blob_append_sql(&sql, " AND event.mtime<=julianday('%q')", zB);
url_add_parameter(&url, "b", zB);
}
/* We only want each version of a file to appear on the graph once,
** at its earliest appearance. All the other times that it gets merged
** into this or that branch can be ignored. An exception is for when
** files are deleted (when they have mlink.fid==0). If the same file
** is deleted in multiple places, we want to show each deletion, so
** use a "fake fid" which is derived from the parent-fid for grouping.
** The same fake-fid must be used on the graph.
*/
blob_append_sql(&sql,
" GROUP BY"
" CASE WHEN mlink.fid>0 THEN mlink.fid ELSE mlink.pid+1000000000 END"
" ORDER BY event.mtime DESC /*sort*/"
);
if( (n = atoi(PD("n","0")))>0 ){
blob_append_sql(&sql, " LIMIT %d", n);
url_add_parameter(&url, "n", P("n"));
}
db_prepare(&q, "%s", blob_sql_text(&sql));
if( P("showsql")!=0 ){
@ <p>SQL: %h(blob_str(&sql))</p>
}
blob_reset(&sql);
blob_zero(&title);
if( baseCheckin ){
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", baseCheckin);
char *zLink = href("%R/info/%!S", zUuid);
blob_appendf(&title, "Ancestors of file ");
hyperlinked_path(zFilename, &title, zUuid, "tree", "");
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
blob_appendf(&title, " from check-in %z%S</a>", zLink, zUuid);
if( fShowId ) blob_appendf(&title, " (%d)", baseCheckin);
fossil_free(zUuid);
}else{
blob_appendf(&title, "History of files named ");
hyperlinked_path(zFilename, &title, 0, "tree", "");
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
}
@ <h2>%b(&title)</h2>
blob_reset(&title);
pGraph = graph_init();
@ <div id="canvas" style="position:relative;width:1px;height:1px;"
@ onclick="clickOnGraph(event)"></div>
@ <table id="timelineTable" class="timelineTable">
|
| ︙ | ︙ | |||
420 421 422 423 424 425 426 427 428 429 430 431 432 |
const char *zCkin = db_column_text(&q,7);
const char *zBgClr = db_column_text(&q, 8);
const char *zBr = db_column_text(&q, 9);
int fmid = db_column_int(&q, 10);
int pfnid = db_column_int(&q, 11);
int gidx;
char zTime[10];
if( zBr==0 ) zBr = "trunk";
if( uBg ){
zBgClr = hash_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr);
}
| > > > > > > > > > > > > > > > > > > > | > | | > > > > > > > | | | | | | | | > > | > > > | | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
const char *zCkin = db_column_text(&q,7);
const char *zBgClr = db_column_text(&q, 8);
const char *zBr = db_column_text(&q, 9);
int fmid = db_column_int(&q, 10);
int pfnid = db_column_int(&q, 11);
int gidx;
char zTime[10];
int nParent = 0;
int aParent[GR_MAX_RAIL];
static Stmt qparent;
if( baseCheckin && frid && !bag_find(&ancestor, frid) ) continue;
db_static_prepare(&qparent,
"SELECT DISTINCT pid FROM mlink"
" WHERE fid=:fid AND mid=:mid AND pid>0 AND fnid=:fnid"
" ORDER BY isaux /*sort*/"
);
db_bind_int(&qparent, ":fid", frid);
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
aParent[nParent] = db_column_int(&qparent, 0);
if( baseCheckin ) bag_insert(&ancestor, aParent[nParent]);
nParent++;
}
db_reset(&qparent);
if( zBr==0 ) zBr = "trunk";
if( uBg ){
zBgClr = hash_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr);
}
gidx = graph_add_row(pGraph, frid>0 ? frid : fpid+1000000000,
nParent, aParent, zBr, zBgClr,
zUuid, 0);
if( strncmp(zDate, zPrevDate, 10) ){
sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
@ <tr><td>
@ <div class="divider">%s(zPrevDate)</div>
@ </td><td></td><td></td></tr>
}
memcpy(zTime, &zDate[11], 5);
zTime[5] = 0;
@ <tr><td class="timelineTime">
@ %z(href("%R/timeline?c=%t",zDate))%s(zTime)</a></td>
@ <td class="timelineGraph"><div id="m%d(gidx)"></div></td>
if( zBgClr && zBgClr[0] ){
@ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
}else{
@ <td class="timelineTableCell">
}
if( zUuid ){
if( nParent==0 ){
@ <b>Added</b>
}else if( pfnid ){
char *zPrevName = db_text(0, "SELECT name FROM filename WHERE fnid=%d",
pfnid);
@ <b>Renamed</b> from
@ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName)</a>
}
@ %z(href("%R/artifact/%!S",zUuid))[%S(zUuid)]</a>
if( fShowId ){
@ (%d(frid))
}
@ part of check-in
}else{
char *zNewName;
zNewName = db_text(0,
"SELECT name FROM filename WHERE fnid = "
" (SELECT fnid FROM mlink"
" WHERE mid=%d"
" AND pfnid IN (SELECT fnid FROM filename WHERE name=%Q))",
fmid, zFilename);
if( zNewName ){
@ <b>Renamed</b> to
@ %z(href("%R/finfo?name=%t",zNewName))%h(zNewName)</a> by check-in
fossil_free(zNewName);
}else{
@ <b>Deleted</b> by check-in
}
}
hyperlink_to_uuid(zCkin);
if( fShowId ){
@ (%d(fmid))
}
@ %W(zCom) (user:
hyperlink_to_user(zUser, zDate, "");
@ branch: %z(href("%R/timeline?t=%T&n=200",zBr))%h(zBr)</a>)
if( g.perm.Hyperlink && zUuid ){
const char *z = zFilename;
@ %z(href("%R/annotate?filename=%h&checkin=%s",z,zCkin))
@ [annotate]</a>
@ %z(href("%R/blame?filename=%h&checkin=%s",z,zCkin))
@ [blame]</a>
@ %z(href("%R/timeline?n=200&uf=%!S",zUuid))[checkins using]</a>
if( fpid ){
@ %z(href("%R/fdiff?sbs=1&v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
}
}
if( fDebug & FINFO_DEBUG_MLINK ){
int ii;
char *zAncLink;
@ <br>fid=%d(frid) pid=%d(fpid) mid=%d(fmid)
if( nParent>0 ){
@ parents=%d(aParent[0])
for(ii=1; ii<nParent; ii++){
@ %d(aParent[ii])
}
}
zAncLink = href("%R/finfo?name=%T&ci=%!S&debug=1",zFilename,zCkin);
@ %z(zAncLink)[ancestry]</a>
}
tag_private_status(frid);
@ </td></tr>
}
db_finalize(&q);
if( pGraph ){
graph_finish(pGraph, 1);
if( pGraph->nErr ){
graph_free(pGraph);
pGraph = 0;
}else{
int w = (pGraph->mxRail+1)*pGraph->iRailPitch + 10;
@ <tr><td></td><td>
@ <div id="grbtm" style="width:%d(w)px;"></div>
|
| ︙ | ︙ |
Changes to src/glob.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 |
char *glob_expr(const char *zVal, const char *zGlobList){
Blob expr;
const char *zSep = "(";
int nTerm = 0;
int i;
int cTerm;
| | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
char *glob_expr(const char *zVal, const char *zGlobList){
Blob expr;
const char *zSep = "(";
int nTerm = 0;
int i;
int cTerm;
if( zGlobList==0 || zGlobList[0]==0 ) return fossil_strdup("0");
blob_zero(&expr);
while( zGlobList[0] ){
while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ){
zGlobList++; /* Skip leading commas, spaces, and newlines */
}
if( zGlobList[0]==0 ) break;
if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
|
| ︙ | ︙ | |||
71 72 73 74 75 76 77 |
if( zGlobList[0] ) zGlobList++;
nTerm++;
}
if( nTerm ){
blob_appendf(&expr, ")");
return blob_str(&expr);
}else{
| | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
if( zGlobList[0] ) zGlobList++;
nTerm++;
}
if( nTerm ){
blob_appendf(&expr, ")");
return blob_str(&expr);
}else{
return fossil_strdup("0");
}
}
#if INTERFACE
/*
** A Glob object holds a set of patterns read to be matched against
** a string.
|
| ︙ | ︙ |
Changes to src/graph.c.
| ︙ | ︙ | |||
376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
if( hashFind(p, pRow->aParent[i])==0 ){
pRow->aParent[i] = pRow->aParent[--pRow->nParent];
i--;
}
}
}
}
/* Find the pChild pointer for each node.
**
** The pChild points to the node directly above on the same rail.
** The pChild must be in the same branch. Leaf nodes have a NULL
** pChild.
| > > > > > > > > > > > > > > > > > > > > > | 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 |
if( hashFind(p, pRow->aParent[i])==0 ){
pRow->aParent[i] = pRow->aParent[--pRow->nParent];
i--;
}
}
}
}
/* If the primary parent is in a different branch, but there are
** other parents in the same branch, reorder the parents to make
** the parent from the same branch the primary parent.
*/
for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
if( pRow->isDup ) continue;
if( pRow->nParent<2 ) continue; /* Not a fork */
pParent = hashFind(p, pRow->aParent[0]);
if( pParent==0 ) continue; /* Parent off-screen */
if( pParent->zBranch==pRow->zBranch ) continue; /* Same branch */
for(i=1; i<pRow->nParent; i++){
pParent = hashFind(p, pRow->aParent[i]);
if( pParent && pParent->zBranch==pRow->zBranch ){
int t = pRow->aParent[0];
pRow->aParent[0] = pRow->aParent[i];
pRow->aParent[i] = t;
break;
}
}
}
/* Find the pChild pointer for each node.
**
** The pChild points to the node directly above on the same rail.
** The pChild must be in the same branch. Leaf nodes have a NULL
** pChild.
|
| ︙ | ︙ |
Changes to src/http.c.
| ︙ | ︙ | |||
153 154 155 156 157 158 159 |
prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x);
c = blob_str(&x)[0];
blob_reset(&x);
return ( c!='n' && c!='N' );
}
/*
| | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x);
c = blob_str(&x)[0];
blob_reset(&x);
return ( c!='n' && c!='N' );
}
/*
** Get the HTTP Basic Authorization credentials from the user
** when 401 is received.
*/
char *prompt_for_httpauth_creds(void){
Blob x;
char *zUser;
char *zPw;
char *zPrompt;
|
| ︙ | ︙ | |||
264 265 266 267 268 269 270 | ** Send the request to the server. */ transport_send(&g.url, &hdr); transport_send(&g.url, &payload); blob_reset(&hdr); blob_reset(&payload); transport_flip(&g.url); | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
** Send the request to the server.
*/
transport_send(&g.url, &hdr);
transport_send(&g.url, &payload);
blob_reset(&hdr);
blob_reset(&payload);
transport_flip(&g.url);
/*
** Read and interpret the server reply
*/
closeConnection = 1;
iLength = -1;
while( (zLine = transport_receive_line(&g.url))!=0 && zLine[0]!=0 ){
/* printf("[%s]\n", zLine); fflush(stdout); */
|
| ︙ | ︙ | |||
331 332 333 334 335 336 337 |
goto write_err;
}
for(i=9; zLine[i] && zLine[i]==' '; i++){}
if( zLine[i]==0 ){
fossil_warning("malformed redirect: %s", zLine);
goto write_err;
}
| | | | 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 |
goto write_err;
}
for(i=9; zLine[i] && zLine[i]==' '; i++){}
if( zLine[i]==0 ){
fossil_warning("malformed redirect: %s", zLine);
goto write_err;
}
j = strlen(zLine) - 1;
while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){
j -= 4;
zLine[j] = 0;
}
transport_close(&g.url);
transport_global_shutdown(&g.url);
fossil_print("redirect with status %d to %s\n", rc, &zLine[i]);
url_parse(&zLine[i], 0);
fSeenHttpAuth = 0;
if( g.zHttpAuth ) free(g.zHttpAuth);
g.zHttpAuth = get_httpauth();
return http_exchange(pSend, pReply, useLogin, maxRedirect);
}else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
isCompressed = 0;
}else if( fossil_strnicmp(&zLine[14],
"application/x-fossil-uncompressed", -1)==0 ){
isCompressed = 0;
}else if( fossil_strnicmp(&zLine[14], "application/x-fossil", -1)!=0 ){
isError = 1;
}
}
}
|
| ︙ | ︙ | |||
409 410 411 412 413 414 415 |
if( closeConnection ){
transport_close(&g.url);
}else{
transport_rewind(&g.url);
}
return 0;
| | | | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
if( closeConnection ){
transport_close(&g.url);
}else{
transport_rewind(&g.url);
}
return 0;
/*
** Jump to here if an error is seen.
*/
write_err:
transport_close(&g.url);
return 1;
}
|
Changes to src/http_socket.c.
| ︙ | ︙ | |||
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 | ** Low-level sockets are abstracted out into this module because they ** are handled different on Unix and windows. */ #include "config.h" #include "http_socket.h" #if defined(_WIN32) # include <winsock2.h> # include <ws2tcpip.h> #else # include <netinet/in.h> # include <arpa/inet.h> # include <sys/socket.h> # include <netdb.h> #endif #include <assert.h> #include <sys/types.h> #include <signal.h> /* ** There can only be a single socket connection open at a time. ** State information about that socket is stored in the following ** local variables: */ static int socketIsInit = 0; /* True after global initialization */ | > > > < | 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 | ** Low-level sockets are abstracted out into this module because they ** are handled different on Unix and windows. */ #include "config.h" #include "http_socket.h" #if defined(_WIN32) # if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0501 # endif # include <winsock2.h> # include <ws2tcpip.h> #else # include <netinet/in.h> # include <arpa/inet.h> # include <sys/socket.h> # include <netdb.h> #endif #include <assert.h> #include <sys/types.h> #include <signal.h> /* ** There can only be a single socket connection open at a time. ** State information about that socket is stored in the following ** local variables: */ static int socketIsInit = 0; /* True after global initialization */ #if defined(_WIN32) static WSADATA socketInfo; /* Windows socket initialize data */ #endif static int iSocket = -1; /* The socket on which we talk to the server */ static char *socketErrMsg = 0; /* Text of most recent socket error */ |
| ︙ | ︙ | |||
104 105 106 107 108 109 110 |
if( socketIsInit ){
#if defined(_WIN32)
WSACleanup();
#endif
socket_clear_errmsg();
socketIsInit = 0;
}
| < | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
if( socketIsInit ){
#if defined(_WIN32)
WSACleanup();
#endif
socket_clear_errmsg();
socketIsInit = 0;
}
}
/*
** Close the currently open socket. If no socket is open, this routine
** is a no-op.
*/
void socket_close(void){
|
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
**
** pUrlDAta->name Name of the server. Ex: www.fossil-scm.org
** pUrlDAta->port TCP/IP port to use. Ex: 80
**
** Return the number of errors.
*/
int socket_open(UrlData *pUrlData){
| > > | > > > < | > | > > | < < < < | | < < < < | | | > > > > > > | > > > > | < < < < | < < < < | | < | > > > | | 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 |
**
** pUrlDAta->name Name of the server. Ex: www.fossil-scm.org
** pUrlDAta->port TCP/IP port to use. Ex: 80
**
** Return the number of errors.
*/
int socket_open(UrlData *pUrlData){
int rc = 0;
struct addrinfo *ai = 0;
struct addrinfo *p;
struct addrinfo hints;
char zPort[30];
char zRemote[NI_MAXHOST];
socket_global_init();
memset(&hints, 0, sizeof(struct addrinfo));
assert( iSocket<0 );
hints.ai_family = g.fIPv4 ? AF_INET : AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
sqlite3_snprintf(sizeof(zPort),zPort,"%d", pUrlData->port);
rc = getaddrinfo(pUrlData->name, zPort, &hints, &ai);
if( rc ){
socket_set_errmsg("getaddrinfo() fails: %s", gai_strerror(rc));
goto end_socket_open;
}
for(p=ai; p; p=p->ai_next){
iSocket = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if( iSocket<0 ) continue;
if( connect(iSocket,p->ai_addr,p->ai_addrlen)<0 ){
socket_close();
continue;
}
rc = getnameinfo(p->ai_addr, p->ai_addrlen, zRemote, sizeof(zRemote),
0, 0, NI_NUMERICHOST);
if( rc ){
socket_set_errmsg("getnameinfo() failed: %s", gai_strerror(rc));
goto end_socket_open;
}
g.zIpAddr = mprintf("%s", zRemote);
break;
}
if( p==0 ){
socket_set_errmsg("cannot connect to host %s:%d", pUrlData->name,
pUrlData->port);
rc = 1;
}
#if !defined(_WIN32)
signal(SIGPIPE, SIG_IGN);
#endif
end_socket_open:
if( rc && iSocket>=0 ) socket_close();
if( ai ) freeaddrinfo(ai);
return rc;
}
/*
** Send content out over the open socket connection.
*/
size_t socket_send(void *NotUsed, void *pContent, size_t N){
size_t sent;
|
| ︙ | ︙ | |||
218 219 220 221 222 223 224 |
/*
** Attempt to resolve pUrlData->name to an IP address and setup g.zIpAddr
** so rcvfrom gets populated. For hostnames with more than one IP (or
** if overridden in ~/.ssh/config) the rcvfrom may not match the host
** to which we connect.
*/
void socket_ssh_resolve_addr(UrlData *pUrlData){
| | | > > > > > > > > > | | < | < | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
/*
** Attempt to resolve pUrlData->name to an IP address and setup g.zIpAddr
** so rcvfrom gets populated. For hostnames with more than one IP (or
** if overridden in ~/.ssh/config) the rcvfrom may not match the host
** to which we connect.
*/
void socket_ssh_resolve_addr(UrlData *pUrlData){
struct addrinfo *ai = 0;
struct addrinfo hints;
char zRemote[NI_MAXHOST];
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
if( getaddrinfo(pUrlData->name, NULL, &hints, &ai)==0
&& ai!=0
&& getnameinfo(ai->ai_addr, ai->ai_addrlen, zRemote,
sizeof(zRemote), 0, 0, NI_NUMERICHOST)==0 ){
g.zIpAddr = mprintf("%s (%s)", zRemote, pUrlData->name);
}
if( ai ) freeaddrinfo(ai);
if( g.zIpAddr==0 ){
g.zIpAddr = mprintf("%s", pUrlData->name);
}
}
|
Changes to src/http_transport.c.
| ︙ | ︙ | |||
85 86 87 88 89 90 91 |
static char zDefaultSshCmd[] = "ssh -e none -T";
#endif
/*
** SSH initialization of the transport layer
*/
int transport_ssh_open(UrlData *pUrlData){
| | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
static char zDefaultSshCmd[] = "ssh -e none -T";
#endif
/*
** SSH initialization of the transport layer
*/
int transport_ssh_open(UrlData *pUrlData){
/* For SSH we need to create and run SSH fossil http
** to talk to the remote machine.
*/
const char *zSsh; /* The base SSH command */
Blob zCmd; /* The SSH command */
char *zHost; /* The host name to contact */
int n; /* Size of prefix string */
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
718 719 720 721 722 723 724 |
fossil_fatal("bad fast-import line: [%s]", zLine);
return;
}
/*
** COMMAND: import
**
| | | > | > | > | < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | > | 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
fossil_fatal("bad fast-import line: [%s]", zLine);
return;
}
/*
** COMMAND: import
**
** Usage: %fossil import ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?
**
** Read interchange format generated by another VCS and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY
** argument. If no input file is supplied the interchange format
** data is read from standard input.
**
** The git-fast-export file format is currently the only VCS interchange
** format that is understood, though other interchange formats may be added
** in the future.
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
** Options:
** --git import from the git-fast-export file format (default)
** --incremental allow importing into an existing repository
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
int incrFlag = find_option("incremental", "i", 0)!=0;
int svnFlag = find_option("svn", 0, 0)!=0;
find_option("git",0,0); /* Skip the --git option for now */
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
pIn = fossil_fopen(g.argv[3], "rb");
}else{
pIn = stdin;
fossil_binary_mode(pIn);
}
if( !incrFlag ){
if( forceFlag ) file_delete(g.argv[2]);
db_create_repository(g.argv[2]);
}
db_open_repository(g.argv[2]);
db_open_config(0);
db_begin_transaction();
if( !incrFlag ) db_initial_setup(0, 0, 0, 1);
if( svnFlag ){
fossil_fatal("--svn format not implemented yet");
}else{
/* The following temp-tables are used to hold information needed for
** the import.
**
** The XMARK table provides a mapping from fast-import "marks" and symbols
** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
** Given any valid fast-import symbol, the corresponding fossil rid and
** uuid can found by searching against the xmark.tname field.
**
** The XBRANCH table maps commit marks and symbols into the branch those
** commits belong to. If xbranch.tname is a fast-import symbol for a
** checkin then xbranch.brnm is the branch that checkin is part of.
**
** The XTAG table records information about tags that need to be applied
** to various branches after the import finishes. The xtag.tcontent field
** contains the text of an artifact that will add a tag to a check-in.
** The git-fast-export file format might specify the same tag multiple
** times but only the last tag should be used. And we do not know which
** occurrence of the tag is the last until the import finishes.
*/
db_multi_exec(
"CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT, tuuid TEXT);"
"CREATE TEMP TABLE xbranch(tname TEXT UNIQUE, brnm TEXT);"
"CREATE TEMP TABLE xtag(tname TEXT UNIQUE, tcontent TEXT);"
);
git_fast_import(pIn);
db_prepare(&q, "SELECT tcontent FROM xtag");
while( db_step(&q)==SQLITE_ROW ){
Blob record;
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0);
import_reset(0);
}
db_finalize(&q);
}
db_end_transaction(0);
db_begin_transaction();
fossil_print("Rebuilding repository meta-data...\n");
rebuild_db(0, 1, !incrFlag);
verify_cancel();
db_end_transaction(0);
fossil_print("Vacuuming..."); fflush(stdout);
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
196 197 198 199 200 201 202 |
void info_cmd(void){
i64 fsize;
int verboseFlag = find_option("verbose","v",0)!=0;
if( !verboseFlag ){
verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
}
| < < < > | 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 |
void info_cmd(void){
i64 fsize;
int verboseFlag = find_option("verbose","v",0)!=0;
if( !verboseFlag ){
verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
}
if( g.argc==3 && (fsize = file_size(g.argv[2]))>0 && (fsize&0x1ff)==0 ){
db_open_config(0);
db_open_repository(g.argv[2]);
db_record_repository_filename(g.argv[2]);
fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>"));
fossil_print("project-code: %s\n", db_get("project-code", "<none>"));
extraRepoInfo();
return;
}
db_find_and_open_repository(0,0);
verify_all_options();
if( g.argc==2 ){
int vid;
/* 012345678901234 */
db_record_repository_filename(0);
fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>"));
if( g.localOpen ){
fossil_print("repository: %s\n", db_repository_filename());
|
| ︙ | ︙ | |||
240 241 242 243 244 245 246 |
fossil_fatal("no such object: %s\n", g.argv[2]);
}
show_common_info(rid, "uuid:", 1, 1);
}
}
/*
| | | | | | 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 |
fossil_fatal("no such object: %s\n", g.argv[2]);
}
show_common_info(rid, "uuid:", 1, 1);
}
}
/*
** Show information about all tags on a given check-in.
*/
static void showTags(int rid){
Stmt q;
int cnt = 0;
db_prepare(&q,
"SELECT tag.tagid, tagname, "
" (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
" value, datetime(tagxref.mtime%s), tagtype,"
" (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
" FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
" WHERE tagxref.rid=%d"
" ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid
);
while( db_step(&q)==SQLITE_ROW ){
const char *zTagname = db_column_text(&q, 1);
const char *zSrcUuid = db_column_text(&q, 2);
const char *zValue = db_column_text(&q, 3);
const char *zDate = db_column_text(&q, 4);
int tagtype = db_column_int(&q, 5);
|
| ︙ | ︙ | |||
305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
@ </li>
}
db_finalize(&q);
if( cnt ){
@ </ul>
}
}
/*
** Append the difference between artifacts to the output
*/
static void append_diff(
const char *zFrom, /* Diff from this artifact */
| > > > > > > > > > > > > > > > > > > > > > > > | 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 |
@ </li>
}
db_finalize(&q);
if( cnt ){
@ </ul>
}
}
/*
** Show the context graph (immediate parents and children) for
** check-in rid.
*/
static void showContext(int rid){
Blob sql;
Stmt q;
@ <div class="section">Context</div>
blob_zero(&sql);
blob_append(&sql, timeline_query_for_www(), -1);
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
"INSERT INTO ok VALUES(%d);"
"INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
"INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
rid, rid, rid
);
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
db_prepare(&q, "%s", blob_sql_text(&sql));
www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH, 0, 0, rid, 0);
db_finalize(&q);
}
/*
** Append the difference between artifacts to the output
*/
static void append_diff(
const char *zFrom, /* Diff from this artifact */
|
| ︙ | ︙ | |||
380 381 382 383 384 385 386 |
if( diffFlags ){
append_diff(zOld, zNew, diffFlags, pRe);
}
}else{
if( zOld && zNew ){
if( fossil_strcmp(zOld, zNew)!=0 ){
@ <p>Modified %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
| | | | | | | | 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 |
if( diffFlags ){
append_diff(zOld, zNew, diffFlags, pRe);
}
}else{
if( zOld && zNew ){
if( fossil_strcmp(zOld, zNew)!=0 ){
@ <p>Modified %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
@ from %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>
@ to %z(href("%R/artifact/%!S",zNew))[%S(zNew)]</a>.
}else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@ <p>Name change
@ from %z(href("%R/finfo?name=%T",zOldName))%h(zOldName)</a>
@ to %z(href("%R/finfo?name=%T",zName))%h(zName)</a>.
}else{
@ <p>Execute permission %s(( mperm==PERM_EXE )?"set":"cleared") for
@ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
}
}else if( zOld ){
@ <p>Deleted %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
@ version %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>
}else{
@ <p>Added %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
@ version %z(href("%R/artifact/%!S",zNew))[%S(zNew)]</a>
}
if( diffFlags ){
append_diff(zOld, zNew, diffFlags, pRe);
}else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
@
@ %z(href("%R/fdiff?v1=%!S&v2=%!S&sbs=1",zOld,zNew))[diff]</a>
}
}
}
/*
** Generate javascript to enhance HTML diffs.
*/
|
| ︙ | ︙ | |||
504 505 506 507 508 509 510 | const char *zRe; /* regex parameter */ ReCompiled *pRe = 0; /* regex */ const char *zW; /* URL param for ignoring whitespace */ const char *zPage = "vinfo"; /* Page that shows diffs */ const char *zPageHide = "ci"; /* Page that hides diffs */ login_check_credentials(); | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
const char *zRe; /* regex parameter */
ReCompiled *pRe = 0; /* regex */
const char *zW; /* URL param for ignoring whitespace */
const char *zPage = "vinfo"; /* Page that shows diffs */
const char *zPageHide = "ci"; /* Page that hides diffs */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
zName = P("name");
rid = name_to_rid_www("name");
if( rid==0 ){
style_header("Check-in Information Error");
@ No such object: %h(g.argv[2])
style_footer();
return;
|
| ︙ | ︙ | |||
612 613 614 615 616 617 618 |
zPJ = blob_str(&projName);
for(jj=0; zPJ[jj]; jj++){
if( (zPJ[jj]>0 && zPJ[jj]<' ') || strchr("\"*/:<>?\\|", zPJ[jj]) ){
zPJ[jj] = '_';
}
}
@ <tr><th>Timelines:</th><td>
| | | | | | | | | | | | | | > | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
zPJ = blob_str(&projName);
for(jj=0; zPJ[jj]; jj++){
if( (zPJ[jj]>0 && zPJ[jj]<' ') || strchr("\"*/:<>?\\|", zPJ[jj]) ){
zPJ[jj] = '_';
}
}
@ <tr><th>Timelines:</th><td>
@ %z(href("%R/timeline?f=%!S&unhide",zUuid))family</a>
if( zParent ){
@ | %z(href("%R/timeline?p=%!S&unhide",zUuid))ancestors</a>
}
if( !isLeaf ){
@ | %z(href("%R/timeline?d=%!S&unhide",zUuid))descendants</a>
}
if( zParent && !isLeaf ){
@ | %z(href("%R/timeline?dp=%!S&unhide",zUuid))both</a>
}
db_prepare(&q2,"SELECT substr(tag.tagname,5) FROM tagxref, tag "
" WHERE rid=%d AND tagtype>0 "
" AND tag.tagid=tagxref.tagid "
" AND +tag.tagname GLOB 'sym-*'", rid);
while( db_step(&q2)==SQLITE_ROW ){
const char *zTagName = db_column_text(&q2, 0);
@ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
}
db_finalize(&q2);
/* The Download: line */
if( g.anon.Zip ){
char *zUrl = mprintf("%R/tarball/%t-%S.tar.gz?uuid=%s",
zPJ, zUuid, zUuid);
@ </td></tr>
@ <tr><th>Downloads:</th><td>
@ %z(href("%s",zUrl))Tarball</a>
@ | %z(href("%R/zip/%t-%S.zip?uuid=%!S",zPJ,zUuid,zUuid))
@ ZIP archive</a>
fossil_free(zUrl);
}
@ </td></tr>
@ <tr><th>Other Links:</th>
@ <td>
@ %z(href("%R/tree?ci=%!S",zUuid))files</a>
@ | %z(href("%R/fileage?name=%!S",zUuid))file ages</a>
@ | %z(href("%R/tree?nofiles&type=tree&ci=%!S",zUuid))folders</a>
@ | %z(href("%R/artifact/%!S",zUuid))manifest</a>
if( g.anon.Write ){
@ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a>
}
@ </td>
@ </tr>
blob_reset(&projName);
}
@ </table>
}else{
style_header("Check-in Information");
login_anonymous_available();
}
db_finalize(&q1);
showTags(rid);
showContext(rid);
@ <div class="section">Changes</div>
@ <div class="sectionmenu">
verboseFlag = g.zPath[0]!='c';
if( db_get_boolean("show-version-diffs", 0)==0 ){
verboseFlag = !verboseFlag;
zPage = "ci";
zPageHide = "vinfo";
|
| ︙ | ︙ | |||
699 700 701 702 703 704 705 |
}else{
@ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
@ Show Unified Diffs</a>
@ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
@ Show Side-by-Side Diffs</a>
}
if( zParent ){
| | | | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
}else{
@ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
@ Show Unified Diffs</a>
@ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
@ Show Side-by-Side Diffs</a>
}
if( zParent ){
@ %z(xhref("class='button'","%R/vpatch?from=%!S&to=%!S",zParent,zUuid))
@ Patch</a>
}
@</div>
if( pRe ){
@ <p><b>Only differences that match regular expression "%h(zRe)"
@ are shown.</b></p>
}
db_prepare(&q3,
"SELECT name,"
" mperm,"
" (SELECT uuid FROM blob WHERE rid=mlink.pid),"
" (SELECT uuid FROM blob WHERE rid=mlink.fid),"
" (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
" WHERE mlink.mid=%d AND NOT mlink.isaux"
" AND (mlink.fid>0"
" OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
" ORDER BY name /*sort*/",
rid, rid
);
while( db_step(&q3)==SQLITE_ROW ){
const char *zName = db_column_text(&q3,0);
|
| ︙ | ︙ | |||
749 750 751 752 753 754 755 | char *zUuid; char *zDate; Blob wiki; int modPending; const char *zModAction; login_check_credentials(); | | | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
char *zUuid;
char *zDate;
Blob wiki;
int modPending;
const char *zModAction;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
rid = name_to_rid_www("name");
if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){
style_header("Wiki Page Information Error");
@ No such object: %h(P("name"))
style_footer();
return;
}
|
| ︙ | ︙ | |||
789 790 791 792 793 794 795 |
pWiki->zWikiTitle);
style_submenu_element("Page", "Page", "wiki?name=%t",
pWiki->zWikiTitle);
login_anonymous_available();
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
| | > > > | | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
pWiki->zWikiTitle);
style_submenu_element("Page", "Page", "wiki?name=%t",
pWiki->zWikiTitle);
login_anonymous_available();
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
if( g.perm.Setup ){
@ (%d(rid))
}
modPending = moderation_pending(rid);
if( modPending ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
@ </td></tr>
@ <tr><th>Page Name:</th><td>%h(pWiki->zWikiTitle)</td></tr>
@ <tr><th>Date:</th><td>
hyperlink_to_date(zDate, "</td></tr>");
@ <tr><th>Original User:</th><td>
hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>");
if( pWiki->zMimetype ){
@ <tr><th>Mimetype:</th><td>%h(pWiki->zMimetype)</td></tr>
}
if( pWiki->nParent>0 ){
int i;
@ <tr><th>Parent%s(pWiki->nParent==1?"":"s"):</th><td>
for(i=0; i<pWiki->nParent; i++){
char *zParent = pWiki->azParent[i];
@ %z(href("info/%!S",zParent))%s(zParent)</a>
}
@ </td></tr>
}
@ </table>
if( g.perm.ModWiki && modPending ){
@ <div class="section">Moderation</div>
|
| ︙ | ︙ | |||
830 831 832 833 834 835 836 |
@ </form>
@ </blockquote>
}
@ <div class="section">Content</div>
blob_init(&wiki, pWiki->zWiki, -1);
| | | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 |
@ </form>
@ </blockquote>
}
@ <div class="section">Content</div>
blob_init(&wiki, pWiki->zWiki, -1);
wiki_render_by_mimetype(&wiki, pWiki->zMimetype);
blob_reset(&wiki);
manifest_destroy(pWiki);
style_footer();
}
/*
** Show a webpage error message
|
| ︙ | ︙ | |||
967 968 969 970 971 972 973 | const char *zTo; const char *zRe; const char *zW; const char *zVerbose; const char *zGlob; ReCompiled *pRe = 0; login_check_credentials(); | | | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 |
const char *zTo;
const char *zRe;
const char *zW;
const char *zVerbose;
const char *zGlob;
ReCompiled *pRe = 0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
login_anonymous_available();
zRe = P("regex");
if( zRe ) re_compile(&pRe, zRe, 0);
zBranch = P("branch");
if( zBranch && zBranch[0] ){
cgi_replace_parameter("from", mprintf("root:%s", zBranch));
cgi_replace_parameter("to", zBranch);
|
| ︙ | ︙ | |||
1182 1183 1184 1185 1186 1187 1188 |
const char *zUser = db_column_text(&q, 3);
const char *zVers = db_column_text(&q, 4);
int mPerm = db_column_int(&q, 5);
const char *zBr = db_column_text(&q, 6);
int sameFilename = prevName!=0 && fossil_strcmp(zName,prevName)==0;
if( sameFilename && !showDetail ){
if( cnt==1 ){
| | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 |
const char *zUser = db_column_text(&q, 3);
const char *zVers = db_column_text(&q, 4);
int mPerm = db_column_int(&q, 5);
const char *zBr = db_column_text(&q, 6);
int sameFilename = prevName!=0 && fossil_strcmp(zName,prevName)==0;
if( sameFilename && !showDetail ){
if( cnt==1 ){
@ %z(href("%R/whatis/%!S",zUuid))[more...]</a>
}
cnt++;
continue;
}
if( !sameFilename ){
if( prevName && showDetail ) {
@ </ul>
}
if( mPerm==PERM_LNK ){
@ <li>Symbolic link
objType |= OBJTYPE_SYMLINK;
}else if( mPerm==PERM_EXE ){
@ <li>Executable file
|
| ︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 |
}
if( zBr && zBr[0] ){
@ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a>
}
@ — %!w(zCom) (user:
hyperlink_to_user(zUser,zDate,")");
if( g.perm.Hyperlink ){
| | | | | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 |
}
if( zBr && zBr[0] ){
@ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a>
}
@ — %!w(zCom) (user:
hyperlink_to_user(zUser,zDate,")");
if( g.perm.Hyperlink ){
@ %z(href("%R/finfo?name=%T&ci=%!S",zName,zVers))[ancestry]</a>
@ %z(href("%R/annotate?filename=%T&checkin=%!S",zName,zVers))
@ [annotate]</a>
@ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
@ [blame]</a>
}
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_append(pDownloadName, zName, -1);
}
}
|
| ︙ | ︙ | |||
1312 1313 1314 1315 1316 1317 1318 |
if( zType[0]!='e' ){
hyperlink_to_uuid(zUuid);
}
@ - %!w(zCom) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".");
if( pDownloadName && blob_size(pDownloadName)==0 ){
| | | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 |
if( zType[0]!='e' ){
hyperlink_to_uuid(zUuid);
}
@ - %!w(zCom) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".");
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_appendf(pDownloadName, "%S.txt", zUuid);
}
tag_private_status(rid);
cnt++;
}
db_finalize(&q);
}
db_prepare(&q,
|
| ︙ | ︙ | |||
1339 1340 1341 1342 1343 1344 1345 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
| | | | | | 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 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
if( g.perm.Hyperlink && g.anon.RdTkt ){
@ ticket [%z(href("%R/tktview?name=%!S",zTarget))%S(zTarget)</a>]
}else{
@ ticket [%S(zTarget)]
}
}else{
if( g.perm.Hyperlink && g.anon.RdWiki ){
@ wiki page [%z(href("%R/wiki?name=%t",zTarget))%h(zTarget)</a>]
}else{
@ wiki page [%h(zTarget)]
}
}
@ added by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate,".");
cnt++;
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_append(pDownloadName, zFilename, -1);
}
tag_private_status(rid);
}
db_finalize(&q);
if( cnt==0 ){
@ Control artifact.
if( pDownloadName && blob_size(pDownloadName)==0 ){
blob_appendf(pDownloadName, "%S.txt", zUuid);
}
tag_private_status(rid);
}
return objType;
}
|
| ︙ | ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | const char *zRe; const char *zW; /* URL param for ignoring whitespace */ ReCompiled *pRe = 0; u64 diffFlags; u32 objdescFlags = 0; login_check_credentials(); | | | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 |
const char *zRe;
const char *zW; /* URL param for ignoring whitespace */
ReCompiled *pRe = 0;
u64 diffFlags;
u32 objdescFlags = 0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
if( v1==0 || v2==0 ) fossil_redirect_home();
zRe = P("regex");
if( zRe ) re_compile(&pRe, zRe, 0);
if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
isPatch = P("patch")!=0;
|
| ︙ | ︙ | |||
1448 1449 1450 1451 1452 1453 1454 |
style_submenu_element("Unified Diff", "udiff",
"%s/fdiff?v1=%T&v2=%T&sbs=0%s",
g.zTop, P("v1"), P("v2"), zW);
}
if( P("smhdr")!=0 ){
@ <h2>Differences From Artifact
| | | | | | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
style_submenu_element("Unified Diff", "udiff",
"%s/fdiff?v1=%T&v2=%T&sbs=0%s",
g.zTop, P("v1"), P("v2"), zW);
}
if( P("smhdr")!=0 ){
@ <h2>Differences From Artifact
@ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To
@ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2>
}else{
@ <h2>Differences From
@ Artifact %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a>:</h2>
object_description(v1, objdescFlags, 0);
@ <h2>To Artifact %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>:</h2>
object_description(v2, objdescFlags, 0);
}
if( pRe ){
@ <b>Only differences that match regular expression "%h(zRe)"
@ are shown.</b>
}
@ <hr />
|
| ︙ | ︙ | |||
1482 1483 1484 1485 1486 1487 1488 |
int rid;
char *zUuid;
const char *zMime;
Blob content;
rid = name_to_rid_www("name");
login_check_credentials();
| | | 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 |
int rid;
char *zUuid;
const char *zMime;
Blob content;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( rid==0 ) fossil_redirect_home();
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
g.isConst = 1;
}
free(zUuid);
zMime = P("m");
|
| ︙ | ︙ | |||
1579 1580 1581 1582 1583 1584 1585 |
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
rid = name_to_rid_www("name");
login_check_credentials();
| | | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 |
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( rid==0 ) fossil_redirect_home();
if( g.perm.Admin ){
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( db_exists("SELECT 1 FROM shun WHERE uuid=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#delshun",
g.zTop, zUuid);
}else{
|
| ︙ | ︙ | |||
1765 1766 1767 1768 1769 1770 1771 |
rid = artifact_from_ci_and_filename_www();
}
if( rid==0 ){
rid = name_to_rid_www("name");
}
login_check_credentials();
| | | 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 |
rid = artifact_from_ci_and_filename_www();
}
if( rid==0 ){
rid = name_to_rid_www("name");
}
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( rid==0 ) fossil_redirect_home();
if( g.perm.Admin ){
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( db_exists("SELECT 1 FROM shun WHERE uuid=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun",
g.zTop, zUuid);
}else{
|
| ︙ | ︙ | |||
1880 1881 1882 1883 1884 1885 1886 | const char *zUuid; char zTktName[UUID_SIZE+1]; Manifest *pTktChng; int modPending; const char *zModAction; char *zTktTitle; login_check_credentials(); | | | 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 |
const char *zUuid;
char zTktName[UUID_SIZE+1];
Manifest *pTktChng;
int modPending;
const char *zModAction;
char *zTktTitle;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
rid = name_to_rid_www("name");
if( rid==0 ){ fossil_redirect_home(); }
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( g.perm.Admin ){
if( db_exists("SELECT 1 FROM shun WHERE uuid=%Q", zUuid) ){
style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun",
g.zTop, zUuid);
|
| ︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 |
style_submenu_element("Plaintext", "Plaintext",
"%R/info/%s?plaintext", zUuid);
}
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
| | | 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 |
style_submenu_element("Plaintext", "Plaintext",
"%R/info/%s?plaintext", zUuid);
}
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Artifact ID:</th>
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
if( g.perm.Setup ){
@ (%d(rid))
}
modPending = moderation_pending(rid);
if( modPending ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
|
| ︙ | ︙ | |||
2252 2253 2254 2255 2256 2257 2258 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ char *zUuid; Blob comment; char *zBranchName = 0; Stmt q; login_check_credentials(); | | | 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 |
const char *zChngTime = 0; /* Value of chngtime= query param, if any */
char *zUuid;
Blob comment;
char *zBranchName = 0;
Stmt q;
login_check_credentials();
if( !g.perm.Write ){ login_needed(g.anon.Write); return; }
rid = name_to_typed_rid(P("r"), "ci");
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
" FROM event WHERE objid=%d", rid);
if( zComment==0 ) fossil_redirect_home();
if( P("cancel") ){
cgi_redirectf("ci?name=%s", zUuid);
|
| ︙ | ︙ | |||
2454 2455 2456 2457 2458 2459 2460 |
@ will be overridden as: %s(date_in_standard_format(zChngTime))</p>
}
@ </blockquote>
@ <hr />
blob_reset(&suffix);
}
@ <p>Make changes to attributes of check-in
| | | 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 |
@ will be overridden as: %s(date_in_standard_format(zChngTime))</p>
}
@ </blockquote>
@ <hr />
blob_reset(&suffix);
}
@ <p>Make changes to attributes of check-in
@ [%z(href("%R/ci/%!S",zUuid))%s(zUuid)</a>]:</p>
form_begin(0, "%R/ci_edit");
login_insert_csrf_secret();
@ <div><input type="hidden" name="r" value="%s(zUuid)" />
@ <table border="0" cellspacing="10">
@ <tr><th align="right" valign="top">User:</th>
@ <td valign="top">
|
| ︙ | ︙ | |||
2572 2573 2574 2575 2576 2577 2578 |
@ </td></tr>
}else if( zBranchName ){
@ <tr><th align="right" valign="top">Branch Closure:</th>
@ <td valign="top">
@ <label><input type="checkbox" name="close"%s(zCloseFlag) />
@ Mark branch
@ <span style="font-weight:bold" id="cbranch">%h(zBranchName)</span>
| | < | 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 |
@ </td></tr>
}else if( zBranchName ){
@ <tr><th align="right" valign="top">Branch Closure:</th>
@ <td valign="top">
@ <label><input type="checkbox" name="close"%s(zCloseFlag) />
@ Mark branch
@ <span style="font-weight:bold" id="cbranch">%h(zBranchName)</span>
@ as "closed".</label>
@ </td></tr>
}
}
if( zBranchName ) fossil_free(zBranchName);
@ <tr><td colspan="2">
|
| ︙ | ︙ |
Changes to src/json_config.c.
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
{ "css", CONFIGSET_CSS },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
| < > > > > > > < > | 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 |
{ "css", CONFIGSET_CSS },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
{ "adunit", CONFIGSET_SKIN },
{ "adunit-omit-if-admin", CONFIGSET_SKIN },
{ "adunit-omit-if-user", CONFIGSET_SKIN },
{ "white-foreground", CONFIGSET_SKIN },
{ "project-name", CONFIGSET_PROJ },
{ "short-project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_PROJ },
{ "manifest", CONFIGSET_PROJ },
{ "binary-glob", CONFIGSET_PROJ },
{ "clean-glob", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-clean-x", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-change", CONFIGSET_TKT },
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
350 351 352 353 354 355 356 |
/* To logout, change the cookie value to an empty string */
cgi_set_cookie(cookie, "",
login_cookie_path(), -86400);
db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, "
" cexpire=0 WHERE uid=%d"
" AND login NOT IN ('anonymous','nobody',"
" 'developer','reader')", g.userUid);
| | | < < < < | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
/* To logout, change the cookie value to an empty string */
cgi_set_cookie(cookie, "",
login_cookie_path(), -86400);
db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, "
" cexpire=0 WHERE uid=%d"
" AND login NOT IN ('anonymous','nobody',"
" 'developer','reader')", g.userUid);
cgi_replace_parameter(cookie, NULL);
cgi_replace_parameter("anon", NULL);
}
}
/*
** Return true if the prefix of zStr matches zPattern. Return false if
** they are different.
**
|
| ︙ | ︙ | |||
449 450 451 452 453 454 455 |
rc = rc | (buf1[i] ^ buf2[i]);
}
}
sqlite3_result_int(context, rc);
}
/*
| | < | | | > > > > > > > > > | > > > > > > > > > > > | | 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 |
rc = rc | (buf1[i] ^ buf2[i]);
}
}
sqlite3_result_int(context, rc);
}
/*
** Return true if the current page was reached by a redirect from the /login
** page.
*/
int referred_from_login(void){
const char *zReferer = P("HTTP_REFERER");
char *zPattern;
int rc;
if( zReferer==0 ) return 0;
zPattern = mprintf("%s/login*", g.zBaseURL);
rc = sqlite3_strglob(zPattern, zReferer)==0;
fossil_free(zPattern);
return rc;
}
/*
** There used to be a page named "my" that was designed to show information
** about a specific user. The "my" page was linked from the "Logged in as USER"
** line on the title bar. The "my" page was never completed so it is now
** removed. Use this page as a placeholder in older installations.
**
** WEBPAGE: login
** WEBPAGE: logout
** WEBPAGE: my
**
** The login/logout page. Parameters:
**
** g=URL Jump back to this URL after login completes
** anon The g=URL is not accessible by "nobody" but is
** accessible by "anonymous"
*/
void login_page(void){
const char *zUsername, *zPasswd;
const char *zNew1, *zNew2;
const char *zAnonPw = 0;
const char *zGoto = P("g");
int anonFlag; /* Login as "anonymous" would be useful */
char *zErrMsg = "";
int uid; /* User id logged in user */
char *zSha1Pw;
const char *zIpAddr; /* IP address of requestor */
const char *zReferer;
login_check_credentials();
|
| ︙ | ︙ | |||
487 488 489 490 491 492 493 |
cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
return;
}
sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
constant_time_cmp_function, 0, 0);
zUsername = P("u");
zPasswd = P("p");
| | > > | > > > | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
cgi_redirectf("%s%s%s", g.zHttpsURL, P("PATH_INFO"), zQS);
return;
}
sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0,
constant_time_cmp_function, 0, 0);
zUsername = P("u");
zPasswd = P("p");
anonFlag = g.zLogin==0 && PB("anon");
/* Handle log-out requests */
if( P("out") ){
login_clear_login_data();
redirect_to_g();
return;
}
/* Deal with password-change requests */
if( g.perm.Password && zPasswd
&& (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0
){
/* The user requests a password change */
zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
if( db_int(1, "SELECT 0 FROM user"
" WHERE uid=%d"
|
| ︙ | ︙ | |||
573 574 575 576 577 578 579 580 |
** code prefix, and LOGIN is the user name.
*/
login_set_user_cookie(zUsername, uid, NULL);
redirect_to_g();
}
}
style_header("Login/Logout");
@ %s(zErrMsg)
| > | | > > > > > > > > > > > > > > > > > > > > > | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
** code prefix, and LOGIN is the user name.
*/
login_set_user_cookie(zUsername, uid, NULL);
redirect_to_g();
}
}
style_header("Login/Logout");
style_adunit_config(ADUNIT_OFF);
@ %s(zErrMsg)
if( zGoto ){
char *zAbbrev = fossil_strdup(zGoto);
int i;
for(i=0; zAbbrev[i] && zAbbrev[i]!='?'; i++){}
zAbbrev[i] = 0;
if( g.zLogin ){
@ <p>Use a different login with greater privilege than <b>%h(g.zLogin)</b>
@ to access <b>%h(zAbbrev)</b>.
}else if( anonFlag ){
@ <p>Login as <b>anonymous</b> or any named user
@ to access page <b>%h(zAbbrev)</b>.
}else{
@ <p>Login as a named user to access page <b>%h(zAbbrev)</b>.
}
}
form_begin(0, "%R/login");
if( zGoto ){
@ <input type="hidden" name="g" value="%h(zGoto)" />
}else if( zReferer && strncmp(g.zBaseURL, zReferer, strlen(g.zBaseURL))==0 ){
@ <input type="hidden" name="g" value="%h(zReferer)" />
}
if( anonFlag ){
@ <input type="hidden" name="anon" value="1" />
}
if( g.zLogin ){
@ <p>Currently logged in as <b>%h(g.zLogin)</b>.
@ <input type="submit" name="out" value="Logout"></p>
@ <hr />
@ <p>Change user:
}
@ <table class="login_out">
@ <tr>
@ <td class="login_out_label">User ID:</td>
if( anonFlag ){
@ <td><input type="text" id="u" name="u" value="anonymous" size="30" /></td>
}else{
@ <td><input type="text" id="u" name="u" value="" size="30" /></td>
}
@ </tr>
@ <tr>
@ <td class="login_out_label">Password:</td>
@ <td><input type="password" id="p" name="p" value="" size="30" /></td>
@ </tr>
if( g.zLogin==0 && (anonFlag || zGoto==0) ){
zAnonPw = db_text(0, "SELECT pw FROM user"
" WHERE login='anonymous'"
" AND cap!=''");
}
@ <tr>
@ <td></td>
@ <td><input type="submit" name="in" value="Login"
|
| ︙ | ︙ | |||
621 622 623 624 625 626 627 |
char *zSSL = mprintf("https:%s", &g.zBaseURL[5]);
@ if( form.u.value!="anonymous" ){
@ form.action = "%h(zSSL)/login";
@ }
}
@ }
@ </script>
| < | < < < < < < < < | < < < < < < < | < | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
char *zSSL = mprintf("https:%s", &g.zBaseURL[5]);
@ if( form.u.value!="anonymous" ){
@ form.action = "%h(zSSL)/login";
@ }
}
@ }
@ </script>
@ <p>Pressing the Login button grants permission to store a cookie.</p>
if( db_get_boolean("self-register", 0) ){
@ <p>If you do not have an account, you can
@ <a href="%R/register?g=%T(P("G"))">create one</a>.
}
if( zAnonPw ){
unsigned int uSeed = captcha_seed();
const char *zDecoded = captcha_decode(uSeed);
int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
char *zCaptcha = captcha_render(zDecoded);
@ <p><input type="hidden" name="cs" value="%u(uSeed)" />
@ Visitors may enter <b>anonymous</b> as the user-ID with
@ the 8-character hexadecimal password shown below:</p>
@ <div class="captcha"><table class="captcha"><tr><td><pre>
@ %h(zCaptcha)
@ </pre></td></tr></table>
if( bAutoCaptcha ) {
@ <input type="button" value="Fill out captcha"
@ onclick="gebi('u').value='anonymous'; gebi('p').value='%s(zDecoded)';" />
}
@ </div>
free(zCaptcha);
}
@ </form>
if( g.perm.Password ){
@ <hr />
@ <p>Change Password for user <b>%h(g.zLogin)</b>:</p>
form_begin(0, "%R/login");
@ <table>
@ <tr><td class="login_out_label">Old Password:</td>
@ <td><input type="password" name="p" size="30" /></td></tr>
@ <tr><td class="login_out_label">New Password:</td>
@ <td><input type="password" name="n1" size="30" /></td></tr>
@ <tr><td class="login_out_label">Repeat New Password:</td>
|
| ︙ | ︙ | |||
808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
** This routine examines the login cookie to see if it exists and
** is valid. If the login cookie checks out, it then sets global
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.isHuman True if the user is human, not a spider or robot
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
| > | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
** This routine examines the login cookie to see if it exists and
** is valid. If the login cookie checks out, it then sets global
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.anon Permissions that would be available to anonymous
** g.isHuman True if the user is human, not a spider or robot
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
|
| ︙ | ︙ | |||
999 1000 1001 1002 1003 1004 1005 | /* ** Memory of settings */ static int login_anon_once = 1; /* | | | > > > > | | > | > > > | > | > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 |
/*
** Memory of settings
*/
static int login_anon_once = 1;
/*
** Add to g.perm the default privileges of users "nobody" and/or "anonymous"
** as appropriate for the user g.zLogin.
**
** This routine also sets up g.anon to be either a copy of g.perm for
** all logged in uses, or the privileges that would be available to "anonymous"
** if g.zLogin==0 (meaning that the user is "nobody").
*/
void login_set_anon_nobody_capabilities(void){
if( login_anon_once ){
const char *zCap;
/* All users get privileges from "nobody" */
zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'");
login_set_capabilities(zCap, 0);
zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'");
if( g.zLogin && fossil_strcmp(g.zLogin, "nobody")!=0 ){
/* All logged-in users inherit privileges from "anonymous" */
login_set_capabilities(zCap, 0);
g.anon = g.perm;
}else{
/* Record the privileges of anonymous in g.anon */
g.anon = g.perm;
login_set_capabilities(zCap, LOGIN_ANON);
}
login_anon_once = 0;
}
}
/*
** Flags passed into the 2nd argument of login_set/replace_capabilities().
*/
#if INTERFACE
#define LOGIN_IGNORE_UV 0x01 /* Ignore "u" and "v" */
#define LOGIN_ANON 0x02 /* Use g.anon instead of g.perm */
#endif
/*
** Adds all capability flags in zCap to g.perm or g.anon.
*/
void login_set_capabilities(const char *zCap, unsigned flags){
int i;
FossilUserPerms *p = (flags & LOGIN_ANON) ? &g.anon : &g.perm;
if(NULL==zCap){
return;
}
for(i=0; zCap[i]; i++){
switch( zCap[i] ){
case 's': p->Setup = 1; /* Fall thru into Admin */
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
p->RdWiki = p->WrWiki = p->NewWiki =
p->ApndWiki = p->Hyperlink = p->Clone =
p->NewTkt = p->Password = p->RdAddr =
p->TktFmt = p->Attach = p->ApndTkt =
p->ModWiki = p->ModTkt = 1;
/* Fall thru into Read/Write */
case 'i': p->Read = p->Write = 1; break;
case 'o': p->Read = 1; break;
case 'z': p->Zip = 1; break;
case 'd': p->Delete = 1; break;
case 'h': p->Hyperlink = 1; break;
case 'g': p->Clone = 1; break;
case 'p': p->Password = 1; break;
case 'j': p->RdWiki = 1; break;
case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
case 'm': p->ApndWiki = 1; break;
case 'f': p->NewWiki = 1; break;
case 'l': p->ModWiki = 1; break;
case 'e': p->RdAddr = 1; break;
case 'r': p->RdTkt = 1; break;
case 'n': p->NewTkt = 1; break;
case 'w': p->WrTkt = p->RdTkt = p->NewTkt =
p->ApndTkt = 1; break;
case 'c': p->ApndTkt = 1; break;
case 'q': p->ModTkt = 1; break;
case 't': p->TktFmt = 1; break;
case 'b': p->Attach = 1; break;
case 'x': p->Private = 1; break;
/* The "u" privileges is a little different. It recursively
** inherits all privileges of the user named "reader" */
case 'u': {
if( (flags & LOGIN_IGNORE_UV)==0 ){
const char *zUser;
zUser = db_text("", "SELECT cap FROM user WHERE login='reader'");
|
| ︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | } /* ** If the current login lacks any of the capabilities listed in ** the input, then return 0. If all capabilities are present, then ** return 1. */ | | > | | | | | | | | | | | | | | | | | | | | | | | | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
}
/*
** If the current login lacks any of the capabilities listed in
** the input, then return 0. If all capabilities are present, then
** return 1.
*/
int login_has_capability(const char *zCap, int nCap, u32 flgs){
int i;
int rc = 1;
FossilUserPerms *p = (flgs & LOGIN_ANON) ? &g.anon : &g.perm;
if( nCap<0 ) nCap = strlen(zCap);
for(i=0; i<nCap && rc && zCap[i]; i++){
switch( zCap[i] ){
case 'a': rc = p->Admin; break;
case 'b': rc = p->Attach; break;
case 'c': rc = p->ApndTkt; break;
case 'd': rc = p->Delete; break;
case 'e': rc = p->RdAddr; break;
case 'f': rc = p->NewWiki; break;
case 'g': rc = p->Clone; break;
case 'h': rc = p->Hyperlink; break;
case 'i': rc = p->Write; break;
case 'j': rc = p->RdWiki; break;
case 'k': rc = p->WrWiki; break;
case 'l': rc = p->ModWiki; break;
case 'm': rc = p->ApndWiki; break;
case 'n': rc = p->NewTkt; break;
case 'o': rc = p->Read; break;
case 'p': rc = p->Password; break;
case 'q': rc = p->ModTkt; break;
case 'r': rc = p->RdTkt; break;
case 's': rc = p->Setup; break;
case 't': rc = p->TktFmt; break;
/* case 'u': READER */
/* case 'v': DEVELOPER */
case 'w': rc = p->WrTkt; break;
case 'x': rc = p->Private; break;
/* case 'y': */
case 'z': rc = p->Zip; break;
default: rc = 0; break;
}
}
return rc;
}
/*
|
| ︙ | ︙ | |||
1192 1193 1194 1195 1196 1197 1198 | return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; } /* ** Call this routine when the credential check fails. It causes ** a redirect to the "login" page. */ | | > > > > > > | > > > > > > | < < < | | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 |
return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
}
/*
** Call this routine when the credential check fails. It causes
** a redirect to the "login" page.
*/
void login_needed(int anonOk){
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
json_err( FSL_JSON_E_DENIED, NULL, 1 );
fossil_exit(0);
/* NOTREACHED */
assert(0);
}else
#endif /* FOSSIL_ENABLE_JSON */
{
const char *zUrl = PD("REQUEST_URI", "index");
const char *zQS = P("QUERY_STRING");
Blob redir;
blob_init(&redir, 0, 0);
if( login_wants_https_redirect() ){
blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl);
}else{
blob_appendf(&redir, "%R/login?g=%T", zUrl);
}
if( anonOk ) blob_append(&redir, "&anon", 5);
if( zQS && zQS[0] ){
blob_appendf(&redir, "&%s", zQS);
}
cgi_redirect(blob_str(&redir));
/* NOTREACHED */
assert(0);
}
}
/*
** Call this routine if the user lacks g.perm.Hyperlink permission. If
** the anonymous user has Hyperlink permission, then paint a mesage
** to inform the user that much more information is available by
** logging in as anonymous.
*/
void login_anonymous_available(void){
if( !g.perm.Hyperlink && g.anon.Hyperlink ){
const char *zUrl = PD("REQUEST_URI", "index");
@ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
@ Use <a href="%R/login?anon=1&g=%T(zUrl)">anonymous login</a>
@ to enable hyperlinks.</p>
}
}
/*
** While rendering a form, call this routine to add the Anti-CSRF token
** as a hidden element of the form.
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | char *zLocalRoot; /* The directory holding the local database */ int minPrefix; /* Number of digits needed for a distinct UUID */ int fSqlTrace; /* True if --sqltrace flag is present */ int fSqlStats; /* True if --sqltrace or --sqlstats are present */ int fSqlPrint; /* True if -sqlprint flag is present */ int fQuiet; /* True if -quiet flag is present */ int fHttpTrace; /* Trace outbound HTTP requests */ char *zHttpAuth; /* HTTP Authorization user:pass information */ int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ int fSshTrace; /* Trace the SSH setup traffic */ int fSshClient; /* HTTP client flags for SSH client */ char *zSshCmd; /* SSH command string */ int fNoSync; /* Do not do an autosync ever. --nosync */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zHttpsURL; /* zBaseURL translated to https: */ char *zTop; /* Parent directory of zPath */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ | > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | char *zLocalRoot; /* The directory holding the local database */ int minPrefix; /* Number of digits needed for a distinct UUID */ int fSqlTrace; /* True if --sqltrace flag is present */ int fSqlStats; /* True if --sqltrace or --sqlstats are present */ int fSqlPrint; /* True if -sqlprint flag is present */ int fQuiet; /* True if -quiet flag is present */ int fHttpTrace; /* Trace outbound HTTP requests */ int fAnyTrace; /* Any kind of tracing */ char *zHttpAuth; /* HTTP Authorization user:pass information */ int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ int fSshTrace; /* Trace the SSH setup traffic */ int fSshClient; /* HTTP client flags for SSH client */ char *zSshCmd; /* SSH command string */ int fNoSync; /* Do not do an autosync ever. --nosync */ int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zHttpsURL; /* zBaseURL translated to https: */ char *zTop; /* Parent directory of zPath */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ |
| ︙ | ︙ | |||
189 190 191 192 193 194 195 | int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */ /* Information used to populate the RCVFROM table */ int rcvid; /* The rcvid. 0 if not yet defined. */ char *zIpAddr; /* The remote IP address */ char *zNonce; /* The nonce used for login */ | | > > > > > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */ /* Information used to populate the RCVFROM table */ int rcvid; /* The rcvid. 0 if not yet defined. */ char *zIpAddr; /* The remote IP address */ char *zNonce; /* The nonce used for login */ /* permissions available to current user */ struct FossilUserPerms perm; /* permissions available to current user or to "anonymous". ** This is the logical union of perm permissions above with ** the value that perm would take if g.zLogin were "anonymous". */ struct FossilUserPerms anon; #ifdef FOSSIL_ENABLE_TCL /* all Tcl related context necessary for integration */ struct TclContext tcl; #endif /* For defense against Cross-site Request Forgery attacks */ |
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
g.fSshClient = 0;
g.zSshCmd = 0;
if( g.fSqlTrace ) g.fSqlStats = 1;
| < > | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
g.fSshClient = 0;
g.zSshCmd = 0;
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
#ifdef FOSSIL_ENABLE_TH1_HOOKS
g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
#endif
g.fAnyTrace = g.fSqlTrace|g.fSystemTrace|g.fSshTrace|g.fHttpTrace;
g.zHttpAuth = 0;
g.zLogin = find_option("user", "U", 1);
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
g.zErrlog = find_option("errorlog", 0, 1);
fossil_init_flags_from_options();
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
|
| ︙ | ︙ | |||
685 686 687 688 689 690 691 |
zNewArgv[1] = "help";
g.argc++;
g.argv = zNewArgv;
}
zCmdName = g.argv[1];
}
#ifndef _WIN32
| > > > > > > | > > > > > > > > > > > > | > > > | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
zNewArgv[1] = "help";
g.argc++;
g.argv = zNewArgv;
}
zCmdName = g.argv[1];
}
#ifndef _WIN32
/* There is a bug in stunnel4 in which it sometimes starts up client
** processes without first opening file descriptor 2 (standard error).
** If this happens, and a subsequent open() of a database returns file
** descriptor 2, and then an assert() fires and writes on fd 2, that
** can corrupt the data file. To avoid this problem, make sure open()
** will never return file descriptor 2 or less. */
if( !is_valid_fd(2) ){
int nTry = 0;
int fd = 0;
int x = 0;
do{
fd = open("/dev/null",O_WRONLY);
if( fd>=2 ) break;
if( fd<0 ) x = errno;
}while( nTry++ < 2 );
if( fd<2 ){
g.cgiOutput = 1;
g.httpOut = stdout;
g.fullHttpReply = !g.isHTTP;
fossil_fatal("file descriptor 2 is not open. (fd=%d, errno=%d)",
fd, x);
}
}
#endif
rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
if( rc==1 ){
#ifdef FOSSIL_ENABLE_TH1_HOOKS
if( !g.isHTTP && !g.fNoThHook ){
rc = Th_CommandHook(zCmdName, 0);
}else{
|
| ︙ | ︙ | |||
1148 1149 1150 1151 1152 1153 1154 |
n = (j+6)/7;
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
| | | 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
n = (j+6)/7;
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
@ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
j++;
if( j>=n ){
@ </ul></td>
j = 0;
}
}
if( j>0 ){
|
| ︙ | ︙ | |||
1176 1177 1178 1179 1180 1181 1182 |
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( '/'!=*z ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
| | | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 |
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( '/'!=*z ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
@ <li><a href="%R/help?cmd=%s(z)">%s(z+1)</a></li>
}else{
@ <li>%s(z+1)</li>
}
j++;
if( j>=n ){
@ </ul></td>
j = 0;
|
| ︙ | ︙ | |||
1206 1207 1208 1209 1210 1211 1212 |
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( strncmp(z,"test",4)!=0 ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
| | | 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
for(i=j=0; i<count(aCommand); i++){
const char *z = aCommand[i].zName;
if( strncmp(z,"test",4)!=0 ) continue;
if( j==0 ){
@ <td valign="top"><ul>
}
if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
@ <li><a href="%R/help?cmd=%s(z)">%s(z)</a></li>
}else{
@ <li>%s(z)</li>
}
j++;
if( j>=n ){
@ </ul></td>
j = 0;
|
| ︙ | ︙ | |||
1327 1328 1329 1330 1331 1332 1333 1334 | ** new repository name. ** ** zRepo might be a directory itself. In that case chroot into ** the directory zRepo. ** ** Assume the user-id and group-id of the repository, or if zRepo ** is a directory, of that directory. */ | > > > | > | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 |
** new repository name.
**
** zRepo might be a directory itself. In that case chroot into
** the directory zRepo.
**
** Assume the user-id and group-id of the repository, or if zRepo
** is a directory, of that directory.
**
** The noJail flag means that the chroot jail is not entered. But
** privileges are still lowered to that of the the user-id and group-id.
*/
static char *enter_chroot_jail(char *zRepo, int noJail){
#if !defined(_WIN32)
if( getuid()==0 ){
int i;
struct stat sStat;
Blob dir;
char *zDir;
if( g.db!=0 ){
db_close(1);
}
file_canonical_name(zRepo, &dir, 0);
zDir = blob_str(&dir);
if( !noJail ){
if( file_isdir(zDir)==1 ){
if( file_chdir(zDir, 1) ){
fossil_fatal("unable to chroot into %s", zDir);
}
zRepo = "/";
}else{
for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
if( i>0 ){
zDir[i] = 0;
if( file_chdir(zDir, 1) ){
fossil_fatal("unable to chroot into %s", zDir);
}
zDir[i] = '/';
}
zRepo = &zDir[i];
}
}
if( stat(zRepo, &sStat)!=0 ){
fossil_fatal("cannot stat() repository: %s", zRepo);
}
i = setgid(sStat.st_gid);
i = i || setuid(sStat.st_uid);
if(i){
fossil_fatal("setgid/uid() failed with errno %d", errno);
}
if( g.db==0 && file_isfile(zRepo) ){
db_open_repository(zRepo);
}
}
#endif
return zRepo;
}
/*
** Generate a web-page that lists all repositories located under the
** g.zRepositoryName directory and return non-zero.
**
** Or, if no repositories can be located beneath g.zRepositoryName,
** return 0.
*/
static int repo_list_page(void){
Blob base;
int n = 0;
assert( g.db==0 );
blob_init(&base, g.zRepositoryName, -1);
sqlite3_open(":memory:", &g.db);
db_multi_exec("CREATE TABLE sfile(x TEXT);");
db_multi_exec("CREATE TABLE vfile(pathname);");
vfile_scan(&base, blob_size(&base), 0, 0, 0);
db_multi_exec("DELETE FROM sfile WHERE x NOT GLOB '*.fossil'");
n = db_int(0, "SELECT count(*) FROM sfile");
if( n>0 ){
Stmt q;
@ <h1>Available Repositories:</h1>
@ <ol>
db_prepare(&q, "SELECT x, substr(x,-7,-100000)||'/home'"
" FROM sfile ORDER BY x COLLATE nocase;");
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zUrl = db_column_text(&q, 1);
@ <li><a href="%h(zUrl)">%h(zName)</a></li>
}
@ </ol>
cgi_reply();
}
sqlite3_close(g.db);
g.db = 0;
return n;
}
/*
** Preconditions:
**
** * Environment variables are set up according to the CGI standard.
**
** If the repository is known, it has already been opened. If unknown,
|
| ︙ | ︙ | |||
1396 1397 1398 1399 1400 1401 1402 | ** Or, if an ordinary file named $prefix is found, and $prefix matches ** pFileGlob and $prefix does not match "*.fossil*" and the mimetype of ** $prefix can be determined from its suffix, then the file $prefix is ** returned as static text. ** ** If no suitable webpage is found, try to redirect to zNotFound. */ | | > > > > | 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 |
** Or, if an ordinary file named $prefix is found, and $prefix matches
** pFileGlob and $prefix does not match "*.fossil*" and the mimetype of
** $prefix can be determined from its suffix, then the file $prefix is
** returned as static text.
**
** If no suitable webpage is found, try to redirect to zNotFound.
*/
static void process_one_web_page(
const char *zNotFound, /* Redirect here on a 404 if not NULL */
Glob *pFileGlob, /* Deliver static files matching */
int allowRepoList /* Send repo list for "/" URL */
){
const char *zPathInfo;
char *zPath = NULL;
int idx;
int i;
/* If the repository has not been opened already, then find the
** repository based on the first element of PATH_INFO and open it.
|
| ︙ | ︙ | |||
1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 |
zRepo[j] = '.';
}
if( szFile<1024 ){
set_base_url(0);
if( zNotFound ){
cgi_redirect(zNotFound);
}else{
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,1);
return;
}
#endif
| > > > > | 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 |
zRepo[j] = '.';
}
if( szFile<1024 ){
set_base_url(0);
if( zNotFound ){
cgi_redirect(zNotFound);
}else if( strcmp(zPathInfo,"/")==0
&& allowRepoList
&& repo_list_page() ){
/* Will return a list of repositories */
}else{
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,1);
return;
}
#endif
|
| ︙ | ︙ | |||
1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 |
*/
void cmd_cgi(void){
const char *zFile;
const char *zNotFound = 0;
char **azRedirect = 0; /* List of repositories to redirect to */
int nRedirect = 0; /* Number of entries in azRedirect */
Glob *pFileGlob = 0; /* Pattern for files */
Blob config, line, key, value, value2;
if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
zFile = g.argv[2];
}else{
zFile = g.argv[1];
}
g.httpOut = stdout;
g.httpIn = stdin;
fossil_binary_mode(g.httpOut);
fossil_binary_mode(g.httpIn);
g.cgiOutput = 1;
blob_read_from_file(&config, zFile);
while( blob_line(&config, &line) ){
if( !blob_token(&line, &key) ) continue;
if( blob_buffer(&key)[0]=='#' ) continue;
| > < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | < < < | | < | 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 |
*/
void cmd_cgi(void){
const char *zFile;
const char *zNotFound = 0;
char **azRedirect = 0; /* List of repositories to redirect to */
int nRedirect = 0; /* Number of entries in azRedirect */
Glob *pFileGlob = 0; /* Pattern for files */
int allowRepoList = 0; /* Allow lists of repository files */
Blob config, line, key, value, value2;
if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
zFile = g.argv[2];
}else{
zFile = g.argv[1];
}
g.httpOut = stdout;
g.httpIn = stdin;
fossil_binary_mode(g.httpOut);
fossil_binary_mode(g.httpIn);
g.cgiOutput = 1;
blob_read_from_file(&config, zFile);
while( blob_line(&config, &line) ){
if( !blob_token(&line, &key) ) continue;
if( blob_buffer(&key)[0]=='#' ) continue;
if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
/* repository: FILENAME
**
** The name of the Fossil repository to be served via CGI. Most
** fossil CGI scripts have a single non-comment line that contains
** this one entry.
*/
blob_trim(&value);
db_open_repository(blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
/* directory: DIRECTORY
**
** If repository: is omitted, then terms of the PATH_INFO cgi parameter
** are appended to DIRECTORY looking for a repository (whose name ends
** in ".fossil") or a file in "files:".
*/
db_close(1);
g.zRepositoryName = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
/* notfound: URL
**
** If using directory: and no suitable repository or file is found,
** then redirect to URL.
*/
zNotFound = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "localauth") ){
/* localauth
**
** Grant "administrator" privileges to users connecting with HTTP
** from IP address 127.0.0.1. Do not bother checking credentials.
*/
g.useLocalauth = 1;
continue;
}
if( blob_eq(&key, "repolist") ){
/* repolist
**
** If using "directory:" and the URL is "/" then generate a page
** showing a list of available repositories.
*/
allowRepoList = 1;
continue;
}
if( blob_eq(&key, "redirect:") && blob_token(&line, &value)
&& blob_token(&line, &value2) ){
/* See the header comment on the redirect_web_page() function
** above for details. */
nRedirect++;
azRedirect = fossil_realloc(azRedirect, 2*nRedirect*sizeof(char*));
azRedirect[nRedirect*2-2] = mprintf("%s", blob_str(&value));
azRedirect[nRedirect*2-1] = mprintf("%s", blob_str(&value2));
blob_reset(&value);
blob_reset(&value2);
continue;
}
if( blob_eq(&key, "files:") && blob_token(&line, &value) ){
/* files: GLOBLIST
**
** GLOBLIST is a comma-separated list of filename globs. For
** example: *.html,*.css,*.js
**
** If the repository: line is omitted and then PATH_INFO is searched
** for files that match any of these GLOBs and if any such file is
** found it is returned verbatim. This feature allows "fossil server"
** to function as a primitive web-server delivering arbitrary content.
*/
pFileGlob = glob_create(blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "setenv:") && blob_token(&line, &value)
&& blob_token(&line, &value2) ){
/* setenv: NAME VALUE
**
** Sets environment variable NAME to VALUE
*/
fossil_setenv(blob_str(&value), blob_str(&value2));
blob_reset(&value);
blob_reset(&value2);
continue;
}
if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
/* debug: FILENAME
**
** Causes output from cgi_debug() and CGIDEBUG(()) calls to go
** into FILENAME.
*/
g.fDebug = fossil_fopen(blob_str(&value), "ab");
blob_reset(&value);
continue;
}
if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){
/* errorlog: FILENAME
**
** Causes messages from warnings, errors, and panics to be appended
** to FILENAME.
*/
g.zErrlog = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
/* HOME: VALUE
**
** Set CGI parameter "HOME" to VALUE. This is legacy. Use
** setenv: instead.
*/
cgi_setenv("HOME", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "skin:") && blob_token(&line, &value) ){
/* skin: LABEL
**
** Use one of the built-in skins defined by LABEL. LABEL is the
** name of the subdirectory under the skins/ directory that holds
** the elements of the built-in skin. If LABEL does not match,
** this directive is a silent no-op.
*/
skin_use_alternative(blob_str(&value));
blob_reset(&value);
continue;
}
}
blob_reset(&config);
if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){
cgi_panic("Unable to find or open the project repository");
}
cgi_init();
if( nRedirect ){
redirect_web_page(nRedirect, azRedirect);
}else{
process_one_web_page(zNotFound, pFileGlob, allowRepoList);
}
}
/*
** If g.argv[arg] exists then it is either the name of a repository
** that will be used by a server, or else it is a directory that
** contains multiple repositories that can be served. If g.argv[arg]
** is a directory, the repositories it contains must be named
** "*.fossil". If g.argv[arg] does not exists, then we must be within
** a check-out and the repository to be served is the repository of
** that check-out.
**
** Open the repository to be served if it is known. If g.argv[arg] is
** a directory full of repositories, then set g.zRepositoryName to
** the name of that directory and the specific repository will be
** opened later by process_one_web_page() based on the content of
** the PATH_INFO variable.
*/
static void find_server_repository(int arg){
if( g.argc<=arg ){
db_must_be_within_tree();
}else if( file_isdir(g.argv[arg])==1 ){
g.zRepositoryName = mprintf("%s", g.argv[arg]);
file_simplify_name(g.zRepositoryName, -1, 0);
}else{
db_open_repository(g.argv[arg]);
}
}
/*
** undocumented format:
|
| ︙ | ︙ | |||
1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | ** thus also no redirecting from http: to https: will take place. ** ** If the --localauth option is given, then automatic login is performed ** for requests coming from localhost, if the "localauth" setting is not ** enabled. ** ** Options: ** --localauth enable automatic login for local connections ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --nossl signal that no SSL connections are available ** --notfound URL use URL as "HTTP 404, object not found" page. | > > > < | > > > > > > | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 |
** thus also no redirecting from http: to https: will take place.
**
** If the --localauth option is given, then automatic login is performed
** for requests coming from localhost, if the "localauth" setting is not
** enabled.
**
** Options:
** --baseurl URL base URL (useful with reverse proxies)
** --files GLOB comma-separate glob patterns for static file to serve
** --localauth enable automatic login for local connections
** --host NAME specify hostname of the server
** --https signal a request coming in via https
** --nojail drop root privilege but do not enter the chroot jail
** --nossl signal that no SSL connections are available
** --notfound URL use URL as "HTTP 404, object not found" page.
** --repolist If REPOSITORY is directory, URL "/" lists all repos
** --scgi Interpret input as SCGI rather than HTTP
** --skin LABEL Use override skin LABEL
**
** See also: cgi, server, winsrv
*/
void cmd_http(void){
const char *zIpAddr = 0;
const char *zNotFound;
const char *zHost;
const char *zAltBase;
const char *zFileGlob;
int useSCGI;
int noJail;
int allowRepoList;
/* The winhttp module passes the --files option as --files-urlenc with
** the argument being URL encoded, to avoid wildcard expansion in the
** shell. This option is for internal use and is undocumented.
*/
zFileGlob = find_option("files-urlenc",0,1);
if( zFileGlob ){
char *z = mprintf("%s", zFileGlob);
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
zNotFound = find_option("notfound", 0, 1);
noJail = find_option("nojail",0,0)!=0;
allowRepoList = find_option("repolist",0,0)!=0;
g.useLocalauth = find_option("localauth", 0, 0)!=0;
g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
useSCGI = find_option("scgi", 0, 0)!=0;
zAltBase = find_option("baseurl", 0, 1);
if( zAltBase ) set_base_url(zAltBase);
if( find_option("https",0,0)!=0 ){
zIpAddr = fossil_getenv("REMOTE_HOST"); /* From stunnel */
|
| ︙ | ︙ | |||
1975 1976 1977 1978 1979 1980 1981 |
fossil_fatal("no repository specified");
}
g.fullHttpReply = 1;
if( g.argc>=5 ){
g.httpIn = fossil_fopen(g.argv[2], "rb");
g.httpOut = fossil_fopen(g.argv[3], "wb");
zIpAddr = g.argv[4];
| | | | | | | | | 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 |
fossil_fatal("no repository specified");
}
g.fullHttpReply = 1;
if( g.argc>=5 ){
g.httpIn = fossil_fopen(g.argv[2], "rb");
g.httpOut = fossil_fopen(g.argv[3], "wb");
zIpAddr = g.argv[4];
find_server_repository(5);
}else{
g.httpIn = stdin;
g.httpOut = stdout;
find_server_repository(2);
}
if( zIpAddr==0 ){
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
}
}
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
if( useSCGI ){
cgi_handle_scgi_request();
}else if( g.fSshClient & CGI_SSH_CLIENT ){
ssh_request_loop(zIpAddr, glob_create(zFileGlob));
}else{
cgi_handle_http_request(zIpAddr);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
}
/*
** Process all requests in a single SSH connection if possible.
*/
void ssh_request_loop(const char *zIpAddr, Glob *FileGlob){
blob_zero(&g.cgiIn);
do{
cgi_handle_ssh_http_request(zIpAddr);
process_one_web_page(0, FileGlob, 0);
blob_reset(&g.cgiIn);
} while ( g.fSshClient & CGI_SSH_FOSSIL ||
g.fSshClient & CGI_SSH_COMPAT );
}
/*
** Note that the following command is used by ssh:// processing.
**
** COMMAND: test-http
** Works like the http command but gives setup permission to all users.
**
*/
void cmd_test_http(void){
const char *zIpAddr; /* IP address of remote client */
Th_InitTraceLog();
login_set_capabilities("sx", 0);
g.useLocalauth = 1;
g.httpIn = stdin;
g.httpOut = stdout;
find_server_repository(2);
g.cgiOutput = 1;
g.fullHttpReply = 1;
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
ssh_request_loop(zIpAddr, 0);
}else{
cgi_set_parameter("REMOTE_ADDR", "127.0.0.1");
cgi_handle_http_request(0);
process_one_web_page(0, 0, 0);
}
}
#if !defined(_WIN32)
#if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
/*
** Search for an executable on the PATH environment variable.
|
| ︙ | ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | ** list of glob patterns given by --files and that have known suffixes ** such as ".txt" or ".html" or ".jpeg" and do not match the pattern ** "*.fossil*" will be served as static content. With the "ui" command, ** the REPOSITORY can only be a directory if the --notfound option is ** also present. ** ** By default, the "ui" command provides full administrative access without | | | | | < | > > > > < | < > > > > > > > > > > > | > | | 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 |
** list of glob patterns given by --files and that have known suffixes
** such as ".txt" or ".html" or ".jpeg" and do not match the pattern
** "*.fossil*" will be served as static content. With the "ui" command,
** the REPOSITORY can only be a directory if the --notfound option is
** also present.
**
** By default, the "ui" command provides full administrative access without
** having to log in. This can be disabled by turning off the "localauth"
** setting. Automatic login for the "server" command is available if the
** --localauth option is present and the "localauth" setting is off and the
** connection is from localhost. The "ui" command also enables --repolist
** by default.
**
** Options:
** --baseurl URL Use URL as the base (useful for reverse proxies)
** --files GLOBLIST Comma-separated list of glob patterns for static files
** --localauth enable automatic login for requests from localhost
** --localhost listen on 127.0.0.1 only (always true for "ui")
** --nojail Drop root privileges but do not enter the chroot jail
** --notfound URL Redirect
** -P|--port TCPPORT listen to request on port TCPPORT
** --th-trace trace TH1 execution (for debugging purposes)
** --repolist If REPOSITORY is dir, URL "/" lists repos.
** --scgi Accept SCGI rather than HTTP
** --skin LABEL Use override skin LABEL
**
** See also: cgi, http, winsrv
*/
void cmd_webserver(void){
int iPort, mxPort; /* Range of TCP ports allowed */
const char *zPort; /* Value of the --port option */
const char *zBrowser; /* Name of web browser program */
char *zBrowserCmd = 0; /* Command to launch the web browser */
int isUiCmd; /* True if command is "ui", not "server' */
const char *zNotFound; /* The --notfound option or NULL */
int flags = 0; /* Server flags */
#if !defined(_WIN32)
int noJail; /* Do not enter the chroot jail */
#endif
int allowRepoList; /* List repositories on URL "/" */
const char *zAltBase; /* Argument to the --baseurl option */
const char *zFileGlob; /* Static content must match this */
char *zIpAddr = 0; /* Bind to this IP address */
#if defined(_WIN32)
const char *zStopperFile; /* Name of file used to terminate server */
zStopperFile = find_option("stopper", 0, 1);
#endif
zFileGlob = find_option("files-urlenc",0,1);
if( zFileGlob ){
char *z = mprintf("%s", zFileGlob);
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
#if !defined(_WIN32)
noJail = find_option("nojail",0,0)!=0;
#endif
g.useLocalauth = find_option("localauth", 0, 0)!=0;
Th_InitTraceLog();
zPort = find_option("port", "P", 1);
zNotFound = find_option("notfound", 0, 1);
allowRepoList = find_option("repolist",0,0)!=0;
zAltBase = find_option("baseurl", 0, 1);
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
if( zAltBase ){
set_base_url(zAltBase);
}
if( find_option("localhost", 0, 0)!=0 ){
flags |= HTTP_SERVER_LOCALHOST;
}
/* We should be done with options.. */
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
isUiCmd = g.argv[1][0]=='u';
if( isUiCmd ){
flags |= HTTP_SERVER_LOCALHOST|HTTP_SERVER_REPOLIST;
g.useLocalauth = 1;
allowRepoList = 1;
}
find_server_repository(2);
if( zPort ){
int i;
for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}
if( i>0 ){
zIpAddr = mprintf("%.*s", i, zPort);
zPort += i+1;
}
|
| ︙ | ︙ | |||
2217 2218 2219 2220 2221 2222 2223 |
g.sslNotAvailable = 1;
g.httpIn = stdin;
g.httpOut = stdout;
if( g.fHttpTrace || g.fSqlTrace ){
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
}
g.cgiOutput = 1;
| | | | > | 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 |
g.sslNotAvailable = 1;
g.httpIn = stdin;
g.httpOut = stdout;
if( g.fHttpTrace || g.fSqlTrace ){
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
}
g.cgiOutput = 1;
find_server_repository(2);
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
if( flags & HTTP_SERVER_SCGI ){
cgi_handle_scgi_request();
}else{
cgi_handle_http_request(0);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
#else
/* Win32 implementation */
(void)allowRepoList; /* Suppress warning */
if( isUiCmd ){
zBrowser = db_get("web-browser", "start");
if( zIpAddr ){
zBrowserCmd = mprintf("%s http://%s:%%d/ &", zBrowser, zIpAddr);
}else{
zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
}
|
| ︙ | ︙ |
Changes to src/main.mk.
| ︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ | > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/statrep.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ |
| ︙ | ︙ | |||
129 130 131 132 133 134 135 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ | > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ $(SRCDIR)/../skins/black_and_white/css.txt \ $(SRCDIR)/../skins/black_and_white/footer.txt \ $(SRCDIR)/../skins/black_and_white/header.txt \ $(SRCDIR)/../skins/default/css.txt \ $(SRCDIR)/../skins/default/footer.txt \ $(SRCDIR)/../skins/default/header.txt \ $(SRCDIR)/../skins/eagle/css.txt \ $(SRCDIR)/../skins/eagle/footer.txt \ $(SRCDIR)/../skins/eagle/header.txt \ $(SRCDIR)/../skins/enhanced1/css.txt \ $(SRCDIR)/../skins/enhanced1/footer.txt \ $(SRCDIR)/../skins/enhanced1/header.txt \ $(SRCDIR)/../skins/etienne1/css.txt \ $(SRCDIR)/../skins/etienne1/footer.txt \ $(SRCDIR)/../skins/etienne1/header.txt \ $(SRCDIR)/../skins/khaki/css.txt \ $(SRCDIR)/../skins/khaki/footer.txt \ $(SRCDIR)/../skins/khaki/header.txt \ $(SRCDIR)/../skins/plain_gray/css.txt \ $(SRCDIR)/../skins/plain_gray/footer.txt \ $(SRCDIR)/../skins/plain_gray/header.txt \ $(SRCDIR)/../skins/rounded1/css.txt \ $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/markdown.md TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/allrepo_.c \ $(OBJDIR)/attach_.c \ $(OBJDIR)/bag_.c \ $(OBJDIR)/bisect_.c \ |
| ︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ | > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/statrep_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ |
| ︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.o \ $(OBJDIR)/sqlcmd.o \ $(OBJDIR)/stash.o \ $(OBJDIR)/stat.o \ $(OBJDIR)/style.o \ $(OBJDIR)/sync.o \ $(OBJDIR)/tag.o \ $(OBJDIR)/tar.o \ $(OBJDIR)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ | > | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.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)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ |
| ︙ | ︙ | |||
419 420 421 422 423 424 425 |
# Setup the options used to compile the included SQLite library.
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
| | > > | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# Setup the options used to compile the included SQLite library.
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS
# Setup the options used to compile the included SQLite shell.
SHELL_OPTIONS = -Dmain=sqlite3_shell \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
-DSQLITE_SHELL_DBNAME_PROC=fossil_open
|
| ︙ | ︙ | |||
476 477 478 479 480 481 482 | rm -rf $(OBJDIR)/* $(APPNAME) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex $(OBJDIR)/mkindex $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(OBJDIR)/mkbuiltin $(EXTRA_FILES) | | | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | rm -rf $(OBJDIR)/* $(APPNAME) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex $(OBJDIR)/mkindex $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(OBJDIR)/mkbuiltin $(EXTRA_FILES) $(OBJDIR)/mkbuiltin --prefix $(SRCDIR)/ $(EXTRA_FILES) >$@ $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/builtin_data.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h \ $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h \ $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h \ $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h \ $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \ |
| ︙ | ︙ | |||
571 572 573 574 575 576 577 578 579 580 581 582 583 584 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ | > | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/statrep_.c:$(OBJDIR)/statrep.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ |
| ︙ | ︙ | |||
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c | > > > > > > > > | 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/statrep_.c: $(SRCDIR)/statrep.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/statrep.c >$@ $(OBJDIR)/statrep.o: $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/statrep.o -c $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c |
| ︙ | ︙ |
Changes to src/makeheaders.c.
| ︙ | ︙ | |||
110 111 112 113 114 115 116 | ** doesn't tell about the objects structure. A typical forward declaration ** is: ** ** struct Xyzzy; ** ** Not every object has a forward declaration. If it does, thought, the ** forward declaration will be contained in the zFwd field for C and | | | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
** doesn't tell about the objects structure. A typical forward declaration
** is:
**
** struct Xyzzy;
**
** Not every object has a forward declaration. If it does, thought, the
** forward declaration will be contained in the zFwd field for C and
** the zFwdCpp for C++. The zDecl field contains the complete
** declaration text.
*/
typedef struct Decl Decl;
struct Decl {
char *zName; /* Name of the object being declared. The appearance
** of this name is a source file triggers the declaration
** to be added to the header for that file. */
const char *zFile; /* File from which extracted. */
char *zIf; /* Surround the declaration with this #if */
char *zFwd; /* A forward declaration. NULL if there is none. */
char *zFwdCpp; /* Use this forward declaration for C++. */
char *zDecl; /* A full declaration of this object */
char *zExtra; /* Extra declaration text inserted into class objects */
int extraType; /* Last public:, protected: or private: in zExtraDecl */
struct Include *pInclude; /* #includes that come before this declaration */
|
| ︙ | ︙ | |||
161 162 163 164 165 166 167 | ** a library, then the object is not visible to users ** of the library. (i.e. the object does not appear ** in the output when using the -H option.) ** ** EXPORT scope The object is visible and usable everywhere. ** ** The DP_Flag is a temporary use flag that is used during processing to | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | ** a library, then the object is not visible to users ** of the library. (i.e. the object does not appear ** in the output when using the -H option.) ** ** EXPORT scope The object is visible and usable everywhere. ** ** The DP_Flag is a temporary use flag that is used during processing to ** prevent an infinite loop. It's use is localized. ** ** The DP_Cplusplus, DP_ExternCReqd and DP_ExternReqd flags are permanent ** and are used to specify what type of declaration the object requires. */ #define DP_Forward 0x001 /* Has a forward declaration in this file */ #define DP_Declared 0x002 /* Has a full declaration in this file */ #define DP_Export 0x004 /* Export this declaration */ |
| ︙ | ︙ | |||
199 200 201 202 203 204 205 | ** the same "flags" field. ** ** Be careful not to confuse PS_Export with DP_Export or ** PS_Local with DP_Local. Their names are similar, but the meanings ** of these flags are very different. */ #define PS_Extern 0x000800 /* "extern" has been seen */ | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
** the same "flags" field.
**
** Be careful not to confuse PS_Export with DP_Export or
** PS_Local with DP_Local. Their names are similar, but the meanings
** of these flags are very different.
*/
#define PS_Extern 0x000800 /* "extern" has been seen */
#define PS_Export 0x001000 /* If between "#if EXPORT_INTERFACE"
** and "#endif" */
#define PS_Export2 0x002000 /* If "EXPORT" seen */
#define PS_Typedef 0x004000 /* If "typedef" has been seen */
#define PS_Static 0x008000 /* If "static" has been seen */
#define PS_Interface 0x010000 /* If within #if INTERFACE..#endif */
#define PS_Method 0x020000 /* If "::" token has been seen */
#define PS_Local 0x040000 /* If within #if LOCAL_INTERFACE..#endif */
|
| ︙ | ︙ | |||
229 230 231 232 233 234 235 | #define TY_Variable 0x01000000 #define TY_Structure 0x02000000 #define TY_Union 0x04000000 #define TY_Enumeration 0x08000000 #define TY_Defunct 0x10000000 /* Used to erase a declaration */ /* | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
#define TY_Variable 0x01000000
#define TY_Structure 0x02000000
#define TY_Union 0x04000000
#define TY_Enumeration 0x08000000
#define TY_Defunct 0x10000000 /* Used to erase a declaration */
/*
** Each nested #if (or #ifdef or #ifndef) is stored in a stack of
** instances of the following structure.
*/
typedef struct Ifmacro Ifmacro;
struct Ifmacro {
int nLine; /* Line number where this macro occurs */
char *zCondition; /* Text of the condition for this macro */
Ifmacro *pNext; /* Next down in the stack */
|
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
char *zHdr; /* Name of the generated .h file for this input.
** Will be NULL if input is to be scanned only */
int flags; /* One or more DP_, PS_ and/or TY_ flags */
InFile *pNext; /* Next input file in the list of them all */
IdentTable idTable; /* All identifiers in this input file */
};
| | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
char *zHdr; /* Name of the generated .h file for this input.
** Will be NULL if input is to be scanned only */
int flags; /* One or more DP_, PS_ and/or TY_ flags */
InFile *pNext; /* Next input file in the list of them all */
IdentTable idTable; /* All identifiers in this input file */
};
/*
** An unbounded string is able to grow without limit. We use these
** to construct large in-memory strings from lots of smaller components.
*/
typedef struct String String;
struct String {
int nAlloc; /* Number of bytes allocated */
int nUsed; /* Number of bytes used (not counting null terminator) */
|
| ︙ | ︙ | |||
330 331 332 333 334 335 336 | ** The following text line appears at the top of every file generated ** by this program. By recognizing this line, the program can be sure ** never to read a file that it generated itself. ** ** The "#undef INTERFACE" part is a hack to work around a name collision ** in MSVC 2008. */ | | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | ** The following text line appears at the top of every file generated ** by this program. By recognizing this line, the program can be sure ** never to read a file that it generated itself. ** ** The "#undef INTERFACE" part is a hack to work around a name collision ** in MSVC 2008. */ const char zTopLine[] = "/* \aThis file was automatically generated. Do not edit! */\n" "#undef INTERFACE\n"; #define nTopLine (sizeof(zTopLine)-1) /* ** The name of the file currently being parsed. */ static const char *zFilename; /* ** The stack of #if macros for the file currently being parsed. */ static Ifmacro *ifStack = 0; /* |
| ︙ | ︙ | |||
700 701 702 703 704 705 706 |
*/
static char *ReadFile(const char *zFilename){
struct stat sStat;
FILE *pIn;
char *zBuf;
int n;
| | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
*/
static char *ReadFile(const char *zFilename){
struct stat sStat;
FILE *pIn;
char *zBuf;
int n;
if( stat(zFilename,&sStat)!=0
#ifndef WIN32
|| !S_ISREG(sStat.st_mode)
#endif
){
return 0;
}
pIn = fopen(zFilename,"r");
|
| ︙ | ︙ | |||
887 888 889 890 891 892 893 |
}else{
isBlockComment = 0;
}
}
}
i++;
}
| | | | | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 |
}else{
isBlockComment = 0;
}
}
}
i++;
}
if( z[i] ){
i += 2;
}else{
isBlockComment = 0;
fprintf(stderr,"%s:%d: Unterminated comment\n",
zFilename, startLine);
nErr++;
}
pToken->eType = isBlockComment==2 ? TT_BlockComment : TT_Comment;
pToken->nText = i - pIn->i;
}else{
/* A divide operator */
pToken->eType = TT_Other;
pToken->nText = 1 + (z[i+1]=='+');
}
break;
case '0':
if( z[i+1]=='x' || z[i+1]=='X' ){
/* A hex constant */
i += 2;
while( isxdigit(z[i]) ){ i++; }
}else{
/* An octal constant */
while( isdigit(z[i]) ){ i++; }
|
| ︙ | ︙ | |||
961 962 963 964 965 966 967 |
case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W':
case 'X': case 'Y': case 'Z': case '_':
while( isalnum(z[i]) || z[i]=='_' ){ i++; };
pToken->eType = TT_Id;
pToken->nText = i - pIn->i;
break;
| | | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W':
case 'X': case 'Y': case 'Z': case '_':
while( isalnum(z[i]) || z[i]=='_' ){ i++; };
pToken->eType = TT_Id;
pToken->nText = i - pIn->i;
break;
case ':':
pToken->eType = TT_Other;
pToken->nText = 1 + (z[i+1]==':');
break;
case '=':
case '<':
case '>':
case '+':
case '-':
case '*':
case '%':
case '^':
case '&':
case '|':
pToken->eType = TT_Other;
pToken->nText = 1 + (z[i+1]=='=');
break;
default:
pToken->eType = TT_Other;
pToken->nText = 1;
|
| ︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 |
}
break;
}
}
/* NOT REACHED */
}
| | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 |
}
break;
}
}
/* NOT REACHED */
}
/*
** This routine looks for identifiers (strings of contiguous alphanumeric
** characters) within a preprocessor directive and adds every such string
** found to the given identifier table
*/
static void FindIdentifiersInMacro(Token *pToken, IdentTable *pTable){
Token sToken;
InStream sIn;
|
| ︙ | ︙ | |||
1155 1156 1157 1158 1159 1160 1161 |
return nErr;
case TT_Id:
if( pTable ){
IdentTableInsert(pTable,pToken->zText,pToken->nText);
}
break;
| | | 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 |
return nErr;
case TT_Id:
if( pTable ){
IdentTableInsert(pTable,pToken->zText,pToken->nText);
}
break;
case TT_Preprocessor:
if( pTable!=0 ){
FindIdentifiersInMacro(pToken,pTable);
}
break;
case TT_Other:
|
| ︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 |
if( zFile==0 ){
fprintf(stderr,"Can't read file \"%s\"\n",argv[1]);
exit(1);
}
pList = TokenizeFile(zFile,&sTable);
for(p=pList; p; p=p->pNext){
int j;
| | | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 |
if( zFile==0 ){
fprintf(stderr,"Can't read file \"%s\"\n",argv[1]);
exit(1);
}
pList = TokenizeFile(zFile,&sTable);
for(p=pList; p; p=p->pNext){
int j;
switch( p->eType ){
case TT_Space:
printf("%4d: Space\n",p->nLine);
break;
case TT_Id:
printf("%4d: Id %.*s\n",p->nLine,p->nText,p->zText);
break;
case TT_Preprocessor:
|
| ︙ | ︙ | |||
1328 1329 1330 1331 1332 1333 1334 |
case TT_Number:
printf("%s%.*s", needSpace ? " " : "", pFirst->nText, pFirst->zText);
needSpace = 1;
break;
default:
c = pFirst->zText[0];
| | | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 |
case TT_Number:
printf("%s%.*s", needSpace ? " " : "", pFirst->nText, pFirst->zText);
needSpace = 1;
break;
default:
c = pFirst->zText[0];
printf("%s%.*s",
(needSpace && (c=='*' || c=='{')) ? " " : "",
pFirst->nText, pFirst->zText);
needSpace = pFirst->zText[0]==',';
break;
}
pFirst = pFirst->pNext;
}
|
| ︙ | ︙ | |||
1369 1370 1371 1372 1373 1374 1375 |
int iSkip = 0;
int skipOne = 0;
StringInit(&str);
pLast = pLast->pNext;
while( pFirst!=pLast ){
if( pFirst==pSkip ){ iSkip = nSkip; }
| | | | | | 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 |
int iSkip = 0;
int skipOne = 0;
StringInit(&str);
pLast = pLast->pNext;
while( pFirst!=pLast ){
if( pFirst==pSkip ){ iSkip = nSkip; }
if( iSkip>0 ){
iSkip--;
pFirst=pFirst->pNext;
continue;
}
switch( pFirst->eType ){
case TT_Preprocessor:
StringAppend(&str,"\n",1);
StringAppend(&str,pFirst->zText,pFirst->nText);
StringAppend(&str,"\n",1);
needSpace = 0;
break;
case TT_Id:
switch( pFirst->zText[0] ){
case 'E':
if( pFirst->nText==6 && strncmp(pFirst->zText,"EXPORT",6)==0 ){
skipOne = 1;
}
break;
case 'P':
switch( pFirst->nText ){
case 6: skipOne = !strncmp(pFirst->zText,"PUBLIC", 6); break;
|
| ︙ | ︙ | |||
1643 1644 1645 1646 1647 1648 1649 |
return 0;
}
pLast = pLast->pNext;
for(p=pFirst; p && p!=pLast; p=p->pNext){
if( p->eType==TT_Id ){
static IdentTable sReserved;
static int isInit = 0;
| | | | | | 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 |
return 0;
}
pLast = pLast->pNext;
for(p=pFirst; p && p!=pLast; p=p->pNext){
if( p->eType==TT_Id ){
static IdentTable sReserved;
static int isInit = 0;
static const char *aWords[] = { "char", "class",
"const", "double", "enum", "extern", "EXPORT", "ET_PROC",
"float", "int", "long",
"PRIVATE", "PROTECTED", "PUBLIC",
"register", "static", "struct", "sizeof", "signed", "typedef",
"union", "volatile", "virtual", "void", };
if( !isInit ){
int i;
for(i=0; i<sizeof(aWords)/sizeof(aWords[0]); i++){
IdentTableInsert(&sReserved,aWords[i],0);
}
isInit = 1;
}
|
| ︙ | ︙ | |||
1766 1767 1768 1769 1770 1771 1772 |
return 0;
}
pCode = pLast;
while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){
pLast = pLast->pPrev;
}
if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){
| | | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 |
return 0;
}
pCode = pLast;
while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){
pLast = pLast->pPrev;
}
if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){
fprintf(stderr,"%s:%d: Unrecognized syntax.\n",
zFilename, pFirst->nLine);
return 1;
}
if( flags & (PS_Interface|PS_Export|PS_Local) ){
fprintf(stderr,"%s:%d: Missing \"inline\" on function or procedure.\n",
zFilename, pFirst->nLine);
return 1;
|
| ︙ | ︙ | |||
1847 1848 1849 1850 1851 1852 1853 |
fprintf(stderr,"%s:%d: malformed inline procedure definition\n",
zFilename, pFirst->nLine);
return 1;
}
#ifdef DEBUG
if( debugMask & PARSER ){
| | | 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 |
fprintf(stderr,"%s:%d: malformed inline procedure definition\n",
zFilename, pFirst->nLine);
return 1;
}
#ifdef DEBUG
if( debugMask & PARSER ){
printf("**** Found inline routine: %.*s on line %d...\n",
pName->nText, pName->zText, pFirst->nLine);
PrintTokens(pFirst,pEnd);
printf("\n");
}
#endif
pDecl = CreateDecl(pName->zText,pName->nText);
pDecl->pComment = pFirst->pComment;
|
| ︙ | ︙ | |||
1886 1887 1888 1889 1890 1891 1892 |
**
** If pEnd is ';', then the determination is more difficult. We have
** to search for an occurrence of an ID followed immediately by '('.
** If found, we have a prototype. Otherwise we are dealing with a
** variable definition.
*/
static int isVariableDef(Token *pFirst, Token *pEnd){
| | | 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 |
**
** If pEnd is ';', then the determination is more difficult. We have
** to search for an occurrence of an ID followed immediately by '('.
** If found, we have a prototype. Otherwise we are dealing with a
** variable definition.
*/
static int isVariableDef(Token *pFirst, Token *pEnd){
if( pEnd && pEnd->zText[0]=='=' &&
(pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
){
return 1;
}
while( pFirst && pFirst!=pEnd && pFirst->pNext && pFirst->pNext!=pEnd ){
if( pFirst->eType==TT_Id && pFirst->pNext->zText[0]=='(' ){
return 0;
|
| ︙ | ︙ | |||
1947 1948 1949 1950 1951 1952 1953 |
** option was specified or the "LOCAL" keyword is used. */
return nErr;
}
while( pFirst!=0 && pFirst->pNext!=pEnd &&
((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0)
|| (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0))
){
| | | | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 |
** option was specified or the "LOCAL" keyword is used. */
return nErr;
}
while( pFirst!=0 && pFirst->pNext!=pEnd &&
((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0)
|| (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0))
){
/* Lose the initial "static" or local from local variables.
** We'll prepend "extern" later. */
pFirst = pFirst->pNext;
isLocal = 1;
}
if( pFirst==0 || !isLocal ){
return nErr;
}
}else if( flags & PS_Method ){
/* Methods are declared by their class. Don't declare separately. */
return nErr;
}
isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd);
if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0
&& (flags & PS_Extern)==0 ){
fprintf(stderr,"%s:%d: Can't define a variable in this context\n",
zFilename, pFirst->nLine);
nErr++;
}
pName = FindDeclName(pFirst,pEnd->pPrev);
if( pName==0 ){
|
| ︙ | ︙ | |||
2093 2094 2095 2096 2097 2098 2099 |
nCmd = 1;
while( isalpha(zCmd[nCmd]) ){
nCmd++;
}
if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){
/*
| | | | 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 |
nCmd = 1;
while( isalpha(zCmd[nCmd]) ){
nCmd++;
}
if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){
/*
** Pop the if stack
*/
pIf = ifStack;
if( pIf==0 ){
fprintf(stderr,"%s:%d: extra '#endif'.\n",zFilename,pToken->nLine);
return 1;
}
ifStack = pIf->pNext;
SafeFree(pIf);
}else if( nCmd==6 && strncmp(zCmd,"define",6)==0 ){
/*
** Record a #define if we are in PS_Interface or PS_Export
*/
Decl *pDecl;
if( !(flags & (PS_Local|PS_Interface|PS_Export)) ){ return 0; }
zArg = &zCmd[6];
while( *zArg && isspace(*zArg) && *zArg!='\n' ){
zArg++;
}
|
| ︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 |
if( flags & PS_Export ){
DeclSetProperty(pDecl,DP_Export);
}else if( flags & PS_Local ){
DeclSetProperty(pDecl,DP_Local);
}
}else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){
/*
| | | 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 |
if( flags & PS_Export ){
DeclSetProperty(pDecl,DP_Export);
}else if( flags & PS_Local ){
DeclSetProperty(pDecl,DP_Local);
}
}else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){
/*
** Record an #include if we are in PS_Interface or PS_Export
*/
Include *pInclude;
char *zIf;
if( !(flags & (PS_Interface|PS_Export)) ){ return 0; }
zArg = &zCmd[7];
while( *zArg && isspace(*zArg) ){ zArg++; }
|
| ︙ | ︙ | |||
2182 2183 2184 2185 2186 2187 2188 |
PushIfMacro(0,0,0,pToken->nLine,PS_Export);
}else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){
PushIfMacro(0,0,0,pToken->nLine,PS_Local);
}else{
PushIfMacro(0,zArg,nArg,pToken->nLine,0);
}
}else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
| | | 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 |
PushIfMacro(0,0,0,pToken->nLine,PS_Export);
}else if( nArg==15 && strncmp(zArg,"LOCAL_INTERFACE",15)==0 ){
PushIfMacro(0,0,0,pToken->nLine,PS_Local);
}else{
PushIfMacro(0,zArg,nArg,pToken->nLine,0);
}
}else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
/*
** Push an #ifdef.
*/
zArg = &zCmd[5];
while( *zArg && isspace(*zArg) && *zArg!='\n' ){
zArg++;
}
if( *zArg==0 || *zArg=='\n' ){ return 0; }
|
| ︙ | ︙ | |||
2205 2206 2207 2208 2209 2210 2211 |
zArg++;
}
if( *zArg==0 || *zArg=='\n' ){ return 0; }
nArg = pToken->nText + (int)(pToken->zText - zArg);
PushIfMacro("!defined",zArg,nArg,pToken->nLine,0);
}else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){
/*
| | | | | | | | 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 |
zArg++;
}
if( *zArg==0 || *zArg=='\n' ){ return 0; }
nArg = pToken->nText + (int)(pToken->zText - zArg);
PushIfMacro("!defined",zArg,nArg,pToken->nLine,0);
}else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){
/*
** Invert the #if on the top of the stack
*/
if( ifStack==0 ){
fprintf(stderr,"%s:%d: '#else' without an '#if'\n",zFilename,
pToken->nLine);
return 1;
}
pIf = ifStack;
if( pIf->zCondition ){
ifStack = ifStack->pNext;
PushIfMacro("!",pIf->zCondition,strlen(pIf->zCondition),pIf->nLine,0);
SafeFree(pIf);
}else{
pIf->flags = 0;
}
}else{
/*
** This directive can be safely ignored
*/
return 0;
}
/*
** Recompute the preset flags
*/
*pPresetFlags = 0;
for(pIf = ifStack; pIf; pIf=pIf->pNext){
*pPresetFlags |= pIf->flags;
}
return nErr;
}
/*
** Parse an entire file. Return the number of errors.
**
** pList is a list of tokens in the file. Whitespace tokens have been
** eliminated, and text with {...} has been collapsed into a
** single TT_Brace token.
**
** initFlags are a set of parse flags that should always be set for this
** file. For .c files this is normally 0. For .h files it is PS_Interface.
*/
static int ParseFile(Token *pList, int initFlags){
int nErr = 0;
Token *pStart = 0;
int flags = initFlags;
|
| ︙ | ︙ | |||
2277 2278 2279 2280 2281 2282 2283 |
case ';':
nErr += ProcessDecl(pStart,pList,flags);
pStart = 0;
flags = presetFlags;
break;
case '=':
| | | 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 |
case ';':
nErr += ProcessDecl(pStart,pList,flags);
pStart = 0;
flags = presetFlags;
break;
case '=':
if( pList->pPrev->nText==8
&& strncmp(pList->pPrev->zText,"operator",8)==0 ){
break;
}
nErr += ProcessDecl(pStart,pList,flags);
pStart = 0;
while( pList && pList->zText[0]!=';' ){
pList = pList->pNext;
|
| ︙ | ︙ | |||
2469 2470 2471 2472 2473 2474 2475 | pDecl->zDecl = StrDup(StringGet(&str), 0); StringReset(&str); pDecl->zExtra = 0; } /* ** Reset the DP_Forward and DP_Declared flags on all Decl structures. | | | 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 |
pDecl->zDecl = StrDup(StringGet(&str), 0);
StringReset(&str);
pDecl->zExtra = 0;
}
/*
** Reset the DP_Forward and DP_Declared flags on all Decl structures.
** Set both flags for anything that is tagged as local and isn't
** in the file zFilename so that it won't be printing in other files.
*/
static void ResetDeclFlags(char *zFilename){
Decl *pDecl;
for(pDecl = pDeclFirst; pDecl; pDecl = pDecl->pNext){
DeclClearProperty(pDecl,DP_Forward|DP_Declared);
|
| ︙ | ︙ | |||
2572 2573 2574 2575 2576 2577 2578 |
){
Decl *p; /* The object to be declared */
int flag;
int isCpp; /* True if generating C++ */
int doneTypedef = 0; /* True if a typedef has been done for this object */
/* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/
| | | 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 |
){
Decl *p; /* The object to be declared */
int flag;
int isCpp; /* True if generating C++ */
int doneTypedef = 0; /* True if a typedef has been done for this object */
/* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/
/*
** For any object that has a forward declaration, go ahead and do the
** forward declaration first.
*/
isCpp = (pState->flags & DP_Cplusplus) != 0;
for(p=pDecl; p; p=p->pSameName){
if( p->zFwd ){
if( !DeclHasProperty(p,DP_Forward) ){
|
| ︙ | ︙ | |||
2624 2625 2626 2627 2628 2629 2630 |
** with the DP_Flag bit. We are only able to use DP_Flag in this
** way because we know we'll never execute this far into this
** function on a recursive call with the same pDecl. Hence, recursive
** calls to this function (through ScanText()) can never change the
** value of DP_Flag out from under us.
*/
for(p=pDecl; p; p=p->pSameName){
| | | | 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 |
** with the DP_Flag bit. We are only able to use DP_Flag in this
** way because we know we'll never execute this far into this
** function on a recursive call with the same pDecl. Hence, recursive
** calls to this function (through ScanText()) can never change the
** value of DP_Flag out from under us.
*/
for(p=pDecl; p; p=p->pSameName){
if( !DeclHasProperty(p,DP_Declared)
&& (p->zFwd==0 || needFullDecl)
&& p->zDecl!=0
){
DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
}else{
DeclClearProperty(p,DP_Flag);
}
}
|
| ︙ | ︙ | |||
2733 2734 2735 2736 2737 2738 2739 |
/*
** See if there is a declaration in the database with the name given
** by sToken.
*/
pDecl = FindDecl(sToken.zText,sToken.nText);
if( pDecl==0 ) continue;
| | | | 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 |
/*
** See if there is a declaration in the database with the name given
** by sToken.
*/
pDecl = FindDecl(sToken.zText,sToken.nText);
if( pDecl==0 ) continue;
/*
** If we get this far, we've found an identifier that has a
** declaration in the database. Now see if we the full declaration
** or just a forward declaration.
*/
GetNonspaceToken(&sIn,&sNext);
if( sNext.zText[0]=='*' ){
needFullDecl = 0;
}else{
|
| ︙ | ︙ | |||
2768 2769 2770 2771 2772 2773 2774 |
static void CompleteForwardDeclarations(GenState *pState){
Decl *pDecl;
int progress;
do{
progress = 0;
for(pDecl=pDeclFirst; pDecl; pDecl=pDecl->pNext){
| | | | 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 |
static void CompleteForwardDeclarations(GenState *pState){
Decl *pDecl;
int progress;
do{
progress = 0;
for(pDecl=pDeclFirst; pDecl; pDecl=pDecl->pNext){
if( DeclHasProperty(pDecl,DP_Forward)
&& !DeclHasProperty(pDecl,DP_Declared)
){
DeclareObject(pDecl,pState,1);
progress = 1;
assert( DeclHasProperty(pDecl,DP_Declared) );
}
}
}while( progress );
|
| ︙ | ︙ | |||
2840 2841 2842 2843 2844 2845 2846 |
if( WriteFile(pFile->zHdr,zNewVersion) ){
fprintf(stderr,"%s: Can't write to file\n",pFile->zHdr);
nErr++;
}
}else if( report ){
fprintf(report,"unchanged\n");
}
| | | 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 |
if( WriteFile(pFile->zHdr,zNewVersion) ){
fprintf(stderr,"%s: Can't write to file\n",pFile->zHdr);
nErr++;
}
}else if( report ){
fprintf(report,"unchanged\n");
}
SafeFree(zOldVersion);
IdentTableReset(&includeTable);
StringReset(&outStr);
return nErr;
}
/*
** Generate a global header file -- a header file that contains all
|
| ︙ | ︙ | |||
2876 2877 2878 2879 2880 2881 2882 |
DeclareObject(pDecl,&sState,1);
}
}
ChangeIfContext(0,&sState);
printf("%s",StringGet(&outStr));
IdentTableReset(&includeTable);
StringReset(&outStr);
| | | 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 |
DeclareObject(pDecl,&sState,1);
}
}
ChangeIfContext(0,&sState);
printf("%s",StringGet(&outStr));
IdentTableReset(&includeTable);
StringReset(&outStr);
return 0;
}
#ifdef DEBUG
/*
** Return the number of characters in the given string prior to the
** first newline.
*/
|
| ︙ | ︙ | |||
3038 3039 3040 3041 3042 3043 3044 |
*/
static InFile *CreateInFile(char *zArg, int *pnErr){
int nSrc;
char *zSrc;
InFile *pFile;
int i;
| | | 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 |
*/
static InFile *CreateInFile(char *zArg, int *pnErr){
int nSrc;
char *zSrc;
InFile *pFile;
int i;
/*
** Get the name of the input file to be scanned. The input file is
** everything before the first ':' or the whole file if no ':' is seen.
**
** Except, on windows, ignore any ':' that occurs as the second character
** since it might be part of the drive specifier. So really, the ":' has
** to be the 3rd or later character in the name. This precludes 1-character
** file names, which really should not be a problem.
|
| ︙ | ︙ | |||
3097 3098 3099 3100 3101 3102 3103 |
SafeFree(pFile->zHdr);
pFile->zHdr = 0;
}
}
/*
** If pFile->zSrc contains no 'c' or 'C' in its extension, it
| | | | 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 |
SafeFree(pFile->zHdr);
pFile->zHdr = 0;
}
}
/*
** If pFile->zSrc contains no 'c' or 'C' in its extension, it
** must be a header file. In that case, we need to set the
** PS_Interface flag.
*/
pFile->flags |= PS_Interface;
for(i=nSrc-1; i>0 && zSrc[i]!='.'; i--){
if( zSrc[i]=='c' || zSrc[i]=='C' ){
pFile->flags &= ~PS_Interface;
break;
}
}
/* Done!
*/
return pFile;
}
/* MS-Windows and MS-DOS both have the following serious OS bug: the
** length of a command line is severely restricted. But this program
** occasionally requires long command lines. Hence the following
|
| ︙ | ︙ | |||
3160 3161 3162 3163 3164 3165 3166 |
}
c = ' ';
while( c!=EOF ){
while( c!=EOF && isspace(c) ){
if( c=='\n' ){
startOfLine = 1;
}
| | | 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 |
}
c = ' ';
while( c!=EOF ){
while( c!=EOF && isspace(c) ){
if( c=='\n' ){
startOfLine = 1;
}
c = getc(in);
if( startOfLine && c=='#' ){
while( c!=EOF && c!='\n' ){
c = getc(in);
}
}
}
n = 0;
|
| ︙ | ︙ | |||
3182 3183 3184 3185 3186 3187 3188 |
nNew++;
if( nNew + argc > nAlloc ){
if( nAlloc==0 ){
nAlloc = 100 + argc;
zNew = malloc( sizeof(char*) * nAlloc );
}else{
nAlloc *= 2;
| | | 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 |
nNew++;
if( nNew + argc > nAlloc ){
if( nAlloc==0 ){
nAlloc = 100 + argc;
zNew = malloc( sizeof(char*) * nAlloc );
}else{
nAlloc *= 2;
zNew = realloc( zNew, sizeof(char*) * nAlloc );
}
}
if( zNew ){
int j = nNew + index;
zNew[j] = malloc( n + 1 );
if( zNew[j] ){
strcpy( zNew[j], zBuf );
|
| ︙ | ︙ | |||
3252 3253 3254 3255 3256 3257 3258 | ); } /* ** The following text contains a few simple #defines that we want ** to be available to every file. */ | | | 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 | ); } /* ** The following text contains a few simple #defines that we want ** to be available to every file. */ static const char zInit[] = "#define INTERFACE 0\n" "#define EXPORT_INTERFACE 0\n" "#define LOCAL_INTERFACE 0\n" "#define EXPORT\n" "#define LOCAL static\n" "#define PUBLIC\n" "#define PRIVATE\n" |
| ︙ | ︙ |
Changes to src/makemake.tcl.
1 2 | #!/usr/bin/tclsh # | | | 1 2 3 4 5 6 7 8 9 10 | #!/usr/bin/tclsh # # Run this Tcl script to generate the various makefiles for a variety # of platforms. Files generated include: # # src/main.mk # makefile for all unix systems # win/Makefile.mingw # makefile for mingw on windows # win/Makefile.* # makefiles for other windows compilers # # Run this script while in the "src" subdirectory. Like this: |
| ︙ | ︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | sha1 shun sitemap skins sqlcmd stash stat style sync tag tar th_main timeline tkt | > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | sha1 shun sitemap skins sqlcmd stash stat statrep style sync tag tar th_main timeline tkt |
| ︙ | ︙ | |||
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 |
http_ssl
}
# Additional resource files that get built into the executable.
#
set extra_files {
diff.tcl
}
# Options used to compile the included SQLite library.
#
set SQLITE_OPTIONS {
-DNDEBUG=1
-DSQLITE_OMIT_LOAD_EXTENSION=1
-DSQLITE_ENABLE_LOCKING_STYLE=0
-DSQLITE_THREADSAFE=0
-DSQLITE_DEFAULT_FILE_FORMAT=4
-DSQLITE_OMIT_DEPRECATED
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
}
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_FTS3=1
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_STAT4
#lappend SQLITE_OPTIONS -DSQLITE_WIN32_NO_ANSI
#lappend SQLITE_OPTIONS -DSQLITE_WINNT_MAX_PATH_CHARS=4096
# Options used to compile the included SQLite shell.
| > > > > | 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 |
http_ssl
}
# Additional resource files that get built into the executable.
#
set extra_files {
diff.tcl
markdown.md
../skins/*/*.txt
}
# Options used to compile the included SQLite library.
#
set SQLITE_OPTIONS {
-DNDEBUG=1
-DSQLITE_OMIT_LOAD_EXTENSION=1
-DSQLITE_ENABLE_LOCKING_STYLE=0
-DSQLITE_THREADSAFE=0
-DSQLITE_DEFAULT_FILE_FORMAT=4
-DSQLITE_OMIT_DEPRECATED
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
-DSQLITE_ENABLE_FTS4
-DSQLITE_ENABLE_FTS3_PARENTHESIS
}
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_FTS3=1
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_STAT4
#lappend SQLITE_OPTIONS -DSQLITE_WIN32_NO_ANSI
#lappend SQLITE_OPTIONS -DSQLITE_WINNT_MAX_PATH_CHARS=4096
# Options used to compile the included SQLite shell.
|
| ︙ | ︙ | |||
201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
puts $output_file [lindex $args 0]
}
}
# STOP HERE.
# Unless the build procedures changes, you should not have to edit anything
# below this line.
##############################################################################
##############################################################################
##############################################################################
# Start by generating the "main.mk" makefile used for all unix systems.
#
puts "building main.mk"
| > > > > > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
puts $output_file [lindex $args 0]
}
}
# STOP HERE.
# Unless the build procedures changes, you should not have to edit anything
# below this line.
# Expand any wildcards in "extra_files"
set new_extra_files {}
foreach file $extra_files {
foreach x [glob -nocomplain $file] {
lappend new_extra_files $x
}
}
set extra_files $new_extra_files
##############################################################################
##############################################################################
##############################################################################
# Start by generating the "main.mk" makefile used for all unix systems.
#
puts "building main.mk"
|
| ︙ | ︙ | |||
360 361 362 363 364 365 366 | #append mhargs "\$(SRCDIR)/cson_amalgamation.h <<<NEXT_LINE>>>" append mhargs "\$(OBJDIR)/VERSION.h" set mhargs [string map [list <<<NEXT_LINE>>> \\\n\t] $mhargs] writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(OBJDIR)/mkindex" writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >\$@\n" writeln "\$(OBJDIR)/builtin_data.h: \$(OBJDIR)/mkbuiltin \$(EXTRA_FILES)" | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | #append mhargs "\$(SRCDIR)/cson_amalgamation.h <<<NEXT_LINE>>>" append mhargs "\$(OBJDIR)/VERSION.h" set mhargs [string map [list <<<NEXT_LINE>>> \\\n\t] $mhargs] writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(OBJDIR)/mkindex" writeln "\t\$(OBJDIR)/mkindex \$(TRANS_SRC) >\$@\n" writeln "\$(OBJDIR)/builtin_data.h: \$(OBJDIR)/mkbuiltin \$(EXTRA_FILES)" writeln "\t\$(OBJDIR)/mkbuiltin --prefix \$(SRCDIR)/ \$(EXTRA_FILES) >\$@\n" writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(OBJDIR)/makeheaders \$(OBJDIR)/VERSION.h" writeln "\t\$(OBJDIR)/makeheaders $mhargs" writeln "\ttouch \$(OBJDIR)/headers" writeln "\$(OBJDIR)/headers: Makefile" writeln "\$(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 : \$(SRCDIR)/json_detail.h" writeln "Makefile:" |
| ︙ | ︙ | |||
571 572 573 574 575 576 577 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | > | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2 OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If # this points to the Tcl source code directory, this directory must # have "generic" and "win" sub-directories. The recommended usage |
| ︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | append mhargs " \\\n\t\t\$(SRCDIR)/sqlite3.h" append mhargs " \\\n\t\t\$(SRCDIR)/th.h" append mhargs " \\\n\t\t\$(OBJDIR)/VERSION.h" writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(MKINDEX)" writeln "\t\$(MKINDEX) \$(TRANS_SRC) >\$@\n" writeln "\$(OBJDIR)/builtin_data.h:\t\$(MKBUILTIN) \$(EXTRA_FILES)" | | | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | append mhargs " \\\n\t\t\$(SRCDIR)/sqlite3.h" append mhargs " \\\n\t\t\$(SRCDIR)/th.h" append mhargs " \\\n\t\t\$(OBJDIR)/VERSION.h" writeln "\$(OBJDIR)/page_index.h: \$(TRANS_SRC) \$(MKINDEX)" writeln "\t\$(MKINDEX) \$(TRANS_SRC) >\$@\n" writeln "\$(OBJDIR)/builtin_data.h:\t\$(MKBUILTIN) \$(EXTRA_FILES)" writeln "\t\$(MKBUILTIN) --prefix \$(SRCDIR)/ \$(EXTRA_FILES) >\$@\n" writeln "\$(OBJDIR)/headers:\t\$(OBJDIR)/page_index.h \$(OBJDIR)/builtin_data.h \$(MAKEHEADERS) \$(OBJDIR)/VERSION.h" writeln "\t\$(MAKEHEADERS) $mhargs" writeln "\techo Done >\$(OBJDIR)/headers\n" writeln "\$(OBJDIR)/headers: Makefile\n" writeln "Makefile:\n" set extra_h(main) " \$(OBJDIR)/page_index.h " |
| ︙ | ︙ | |||
1191 1192 1193 1194 1195 1196 1197 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION +$** > $@ page_index.h: mkindex$E $(SRC) +$** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) | | | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION +$** > $@ page_index.h: mkindex$E $(SRC) +$** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) mkbuiltin$E --prefix $(SRCDIR)/ $(EXTRA_FILES) > $@ clean: -del $(OBJDIR)\*.obj -del *.obj *_.c *.h *.map realclean: -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E codecheck1$E mkbuiltin$E |
| ︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL | | | 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL SSLDIR = $(B)\compat\openssl-1.0.2 SSLINCDIR = $(SSLDIR)\inc32 SSLLIBDIR = $(SSLDIR)\out32 SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... # BUGBUG (OpenSSL): Apparently, using "no-ssl*" here breaks the build. |
| ︙ | ︙ | |||
1585 1586 1587 1588 1589 1590 1591 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c $(TCC) /Fo$@ /c $** page_index.h: mkindex$E $(SRC) $** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) | | | 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c $(TCC) /Fo$@ /c $** page_index.h: mkindex$E $(SRC) $** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) mkbuiltin$E --prefix $(SRCDIR)/ $(EXTRA_FILES) > $@ clean: -del $(OX)\*.obj -del *.obj -del *_.c -del *.h -del *.ilk |
| ︙ | ︙ | |||
1817 1818 1819 1820 1821 1822 1823 | translate.exe $< >$@ # generate the index source, containing all web references,.. page_index.h: $(TRANSLATEDSRC) mkindex.exe mkindex.exe $(TRANSLATEDSRC) >$@ builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe | | | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | translate.exe $< >$@ # generate the index source, containing all web references,.. page_index.h: $(TRANSLATEDSRC) mkindex.exe mkindex.exe $(TRANSLATEDSRC) >$@ builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe mkbuiltin.exe --prefix $(SRCDIR)/ $(EXTRA_FILES) >$@ # extracting version info from manifest VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@ # generate the simplified headers headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h |
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1185 1186 1187 1188 1189 1190 1191 | } /* ** Add a single entry to the mlink table. Also add the filename to ** the filename table if it is not there already. */ static void add_one_mlink( | | | > | > | 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 |
}
/*
** Add a single entry to the mlink table. Also add the filename to
** the filename table if it is not there already.
*/
static void add_one_mlink(
int pmid, /* The parent manifest */
const char *zFromUuid, /* UUID for content in parent */
int mid, /* The record ID of the manifest */
const char *zToUuid, /* UUID for content in child */
const char *zFilename, /* Filename */
const char *zPrior, /* Previous filename. NULL if unchanged */
int isPublic, /* True if mid is not a private manifest */
int isPrimary, /* pmid is the primary parent of mid */
int mperm /* 1: exec, 2: symlink */
){
int fnid, pfnid, pid, fid;
static Stmt s1;
fnid = filename_to_fnid(zFilename);
if( zPrior==0 ){
|
| ︙ | ︙ | |||
1214 1215 1216 1217 1218 1219 1220 |
if( zToUuid==0 || zToUuid[0]==0 ){
fid = 0;
}else{
fid = uuid_to_rid(zToUuid, 1);
if( isPublic ) content_make_public(fid);
}
db_static_prepare(&s1,
| | | | | > > | 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 |
if( zToUuid==0 || zToUuid[0]==0 ){
fid = 0;
}else{
fid = uuid_to_rid(zToUuid, 1);
if( isPublic ) content_make_public(fid);
}
db_static_prepare(&s1,
"INSERT INTO mlink(mid,fid,pmid,pid,fnid,pfnid,mperm,isaux)"
"VALUES(:m,:f,:pm,:p,:n,:pfn,:mp,:isaux)"
);
db_bind_int(&s1, ":m", mid);
db_bind_int(&s1, ":f", fid);
db_bind_int(&s1, ":pm", pmid);
db_bind_int(&s1, ":p", pid);
db_bind_int(&s1, ":n", fnid);
db_bind_int(&s1, ":pfn", pfnid);
db_bind_int(&s1, ":mp", mperm);
db_bind_int(&s1, ":isaux", isPrimary==0);
db_exec(&s1);
if( pid && fid ){
content_deltify(pid, fid, 0);
}
}
/*
|
| ︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | ** A single mlink entry is added for every file that changed content, ** name, and/or permissions going from pid to cid. ** ** Deleted files have mlink.fid=0. ** Added files have mlink.pid=0. ** Edited files have both mlink.pid!=0 and mlink.fid!=0 */ | | > > > > | | | | > | | | | | | 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 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 |
** A single mlink entry is added for every file that changed content,
** name, and/or permissions going from pid to cid.
**
** Deleted files have mlink.fid=0.
** Added files have mlink.pid=0.
** Edited files have both mlink.pid!=0 and mlink.fid!=0
*/
static void add_mlink(
int pmid, Manifest *pParent, /* Parent check-in */
int mid, Manifest *pChild, /* The child check-in */
int isPrim /* TRUE if pmid is the primary parent of mid */
){
Blob otherContent;
int otherRid;
int i, rc;
ManifestFile *pChildFile, *pParentFile;
Manifest **ppOther;
static Stmt eq;
int isPublic; /* True if pChild is non-private */
/* If mlink table entires are already exist for the pmid-to-mid transition,
** then abort early doing no work.
*/
db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid AND pmid=:pmid");
db_bind_int(&eq, ":mid", mid);
db_bind_int(&eq, ":pmid", pmid);
rc = db_step(&eq);
db_reset(&eq);
if( rc==SQLITE_ROW ) return;
/* Compute the value of the missing pParent or pChild parameter.
** Fetch the baseline checkins for both.
*/
assert( pParent==0 || pChild==0 );
if( pParent==0 ){
ppOther = &pParent;
otherRid = pmid;
}else{
ppOther = &pChild;
otherRid = mid;
}
if( (*ppOther = manifest_cache_find(otherRid))==0 ){
content_get(otherRid, &otherContent);
if( blob_size(&otherContent)==0 ) return;
*ppOther = manifest_parse(&otherContent, otherRid, 0);
if( *ppOther==0 ) return;
}
if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
manifest_destroy(*ppOther);
return;
}
isPublic = !content_is_private(mid);
/* Try to make the parent manifest a delta from the child, if that
** is an appropriate thing to do. For a new baseline, make the
** previous baseline a delta from the current baseline.
*/
if( (pParent->zBaseline==0)==(pChild->zBaseline==0) ){
content_deltify(pmid, mid, 0);
}else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
content_deltify(pParent->pBaseline->rid, mid, 0);
}
/* Remember all children less than a few seconds younger than their parent,
** as we might want to fudge the times for those children.
*/
if( pChild->rDate<pParent->rDate+AGE_FUDGE_WINDOW
&& manifest_crosslink_busy
|
| ︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 |
*/
for(i=0, pChildFile=pChild->aFile; i<pChild->nFile; i++, pChildFile++){
int mperm = manifest_file_mperm(pChildFile);
if( pChildFile->zPrior ){
pParentFile = manifest_file_seek(pParent, pChildFile->zPrior, 0);
if( pParentFile ){
/* File with name change */
| | | > | | | | | | | | | | | | | 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
*/
for(i=0, pChildFile=pChild->aFile; i<pChild->nFile; i++, pChildFile++){
int mperm = manifest_file_mperm(pChildFile);
if( pChildFile->zPrior ){
pParentFile = manifest_file_seek(pParent, pChildFile->zPrior, 0);
if( pParentFile ){
/* File with name change */
add_one_mlink(pmid, pParentFile->zUuid, mid, pChildFile->zUuid,
pChildFile->zName, pChildFile->zPrior,
isPublic, isPrim, mperm);
}else{
/* File name changed, but the old name is not found in the parent!
** Treat this like a new file. */
add_one_mlink(pmid, 0, mid, pChildFile->zUuid, pChildFile->zName, 0,
isPublic, isPrim, mperm);
}
}else{
pParentFile = manifest_file_seek(pParent, pChildFile->zName, 0);
if( pParentFile==0 ){
if( pChildFile->zUuid ){
/* A new file */
add_one_mlink(pmid, 0, mid, pChildFile->zUuid, pChildFile->zName, 0,
isPublic, isPrim, mperm);
}
}else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0
|| manifest_file_mperm(pParentFile)!=mperm ){
/* Changes in file content or permissions */
add_one_mlink(pmid, pParentFile->zUuid, mid, pChildFile->zUuid,
pChildFile->zName, 0, isPublic, isPrim, mperm);
}
}
}
if( pParent->zBaseline && pChild->zBaseline ){
/* Both parent and child are delta manifests. Look for files that
** are deleted or modified in the parent but which reappear or revert
** to baseline in the child and show such files as being added or changed
** in the child. */
for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){
if( pParentFile->zUuid ){
pChildFile = manifest_file_seek_base(pChild, pParentFile->zName, 0);
if( pChildFile==0 ){
/* The child file reverts to baseline. Show this as a change */
pChildFile = manifest_file_seek(pChild, pParentFile->zName, 0);
if( pChildFile ){
add_one_mlink(pmid, pParentFile->zUuid, mid, pChildFile->zUuid,
pChildFile->zName, 0, isPublic, isPrim,
manifest_file_mperm(pChildFile));
}
}
}else{
pChildFile = manifest_file_seek(pChild, pParentFile->zName, 0);
if( pChildFile ){
/* File resurrected in the child after having been deleted in
** the parent. Show this as an added file. */
add_one_mlink(pmid, 0, mid, pChildFile->zUuid, pChildFile->zName, 0,
isPublic, isPrim, manifest_file_mperm(pChildFile));
}
}
}
}else if( pChild->zBaseline==0 ){
/* pChild is a baseline. Look for files that are present in pParent
** but are missing from pChild and mark them as having been deleted. */
manifest_file_rewind(pParent);
while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
pChildFile = manifest_file_seek(pChild, pParentFile->zName, 0);
if( pChildFile==0 && pParentFile->zUuid!=0 ){
add_one_mlink(pmid, pParentFile->zUuid, mid, 0, pParentFile->zName, 0,
isPublic, isPrim, 0);
}
}
}
manifest_cache_insert(*ppOther);
}
/*
|
| ︙ | ︙ | |||
1609 1610 1611 1612 1613 1614 1615 |
if( !isNew ){
for(i=0; i<pManifest->nField; i++){
if( fossil_strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
zNewStatus = pManifest->aField[i].zValue;
}
}
if( zNewStatus ){
| | | | | | | | 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 |
if( !isNew ){
for(i=0; i<pManifest->nField; i++){
if( fossil_strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
zNewStatus = pManifest->aField[i].zValue;
}
}
if( zNewStatus ){
blob_appendf(&comment, "%h ticket [%!S|%S]: <i>%h</i>",
zNewStatus, pManifest->zTicketUuid, pManifest->zTicketUuid, zTitle
);
if( pManifest->nField>1 ){
blob_appendf(&comment, " plus %d other change%s",
pManifest->nField-1, pManifest->nField==2 ? "" : "s");
}
blob_appendf(&brief, "%h ticket [%!S|%S].",
zNewStatus, pManifest->zTicketUuid, pManifest->zTicketUuid);
}else{
zNewStatus = db_text("unknown",
"SELECT \"%w\" FROM ticket WHERE tkt_uuid=%Q",
zStatusColumn, pManifest->zTicketUuid
);
blob_appendf(&comment, "Ticket [%!S|%S] <i>%h</i> status still %h with "
"%d other change%s",
pManifest->zTicketUuid, pManifest->zTicketUuid, zTitle, zNewStatus,
pManifest->nField, pManifest->nField==1 ? "" : "s"
);
fossil_free(zNewStatus);
blob_appendf(&brief, "Ticket [%!S|%S]: %d change%s",
pManifest->zTicketUuid, pManifest->zTicketUuid, pManifest->nField,
pManifest->nField==1 ? "" : "s"
);
}
}else{
blob_appendf(&comment, "New ticket [%!S|%S] <i>%h</i>.",
pManifest->zTicketUuid, pManifest->zTicketUuid, zTitle
);
blob_appendf(&brief, "New ticket [%!S|%S].", pManifest->zTicketUuid,
pManifest->zTicketUuid);
}
fossil_free(zTitle);
db_multi_exec(
"REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
"VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
tktTagId, pManifest->rDate, rid, pManifest->zUser,
|
| ︙ | ︙ | |||
1744 1745 1746 1747 1748 1749 1750 |
const char *zUuid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
assert( blob_is_reset(pContent) || pContent==0 );
if( (flags & MC_NO_ERRORS)==0 ){
| | | < < < | | | | < < < < < < < < < | | | > > > > > > > > > > > > | > | | | > | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 |
const char *zUuid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
assert( blob_is_reset(pContent) || pContent==0 );
if( (flags & MC_NO_ERRORS)==0 ){
fossil_error(1, "syntax error in manifest [%S]",
db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
}
return 0;
}
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "no manifest");
return 0;
}
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
if( (flags & MC_NO_ERRORS)==0 ){
fossil_error(1, "cannot fetch baseline for manifest [%S]",
db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
}
return 0;
}
db_begin_transaction();
if( p->type==CFTYPE_MANIFEST ){
if( permitHooks ){
zScript = xfer_commit_code();
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
char *zCom;
char zBaseId[30];
if( p->zBaseline ){
sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
uuid_to_rid(p->zBaseline,1));
}else{
sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
}
for(i=0; i<p->nParent; i++){
int pid = uuid_to_rid(p->azParent[i], 1);
db_multi_exec(
"INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
"VALUES(%d, %d, %d, %.17g, %s)",
pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/);
add_mlink(pid, 0, rid, p, i==0);
if( i==0 ) parentid = pid;
}
if( p->nParent>1 ){
/* Remove incorrect MLINK create-file entries that arise when a
** file is added by merge. */
db_multi_exec(
"DELETE FROM mlink"
" WHERE mid=%d"
" AND pid=0"
" AND fnid IN "
" (SELECT fnid FROM mlink WHERE mid=%d GROUP BY fnid"
" HAVING count(*)<%d)",
rid, rid, p->nParent
);
}
db_prepare(&q, "SELECT cid, isprim FROM plink WHERE pid=%d", rid);
while( db_step(&q)==SQLITE_ROW ){
int cid = db_column_int(&q, 0);
int isprim = db_column_int(&q, 1);
add_mlink(rid, p, cid, 0, isprim);
}
db_finalize(&q);
if( p->nParent==0 ){
/* For root files (files without parents) add mlink entries
** showing all content as new. */
int isPublic = !content_is_private(rid);
for(i=0; i<p->nFile; i++){
add_one_mlink(0, 0, rid, p->aFile[i].zUuid, p->aFile[i].zName, 0,
isPublic, 1, manifest_file_mperm(&p->aFile[i]));
}
}
search_doc_touch('c', rid, 0);
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,user,comment,"
"bgcolor,euser,ecomment,omtime)"
"VALUES('ci',"
" coalesce("
" (SELECT julianday(value) FROM tagxref WHERE tagid=%d AND rid=%d),"
" %.17g"
|
| ︙ | ︙ | |||
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 |
content_deltify(prior, rid, 0);
}
if( nWiki>0 ){
zComment = mprintf("Changes to wiki page [%h]", p->zWikiTitle);
}else{
zComment = mprintf("Deleted wiki page [%h]", p->zWikiTitle);
}
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,user,comment,"
" bgcolor,euser,ecomment)"
"VALUES('w',%.17g,%d,%Q,%Q,"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>1),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
| > | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
content_deltify(prior, rid, 0);
}
if( nWiki>0 ){
zComment = mprintf("Changes to wiki page [%h]", p->zWikiTitle);
}else{
zComment = mprintf("Deleted wiki page [%h]", p->zWikiTitle);
}
search_doc_touch('w',rid,p->zWikiTitle);
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,user,comment,"
" bgcolor,euser,ecomment)"
"VALUES('w',%.17g,%d,%Q,%Q,"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>1),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
|
| ︙ | ︙ | |||
1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 |
tagid, tagid
);
}
}
if( subsequent ){
content_deltify(rid, subsequent, 0);
}else{
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"
"VALUES('e',%.17g,%d,%d,%Q,%Q,"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
p->rEventDate, rid, tagid, p->zUser, p->zComment,
TAG_BGCOLOR, rid
);
| > | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
tagid, tagid
);
}
}
if( subsequent ){
content_deltify(rid, subsequent, 0);
}else{
search_doc_touch('e',rid,0);
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"
"VALUES('e',%.17g,%d,%d,%Q,%Q,"
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
p->rEventDate, rid, tagid, p->zUser, p->zComment,
TAG_BGCOLOR, rid
);
|
| ︙ | ︙ | |||
2015 2016 2017 2018 2019 2020 2021 |
" WHERE target=%Q AND filename=%Q",
p->zAttachTarget, p->zAttachName,
p->zAttachTarget, p->zAttachName
);
if( 'w' == attachToType ){
if( isAdd ){
zComment = mprintf(
| | | | | 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 |
" WHERE target=%Q AND filename=%Q",
p->zAttachTarget, p->zAttachName,
p->zAttachTarget, p->zAttachName
);
if( 'w' == attachToType ){
if( isAdd ){
zComment = mprintf(
"Add attachment [/artifact/%!S|%h] to wiki page [%h]",
p->zAttachSrc, p->zAttachName, p->zAttachTarget);
}else{
zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",
p->zAttachName, p->zAttachTarget);
}
}else{
if( isAdd ){
zComment = mprintf(
"Add attachment [/artifact/%!S|%h] to ticket [%!S|%S]",
p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
}else{
zComment = mprintf("Delete attachment \"%h\" from ticket [%!S|%S]",
p->zAttachName, p->zAttachTarget, p->zAttachTarget);
}
}
db_multi_exec(
"REPLACE INTO event(type,mtime,objid,user,comment)"
"VALUES('%c',%.17g,%d,%Q,%Q)",
attachToType, p->rDate, rid, p->zUser, zComment
|
| ︙ | ︙ | |||
2056 2057 2058 2059 2060 2061 2062 |
/* Next loop expects tags to be sorted on UUID, so sort it. */
qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
for(i=0; i<p->nTag; i++){
zTagUuid = p->aTag[i].zUuid;
if( !zTagUuid ) continue;
if( i==0 || fossil_strcmp(zTagUuid, p->aTag[i-1].zUuid)!=0 ){
blob_appendf(&comment,
| | | | 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 2095 2096 2097 2098 |
/* Next loop expects tags to be sorted on UUID, so sort it. */
qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
for(i=0; i<p->nTag; i++){
zTagUuid = p->aTag[i].zUuid;
if( !zTagUuid ) continue;
if( i==0 || fossil_strcmp(zTagUuid, p->aTag[i-1].zUuid)!=0 ){
blob_appendf(&comment,
" Edit [%!S|%S]:",
zTagUuid, zTagUuid);
branchMove = 0;
if( permitHooks && db_exists("SELECT 1 FROM event, blob"
" WHERE event.type='ci' AND event.objid=blob.rid"
" AND blob.uuid=%Q", zTagUuid) ){
zScript = xfer_commit_code();
zUuid = zTagUuid;
}
}
zName = p->aTag[i].zName;
zValue = p->aTag[i].zValue;
if( strcmp(zName, "*branch")==0 ){
blob_appendf(&comment,
" Move to branch [/timeline?r=%h&nd&dp=%!S&unhide | %h].",
zValue, zTagUuid, zValue);
branchMove = 1;
continue;
}else if( strcmp(zName, "*bgcolor")==0 ){
blob_appendf(&comment,
" Change branch background color to \"%h\".", zValue);
continue;
|
| ︙ | ︙ |
Changes to src/markdown.c.
| ︙ | ︙ | |||
840 841 842 843 844 845 846 |
return 0;
}else{
return end;
}
}
| | > > | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 |
return 0;
}else{
return end;
}
}
/* get_link_inline -- extract inline-style link and title from
** parenthesed data
*/
static int get_link_inline(
struct Blob *link,
struct Blob *title,
char *data,
size_t size
){
size_t i = 0, mark;
|
| ︙ | ︙ | |||
1520 1521 1522 1523 1524 1525 1526 |
/* non-recursive fallback when working buffer stack is full */
if( !inter ){
if( rndr->make.listitem ){
rndr->make.listitem(ob, work, *flags, rndr->make.opaque);
}
if( work!=&fallback ) release_work_buffer(rndr, work);
| | | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
/* non-recursive fallback when working buffer stack is full */
if( !inter ){
if( rndr->make.listitem ){
rndr->make.listitem(ob, work, *flags, rndr->make.opaque);
}
if( work!=&fallback ) release_work_buffer(rndr, work);
blob_reset(&fallback);
return beg;
}
/* render of li contents */
if( has_inside_empty ) *flags |= MKD_LI_BLOCK;
if( *flags & MKD_LI_BLOCK ){
/* intermediate render of block li */
|
| ︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 |
/* render of li itself */
if( rndr->make.listitem ){
rndr->make.listitem(ob, inter, *flags, rndr->make.opaque);
}
release_work_buffer(rndr, inter);
if( work!=&fallback ) release_work_buffer(rndr, work);
| | | 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
/* render of li itself */
if( rndr->make.listitem ){
rndr->make.listitem(ob, inter, *flags, rndr->make.opaque);
}
release_work_buffer(rndr, inter);
if( work!=&fallback ) release_work_buffer(rndr, work);
blob_reset(&fallback);
return beg;
}
/* parse_list -- parsing ordered or unordered list block */
static size_t parse_list(
struct Blob *ob,
|
| ︙ | ︙ | |||
1582 1583 1584 1585 1586 1587 1588 |
j = parse_listitem(work, rndr, data+i, size-i, &flags);
i += j;
if( !j || (flags & MKD_LI_END) ) break;
}
if( rndr->make.list ) rndr->make.list(ob, work, flags, rndr->make.opaque);
if( work!=&fallback ) release_work_buffer(rndr, work);
| | | 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 |
j = parse_listitem(work, rndr, data+i, size-i, &flags);
i += j;
if( !j || (flags & MKD_LI_END) ) break;
}
if( rndr->make.list ) rndr->make.list(ob, work, flags, rndr->make.opaque);
if( work!=&fallback ) release_work_buffer(rndr, work);
blob_reset(&fallback);
return i;
}
/* parse_atxheader -- parsing of atx-style headers */
static size_t parse_atxheader(
struct Blob *ob,
|
| ︙ | ︙ | |||
1629 1630 1631 1632 1633 1634 1635 | } return skip; } /* htmlblock_end -- checking end of HTML block : </tag>[ \t]*\n[ \t*]\n */ /* returns the length on match, 0 otherwise */ | | > > > > | 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 |
}
return skip;
}
/* htmlblock_end -- checking end of HTML block : </tag>[ \t]*\n[ \t*]\n */
/* returns the length on match, 0 otherwise */
static size_t htmlblock_end(
const struct html_tag *tag,
const char *data,
size_t size
){
size_t i, w;
/* assuming data[0]=='<' && data[1]=='/' already tested */
/* checking tag is a match */
if( (tag->size+3)>=size
|| fossil_strnicmp(data+2, tag->text, tag->size)
|
| ︙ | ︙ | |||
2222 2223 2224 2225 2226 2227 2228 | /* second pass: actual rendering */ if( rndr.make.prolog ) rndr.make.prolog(ob, rndr.make.opaque); parse_block(ob, &rndr, blob_buffer(&text), blob_size(&text)); if( rndr.make.epilog ) rndr.make.epilog(ob, rndr.make.opaque); /* clean-up */ | | | | | | | 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 |
/* second pass: actual rendering */
if( rndr.make.prolog ) rndr.make.prolog(ob, rndr.make.opaque);
parse_block(ob, &rndr, blob_buffer(&text), blob_size(&text));
if( rndr.make.epilog ) rndr.make.epilog(ob, rndr.make.opaque);
/* clean-up */
blob_reset(&text);
lr = (struct link_ref *)blob_buffer(&rndr.refs);
end = blob_size(&rndr.refs)/sizeof(struct link_ref);
for(i=0; i<end; i++){
blob_reset(&lr[i].id);
blob_reset(&lr[i].link);
blob_reset(&lr[i].title);
}
blob_reset(&rndr.refs);
blobarray_zero(rndr.work, rndr.make.max_work_stack);
fossil_free(rndr.work);
}
|
Added src/markdown.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 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 |
# Markdown formatting rules
In addition to its native Wiki formatting syntax, Fossil supports Markdown syntax as specified by
[John Gruber's original Markdown implementation](http://daringfireball.net/projects/markdown/).
For lots of examples - not repeated here - please refer to its
[syntax description](http://daringfireball.net/projects/markdown/syntax), of which the page you
are reading is an extract.
This page itself uses Markdown formatting.
## Summary
- Block elements
* A **paragraph** is a group of consecutive lines. Paragraphs are separated by blank lines.
* A **Header** is a line of text underlined with equal signs or hyphens, or prefixed by a
number of hash marks.
* **Block quotes** are blocks of text prefixed by '>'.
* **Ordered list** items are prefixed by a number and a period. **Unordered list** items
are prefixed by a hyphen, asterisk or plus sign. Prefix and item text are separated by
whitespace.
* **Code blocks** are formed by lines of text (possibly including empty lines) prefixed by
at least 4 spaces or a tab.
* A **horizontal rule** is a line consisting of 3 or more asterisks, hyphens or underscores,
with optional whitespace between them.
- Span elements
* 3 types of **links** exist:
- **automatic links** are URLs or email addresses enclosed in angle brackets
('<' and '>'), and are displayed as such.
- **inline links** consist of the displayed link text in square brackets ('[' and ']'),
followed by the link target in parentheses.
- **reference links** separate _link instance_ from _link definition_. A link instance
consists of the displayed link text in square brackets, followed by a link definition name
in square brackets.
The corresponding link definition can occur anywhere on the page, and consists
of the link definition name in square brackets followed by a colon, whitespace and the
link target.
* **Emphasis** can be given by wrapping text in one or two asterisks or underscores - use
one for HTML `<em>`, and two for `<strong>` emphasis.
* A **code span** is text wrapped in backticks ('`').
* **Images** use a syntax much like inline or reference links, but with alt attribute text
('img alt=...') instead of link text, and the first pair of square
brackets in an image instance prefixed by an exclamation mark.
- **Inline HTML** is mostly interpreted automatically.
- **Escaping** Markdown punctuation characters is done by prefixing them by a backslash ('\\').
## Details
### Paragraphs
To cause an explicit line break within a paragraph, use 2 or more spaces at the end of a line.
Any line containing only whitespace (space or tab characters) is considered a blank line.
### Headers
#### 'Setext' style headers (underlined)
The number of underlining equal signs or hyphens used has no impact on the resulting header.
Underlining using equal sign(s) creates a top level header (corresponding to HTML `<h1>`),
while hyphen(s) create a second level header (HTML `<h2>`). Thus, only 2 levels of headers
can be made this way.
#### 'Atx' style headers (hash prefixed)
1 to 6 hash characters can be used to indicate header levels 1 (HTML `<h1>`) to 6 (`<h6>`).
Headers may optionally be 'closed' for cosmetic reasons, by appending a whitespace and hash
characters to the header. The number of trailing hash characters has no impact on the header
level.
### Block quotes
Not every line in a paragraph needs to be prefixed by '>' in order to make it a block quote,
only the first line.
Block quoted paragraphs can be nested by using multiple '>' characters as prefix.
Within a block quote, Markdown formatting (e.g. lists, emphasis) still works as normal.
### Lists
A list item prefix need not occur first on its line; up to 3 leading spaces are allowed
(4 spaces would make a code block out of the following text).
For unordered lists, asterisks, hyphens and plus signs can be used interchangeably.
For ordered lists, arbitrary numbers can be used as part of an item prefix; the items will be
renumbered during rendering. However, future implementations may demand that the number used
for the first item in a list indicates an offset to be used for subsequent items.
For list items spanning multiple lines, subsequent lines can be indented using an arbitrary amount
of whitespace.
List items will be wrapped in HTML `<p>` tags if they are separated by blank lines.
A list item may span multiple paragraphs. At least the first line of each such paragraph must
be indented using at least 4 spaces or a tab character.
Block quotes within list items must have their '>' delimiters indented using 4 up to 7 spaces.
Code blocks within list items need to be indented _twice_, that is, using 8 spaces or 2 tab
characters.
### Code blocks
Lines within a code block are rendered verbatim using HTML `<pre>` and `<code>` tags, except that
HTML punctuation characters like '<' and '&' are automatically converted to HTML entities. Thus,
there is no need to explicitly escape HTML syntax within a code block.
A code block runs until the first non blank line with indent less than 4 spaces or 1 tab character.
Regular Markdown syntax is not processed within code blocks.
### Links
#### Automatic links
When rendering automatic links to email addresses, HTML encoding obfuscation is used to
prevent some spambots from harvesting.
#### Inline links
Links to resources on the same server can use relative paths (i.e. can start with a '/').
An optional title for the link (e.g. to have mouseover text in the browser) may be given behind
the link target but within the parentheses, in single and double quotes, and separated from the
link target by whitespace.
#### Reference links
> Each reference link consists of
>
> - one or more _link instances_ at appropriate locations in the page text
> - a single _link definition_ at an arbitrary location on the page
>
> During rendering, each link instance is resolved, and the corresponding definition is
> filled in. No separate link definition clauses occur in the rendered output.
>
> There are 3 fields involved in link instances and definitions:
>
> - link text (i.e. the text that is displayed at the resulting link)
> - link definition name (i.e. an unique ID binding link instances to link definition)
> - link target (a target URL for the link)
Multiple link instances may reference the same link definition using its link definition
name.
Link definition names are case insensitive, and may contain letters, numbers, spaces and
punctuation.
##### Link instance
A space may be inserted between the bracket pairs for link text and link definition name.
A link instance can use an _implicit link definition name_ shortcut, in which case the link
text is used as the link definition name. The second set of brackets then remains empty, e.g.
'[Google][]' ('Google' being used as both link text and link definition name).
##### Link definition
The first bracket pair containing the link definition name may be indented using up to 3 spaces.
The link target may optionally be surrounded by angle brackets ('<' and '>').
A link target may be followed by an optional title (e.g. to have mouseover text in the browser).
This title may be enclosed in parentheses, single or double quotes.
Link definitions may be split into 2 lines, with the title on the second line, arbitrarily
indented. This may be more visually pleasing when using long link targets.
### Emphasis
The same character(s) used for starting the emphasis must be used to end it; don't mix
asterisks and underscores.
Emphasis can be used in the middle of a word. That is, there need not be whitespace on either
side of emphasis start or end punctuation characters.
### Code spans
To include a literal backtick character in a code span, use multiple backticks as opening and
closing delimiters.
Whitespace may exist immediately after the opening delimiter and before the closing delimiter
of a code span, to allow for code fragments starting or ending with a backtick.
Within a code span - like within a code block - angle brackets and ampersands are automatically encoded to make including
HTML fragments easier.
### Images
If necessary, HTML must be used to specify image dimensions. Markdown has no provision for this.
### Inline HTML
Start and end tags of
a HTML block level construct (`<div>`, `<table>` etc) must be separated from surrounding
context using blank lines, and must both occur at the start of a line.
No extra unwanted `<p>` HTML tags are added around HTML block level tags.
Markdown formatting within HTML block level tags is not processed; however, formatting within
span level tags (e.g. `<mark>`) is processed normally.
### Escaping Markdown punctuation
The following punctuation characters can be escaped using backslash:
- \\ backslash
- ` backtick
- * asterisk
- _ underscore
- {} curly braces
- [] square brackets
- () parentheses
- # hash mark
- + plus sign
- - minus sign (hyphen)
- . dot
- ! exclamation mark
To render a literal backslash, use 2 backslashes ('\\\\').
|
Changes to src/markdown_html.c.
| ︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
i++;
}
}
}
/* HTML block tags */
static void html_prolog(struct Blob *ob, void *opaque){
INTER_BLOCK(ob);
BLOB_APPEND_LITTERAL(ob, "<div class=\"markdown\">\n");
}
static void html_epilog(struct Blob *ob, void *opaque){
INTER_BLOCK(ob);
BLOB_APPEND_LITTERAL(ob, "</div>\n");
}
| > > > > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
i++;
}
}
}
/* HTML block tags */
/* Size of the prolog: "<div class='markdown'>\n" */
#define PROLOG_SIZE 23
static void html_prolog(struct Blob *ob, void *opaque){
INTER_BLOCK(ob);
BLOB_APPEND_LITTERAL(ob, "<div class=\"markdown\">\n");
assert( blob_size(ob)==PROLOG_SIZE );
}
static void html_epilog(struct Blob *ob, void *opaque){
INTER_BLOCK(ob);
BLOB_APPEND_LITTERAL(ob, "</div>\n");
}
|
| ︙ | ︙ | |||
124 125 126 127 128 129 130 |
struct Blob *text,
int level,
void *opaque
){
struct Blob *title = opaque;
/* The first header at the beginning of a text is considered as
* a title and not output. */
| | < | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
struct Blob *text,
int level,
void *opaque
){
struct Blob *title = opaque;
/* The first header at the beginning of a text is considered as
* a title and not output. */
if( blob_size(ob)<=PROLOG_SIZE && blob_size(title)==0 ){
BLOB_APPEND_BLOB(title, text);
}
INTER_BLOCK(ob);
blob_appendf(ob, "<h%d>", level);
BLOB_APPEND_BLOB(ob, text);
blob_appendf(ob, "</h%d>", level);
}
|
| ︙ | ︙ |
Changes to src/md5.c.
| ︙ | ︙ | |||
175 176 177 178 179 180 181 |
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
| | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
static
void MD5Update(MD5Context *pCtx, const unsigned char *buf, unsigned int len){
struct Context *ctx = (struct Context *)pCtx;
uint32 t;
/* Update bitcount */
t = ctx->bits[0];
|
| ︙ | ︙ | |||
222 223 224 225 226 227 228 |
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
| | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
static void MD5Final(unsigned char digest[16], MD5Context *pCtx){
struct Context *ctx = (struct Context *)pCtx;
unsigned count;
unsigned char *p;
|
| ︙ | ︙ | |||
272 273 274 275 276 277 278 |
/*
** Convert a digest into base-16. digest should be declared as
** "unsigned char digest[16]" in the calling function. The MD5
** digest is stored in the first 16 bytes. zBuf should
** be "char zBuf[33]".
*/
static void DigestToBase16(unsigned char *digest, char *zBuf){
| | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
/*
** Convert a digest into base-16. digest should be declared as
** "unsigned char digest[16]" in the calling function. The MD5
** digest is stored in the first 16 bytes. zBuf should
** be "char zBuf[33]".
*/
static void DigestToBase16(unsigned char *digest, char *zBuf){
static const char zEncode[] = "0123456789abcdef";
int i, j;
for(j=i=0; i<16; i++){
int a = digest[i];
zBuf[j++] = zEncode[(a>>4)&0xf];
zBuf[j++] = zEncode[a & 0xf];
}
|
| ︙ | ︙ | |||
341 342 343 344 345 346 347 | } sqlite3_snprintf(sizeof(zResult), zResult, "%08x", cksum); return zResult; } /* ** Finish the incremental MD5 checksum. Store the result in blob pOut | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
}
sqlite3_snprintf(sizeof(zResult), zResult, "%08x", cksum);
return zResult;
}
/*
** Finish the incremental MD5 checksum. Store the result in blob pOut
** if pOut!=0. Also return a pointer to the result.
**
** This resets the incremental checksum preparing for the next round
** of computation. The return pointer points to a static buffer that
** is overwritten by subsequent calls to this function.
*/
char *md5sum_finish(Blob *pOut){
unsigned char zResult[16];
|
| ︙ | ︙ | |||
429 430 431 432 433 434 435 |
** Compute an MD5 checksum of all files named on the command-line.
** If a file is named "-" then content is read from standard input.
*/
void md5sum_test(void){
int i;
Blob in;
Blob cksum;
| | | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
** Compute an MD5 checksum of all files named on the command-line.
** If a file is named "-" then content is read from standard input.
*/
void md5sum_test(void){
int i;
Blob in;
Blob cksum;
for(i=2; i<g.argc; i++){
blob_init(&cksum, "********** not found ***********", -1);
if( g.argv[i][0]=='-' && g.argv[i][1]==0 ){
blob_read_from_channel(&in, stdin, -1);
md5sum_blob(&in, &cksum);
}else{
md5sum_file(g.argv[i], &cksum);
}
fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]);
blob_reset(&cksum);
}
}
|
Changes to src/mkbuiltin.c.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 | #include <stdio.h> #include <stdlib.h> #include <string.h> /* ** Read the entire content of the file named zFilename into memory obtained | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
** Read the entire content of the file named zFilename into memory obtained
** from malloc() and return a pointer to that memory. Write the size of the
** file into *pnByte.
*/
static unsigned char *read_file(const char *zFilename, int *pnByte){
FILE *in;
unsigned char *z;
int nByte;
int got;
|
| ︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
/*
** There is an instance of the following for each file translated.
*/
typedef struct Resource Resource;
struct Resource {
const char *zName;
int nByte;
};
/*
** Compare two Resource objects for sorting purposes. They sort
** in zName order so that Fossil can search for resources using
** a binary search.
*/
static int compareResource(const void *a, const void *b){
Resource *pA = (Resource*)a;
Resource *pB = (Resource*)b;
return strcmp(pA->zName, pB->zName);
}
int main(int argc, char **argv){
int i, sz;
int j, n;
Resource *aRes;
| > | > > > > > > > > > > > > > > > > | > | | | 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 |
/*
** There is an instance of the following for each file translated.
*/
typedef struct Resource Resource;
struct Resource {
const char *zName;
int nByte;
int idx;
};
/*
** Compare two Resource objects for sorting purposes. They sort
** in zName order so that Fossil can search for resources using
** a binary search.
*/
static int compareResource(const void *a, const void *b){
Resource *pA = (Resource*)a;
Resource *pB = (Resource*)b;
return strcmp(pA->zName, pB->zName);
}
int main(int argc, char **argv){
int i, sz;
int j, n;
Resource *aRes;
int nRes;
unsigned char *pData;
int nErr = 0;
int nSkip;
int nPrefix = 0;
if( argc>3 && strcmp(argv[1],"--prefix")==0 ){
nPrefix = (int)strlen(argv[2]);
argc -= 2;
argv += 2;
}
nRes = argc - 1;
aRes = malloc( nRes*sizeof(aRes[0]) );
if( aRes==0 ){
fprintf(stderr, "malloc failed\n");
return 1;
}
for(i=0; i<argc-1; i++){
aRes[i].zName = argv[i+1];
}
qsort(aRes, nRes, sizeof(aRes[0]), compareResource);
printf("/* Automatically generated code: Do not edit.\n**\n"
"** Rerun the \"mkbuiltin.c\" program or rerun the Fossil\n"
"** makefile to update this source file.\n"
"*/\n");
for(i=0; i<nRes; i++){
pData = read_file(aRes[i].zName, &sz);
if( pData==0 ){
fprintf(stderr, "Cannot open file [%s]\n", aRes[i].zName);
nErr++;
continue;
}
/* Skip initial lines beginning with # */
nSkip = 0;
while( pData[nSkip]=='#' ){
while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
if( pData[nSkip]=='\n' ) nSkip++;
}
aRes[i].nByte = sz - nSkip;
aRes[i].idx = i;
printf("/* Content of file %s */\n", aRes[i].zName);
printf("static const unsigned char bidata%d[%d] = {\n ",
i, sz+1-nSkip);
for(j=nSkip, n=0; j<=sz; j++){
printf("%3d", pData[j]);
if( j==sz ){
printf(" };\n");
}else if( n==14 ){
printf(",\n ");
n = 0;
}else{
|
| ︙ | ︙ | |||
127 128 129 130 131 132 133 |
printf("struct BuiltinFileTable {\n");
printf(" const char *zName;\n");
printf(" const unsigned char *pData;\n");
printf(" int nByte;\n");
printf("};\n");
printf("static const BuiltinFileTable aBuiltinFiles[] = {\n");
for(i=0; i<nRes; i++){
| < < > | | < | > > | > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
printf("struct BuiltinFileTable {\n");
printf(" const char *zName;\n");
printf(" const unsigned char *pData;\n");
printf(" int nByte;\n");
printf("};\n");
printf("static const BuiltinFileTable aBuiltinFiles[] = {\n");
for(i=0; i<nRes; i++){
const char *z = aRes[i].zName;
if( strlen(z)>=nPrefix ) z += nPrefix;
while( z[0]=='.' || z[0]=='/' ){ z++; }
aRes[i].zName = z;
}
qsort(aRes, nRes, sizeof(aRes[0]), compareResource);
for(i=0; i<nRes; i++){
printf(" { \"%s\", bidata%d, %d },\n",
aRes[i].zName, aRes[i].idx, aRes[i].nByte);
}
printf("};\n");
return nErr;
}
|
Changes to src/mkindex.c.
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
i+=j;
while( isspace(zLine[i]) ){ i++; }
if( zLine[i]!='(' ) goto page_skip;
nFixed = nUsed;
nHelp = 0;
return;
| | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
i+=j;
while( isspace(zLine[i]) ){ i++; }
if( zLine[i]!='(' ) goto page_skip;
nFixed = nUsed;
nHelp = 0;
return;
page_skip:
for(i=nFixed; i<nUsed; i++){
fprintf(stderr,"%s:%d: skipping page \"%s\"\n",
zFile, nLine, aEntry[i].zPath);
}
nUsed = nFixed;
}
|
| ︙ | ︙ | |||
325 326 327 328 329 330 331 |
printf("\";\n");
if( aEntry[i].zIf ) printf("#endif\n");
aEntry[i].zHelp[0] = 0;
}
}
puts("struct CmdHelp {"
"int eType; "
| | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
printf("\";\n");
if( aEntry[i].zIf ) printf("#endif\n");
aEntry[i].zHelp[0] = 0;
}
}
puts("struct CmdHelp {"
"int eType; "
"const char *zText;"
"};");
puts("static struct CmdHelp aCmdHelp[] = {");
for(i=0; i<nFixed; i++){
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
if( aEntry[i].zHelp==0 ){
printf("{%d, 0},\n", aEntry[i].eType);
}else{
|
| ︙ | ︙ | |||
359 360 361 362 363 364 365 |
nLine++;
scan_for_if(zLine);
scan_for_label("WEBPAGE:",zLine,0);
scan_for_label("COMMAND:",zLine,1);
scan_for_func(zLine);
}
fclose(in);
| | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
nLine++;
scan_for_if(zLine);
scan_for_label("WEBPAGE:",zLine,0);
scan_for_label("COMMAND:",zLine,1);
scan_for_func(zLine);
}
fclose(in);
nUsed = nFixed;
}
int main(int argc, char **argv){
int i;
for(i=1; i<argc; i++){
zFile = argv[i];
process_file();
}
build_table();
return 0;
}
|
Changes to src/mkversion.c.
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
if( fgets(b, sizeof(b)-1,v)==0 ){
fprintf(stderr, "malformed VERSION file: %s\n", argv[3]);
exit(1);
}
fclose(v);
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
*z = 0;
| | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
if( fgets(b, sizeof(b)-1,v)==0 ){
fprintf(stderr, "malformed VERSION file: %s\n", argv[3]);
exit(1);
}
fclose(v);
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
*z = 0;
printf("#define RELEASE_VERSION \"%s\"\n", b);
x=0;
i=0;
z=b;
while(1){
if( z[0]>='0' && z[0]<='9' ){
x = x*10 + z[0] - '0';
}else{
|
| ︙ | ︙ |
Changes to src/moderate.c.
| ︙ | ︙ | |||
142 143 144 145 146 147 148 |
** Show all pending moderation request
*/
void modreq_page(void){
Blob sql;
Stmt q;
login_check_credentials();
| | > > > | | 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 |
** Show all pending moderation request
*/
void modreq_page(void){
Blob sql;
Stmt q;
login_check_credentials();
if( !g.perm.RdWiki && !g.perm.RdTkt ){
login_needed(g.anon.RdWiki && g.anon.RdTkt);
return;
}
style_header("Pending Moderation Requests");
@ <h2>All Pending Moderation Requests</h2>
if( moderation_table_exists() ){
blob_init(&sql, timeline_query_for_www(), -1);
blob_append_sql(&sql,
" AND event.objid IN (SELECT objid FROM modreq)"
" ORDER BY event.mtime DESC"
);
db_prepare(&q, "%s", blob_sql_text(&sql));
www_print_timeline(&q, 0, 0, 0, 0, 0);
db_finalize(&q);
}
style_footer();
}
|
Changes to src/name.c.
| ︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
**
** The zType parameter specifies the type of artifact: ci, t, w, e, g.
** If zType is NULL or "" or "*" then any type of artifact will serve.
** If zType is "br" then find the first check-in of the named branch
** rather than the last.
** zType is "ci" in most use cases since we are usually searching for
** a check-in.
*/
int symbolic_name_to_rid(const char *zTag, const char *zType){
int vid;
int rid = 0;
int nTag;
int i;
int startOfBranch = 0;
| > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
**
** The zType parameter specifies the type of artifact: ci, t, w, e, g.
** If zType is NULL or "" or "*" then any type of artifact will serve.
** If zType is "br" then find the first check-in of the named branch
** rather than the last.
** zType is "ci" in most use cases since we are usually searching for
** a check-in.
**
** Note that the input zTag for types "t" and "e" is the SHA1 hash of
** the ticket-change or event-change artifact, not the randomly generated
** hexadecimal identifier assigned to tickets and events. Those identifiers
** live in a separate namespace.
*/
int symbolic_name_to_rid(const char *zTag, const char *zType){
int vid;
int rid = 0;
int nTag;
int i;
int startOfBranch = 0;
|
| ︙ | ︙ | |||
442 443 444 445 446 447 448 |
@ <ol>
z = mprintf("%s", zName);
canonical16(z, strlen(z));
db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z);
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
int rid = db_column_int(&q, 1);
| | | | | 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 |
@ <ol>
z = mprintf("%s", zName);
canonical16(z, strlen(z));
db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z);
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
int rid = db_column_int(&q, 1);
@ <li><p><a href="%R/%T(zSrc)/%!S(zUuid)">
@ %s(zUuid)</a> -
object_description(rid, 0, 0);
@ </p></li>
}
db_finalize(&q);
db_prepare(&q,
" SELECT tkt_rid, tkt_uuid, title"
" FROM ticket, ticketchng"
" WHERE ticket.tkt_id = ticketchng.tkt_id"
" AND tkt_uuid GLOB '%q*'"
" GROUP BY tkt_uuid"
" ORDER BY tkt_ctime DESC", z);
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zTitle = db_column_text(&q, 2);
@ <li><p><a href="%R/%T(zSrc)/%!S(zUuid)">
@ %s(zUuid)</a> -
@ <ul></ul>
@ Ticket
hyperlink_to_uuid(zUuid);
@ - %s(zTitle).
@ <ul><li>
object_description(rid, 0, 0);
@ </li></ul>
@ </p></li>
}
db_finalize(&q);
db_prepare(&q,
"SELECT rid, uuid FROM"
" (SELECT tagxref.rid AS rid, substr(tagname, 7) AS uuid"
" FROM tagxref, tag WHERE tagxref.tagid = tag.tagid"
" AND tagname GLOB 'event-%q*') GROUP BY uuid", z);
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q, 0);
const char* zUuid = db_column_text(&q, 1);
@ <li><p><a href="%R/%T(zSrc)/%!S(zUuid)">
@ %s(zUuid)</a> -
@ <ul><li>
object_description(rid, 0, 0);
@ </li></ul>
@ </p></li>
}
@ </ol>
|
| ︙ | ︙ | |||
775 776 777 778 779 780 781 | } db_finalize(&q); } /* ** Schema for the description table */ | | | | | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | } db_finalize(&q); } /* ** Schema for the description table */ static const char zDescTab[] = @ CREATE TEMP TABLE IF NOT EXISTS description( @ rid INTEGER PRIMARY KEY, -- RID of the object @ uuid TEXT, -- SHA1 hash of the object @ ctime DATETIME, -- Time of creation @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts @ type TEXT, -- file, checkin, wiki, ticket, etc. @ summary TEXT, -- Summary comment for the object @ detail TEXT -- filename, checkin comment, etc @ ); ; /* ** Create the description table if it does not already exists. ** Populate fields of this table with descriptions for all artifacts |
| ︙ | ︙ | |||
980 981 982 983 984 985 986 |
Stmt q;
int s = atoi(PD("s","0"));
int n = atoi(PD("n","5000"));
int mx = db_int(0, "SELECT max(rid) FROM blob");
char *zRange;
login_check_credentials();
| | | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
Stmt q;
int s = atoi(PD("s","0"));
int n = atoi(PD("n","5000"));
int mx = db_int(0, "SELECT max(rid) FROM blob");
char *zRange;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("List Of Artifacts");
if( mx>n && P("s")==0 ){
int i;
@ <p>Select a range of artifacts to view:</p>
@ <ul>
for(i=1; i<=mx; i+=n){
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
|
| ︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 |
@ <table cellpadding="0" cellspacing="0">
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q,0);
const char *zUuid = db_column_text(&q, 1);
const char *zDesc = db_column_text(&q, 2);
int isPriv = db_column_int(&q,2);
@ <tr><td align="right">%d(rid)</td>
| | | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
@ <table cellpadding="0" cellspacing="0">
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q,0);
const char *zUuid = db_column_text(&q, 1);
const char *zDesc = db_column_text(&q, 2);
int isPriv = db_column_int(&q,2);
@ <tr><td align="right">%d(rid)</td>
@ <td> %z(href("%R/info/%!S",zUuid))%s(zUuid)</a> </td>
@ <td align="left">%h(zDesc)</td>
if( isPriv ){
@ <td>(unpublished)</td>
}
@ </tr>
}
@ </table>
|
| ︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 |
**
** Show all phantom artifacts
*/
void test_phatoms_cmd(void){
db_find_and_open_repository(0,0);
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 |
**
** Show all phantom artifacts
*/
void test_phatoms_cmd(void){
db_find_and_open_repository(0,0);
describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
}
/* Maximum number of collision examples to remember */
#define MAX_COLLIDE 25
/*
** WEBPAGE: hash-collisions
**
** Show the number of hash collisions for hash prefixes of various lengths.
*/
void hash_collisions_webpage(void){
int i, j, kk;
int nHash = 0;
Stmt q;
char zPrev[UUID_SIZE+1];
struct {
int cnt;
char *azHit[MAX_COLLIDE];
char z[UUID_SIZE+1];
} aCollide[UUID_SIZE+1];
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
memset(aCollide, 0, sizeof(aCollide));
memset(zPrev, 0, sizeof(zPrev));
db_prepare(&q,"SELECT uuid FROM blob ORDER BY 1");
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q,0);
int n = db_column_bytes(&q,0);
int i;
nHash++;
for(i=0; zPrev[i] && zPrev[i]==zUuid[i]; i++){}
if( i>0 && i<=UUID_SIZE ){
if( i>=4 && aCollide[i].cnt<MAX_COLLIDE ){
aCollide[i].azHit[aCollide[i].cnt] = mprintf("%.*s", i, zPrev);
}
aCollide[i].cnt++;
if( aCollide[i].z[0]==0 ) memcpy(aCollide[i].z, zPrev, n+1);
}
memcpy(zPrev, zUuid, n+1);
}
db_finalize(&q);
style_header("SHA1 Prefix Collisions");
style_submenu_element("Activity Reports", 0, "reports");
style_submenu_element("Stats", 0, "stat");
@ <table border=1><thead>
@ <tr><th>Length<th>Instances<th>First Instance</tr>
@ </thead><tbody>
for(i=1; i<=UUID_SIZE; i++){
if( aCollide[i].cnt==0 ) continue;
@ <tr><td>%d(i)<td>%d(aCollide[i].cnt)<td>%h(aCollide[i].z)</tr>
}
@ </tbody></table>
@ <p>Total number of hashes: %d(nHash)</p>
kk = 0;
for(i=UUID_SIZE; i>=4; i--){
if( aCollide[i].cnt==0 ) continue;
if( aCollide[i].cnt>200 ) break;
kk += aCollide[i].cnt;
if( aCollide[i].cnt<25 ){
@ <p>Collisions of length %d(i):
}else{
@ <p>First 25 collisions of length %d(i):
}
for(j=0; j<aCollide[i].cnt && j<MAX_COLLIDE; j++){
char *zId = aCollide[i].azHit[j];
if( zId==0 ) continue;
@ %z(href("%R/whatis/%s",zId))%h(zId)</a>
}
}
style_footer();
}
|
Changes to src/path.c.
| ︙ | ︙ | |||
541 542 543 544 545 546 547 |
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
Stmt q;
login_check_credentials();
| | | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
** This page is intended for for testing purposes only and may change
** or be discontinued without notice.
*/
void test_rename_list_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("List Of File Name Changes");
@ <h3>NB: Experimental Page</h3>
@ <table border="1" width="100%%">
@ <tr><th>Date & Time</th>
@ <th>Old Name</th>
@ <th>New Name</th>
@ <th>Check-in</th></tr>
db_prepare(&q, "%s", zRenameQuery/*safe-for-%s*/);
while( db_step(&q)==SQLITE_ROW ){
const char *zDate = db_column_text(&q, 0);
const char *zOld = db_column_text(&q, 1);
const char *zNew = db_column_text(&q, 2);
const char *zUuid = db_column_text(&q, 3);
@ <tr>
@ <td>%z(href("%R/timeline?c=%t",zDate))%s(zDate)</a></td>
@ <td>%z(href("%R/finfo?name=%t",zOld))%h(zOld)</a></td>
@ <td>%z(href("%R/finfo?name=%t",zNew))%h(zNew)</a></td>
@ <td>%z(href("%R/info/%!S",zUuid))%S(zUuid)</a></td></tr>
}
@ </table>
db_finalize(&q);
style_footer();
}
|
Changes to src/printf.c.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #include "printf.h" #if defined(_WIN32) # include <io.h> # include <fcntl.h> #endif #include <time.h> /* ** Conversion types fall into various categories as defined by the ** following enumeration. */ #define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */ #define etFLOAT 2 /* Floating point. %f */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
#include "config.h"
#include "printf.h"
#if defined(_WIN32)
# include <io.h>
# include <fcntl.h>
#endif
#include <time.h>
/* Two custom conversions are used to show a prefix of SHA1 hashes:
**
** %!S Prefix of a length appropriate for URLs
** %S Prefix of a length appropriate for human display
**
** The following macros help determine those lengths. FOSSIL_HASH_DIGITS
** is the default number of digits to display to humans. This value can
** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL
** is the minimum number of digits to be used in URLs. The number used
** will always be at least 6 more than the number used for human output,
** or 40 if the number of digits in human output is 34 or more.
*/
#ifndef FOSSIL_HASH_DIGITS
# define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */
#endif
#ifndef FOSSIL_HASH_DIGITS_URL
# define FOSSIL_HASH_DIGITS_URL 16 /* For %!S (embedded in URLs) */
#endif
/*
** Return the number of SHA1 hash digits to display. The number is for
** human output if the bForUrl is false and is destined for a URL if
** bForUrl is false.
*/
static int hashDigits(int bForUrl){
static int nDigitHuman = 0;
static int nDigitUrl = 0;
if( nDigitHuman==0 ){
nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
if( nDigitHuman < 6 ) nDigitHuman = 6;
if( nDigitHuman > 40 ) nDigitHuman = 40;
nDigitUrl = nDigitHuman + 6;
if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL;
if( nDigitUrl > 40 ) nDigitUrl = 40;
}
return bForUrl ? nDigitUrl : nDigitHuman;
}
/*
** Conversion types fall into various categories as defined by the
** following enumeration.
*/
#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */
#define etFLOAT 2 /* Floating point. %f */
|
| ︙ | ︙ | |||
618 619 620 621 622 623 624 |
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
| | < < < < < | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
precision = hashDigits(flag_altform2);
}
length = StrNLen32(bufpt, limit);
if( precision>=0 && precision<length ) length = precision;
break;
}
case etBLOB: {
int limit = flag_alternateform ? va_arg(ap, int) : -1;
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
520 521 522 523 524 525 526 527 528 529 530 531 532 533 | ** Usage: %fossil rebuild ?REPOSITORY? ?OPTIONS? ** ** Reconstruct the named repository database from the core ** records. Run this command after updating the fossil ** executable in a way that changes the database schema. ** ** Options: ** --cluster Compute clusters for unclustered artifacts ** --compress Strive to make the database as small as possible ** --force Force the rebuild to complete even if errors are seen ** --noverify Skip the verification of changes to the BLOB table ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) ** --randomize Scan artifacts in a random order ** --vacuum Run VACUUM on the database after rebuilding | > > > > > > < < < > > > > > > > > > > > > | > > | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 |
** Usage: %fossil rebuild ?REPOSITORY? ?OPTIONS?
**
** Reconstruct the named repository database from the core
** records. Run this command after updating the fossil
** executable in a way that changes the database schema.
**
** Options:
** --analyze Run ANALYZE on the database after rebuilding
** --cluster Compute clusters for unclustered artifacts
** --compress Strive to make the database as small as possible
** --deanalyze Remove ANALYZE tables from the database
** --force Force the rebuild to complete even if errors are seen
** --ifneeded Only do the rebuild if it would change the schema version
** --index Always add in the full-text search index
** --noverify Skip the verification of changes to the BLOB table
** --noindex Always omit the full-text search index
** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
** --randomize Scan artifacts in a random order
** --stats Show artifact statistics after rebuilding
** --vacuum Run VACUUM on the database after rebuilding
** --wal Set Write-Ahead-Log journalling mode on the database
**
** See also: deconstruct, reconstruct
*/
void rebuild_database(void){
int forceFlag;
int randomizeFlag;
int errCnt;
int omitVerify;
int doClustering;
const char *zPagesize;
int newPagesize = 0;
int activateWal;
int runVacuum;
int runDeanalyze;
int runAnalyze;
int runCompress;
int showStats;
int runReindex;
int optNoIndex;
int optIndex;
int optIfNeeded;
omitVerify = find_option("noverify",0,0)!=0;
forceFlag = find_option("force","f",0)!=0;
randomizeFlag = find_option("randomize", 0, 0)!=0;
doClustering = find_option("cluster", 0, 0)!=0;
runVacuum = find_option("vacuum",0,0)!=0;
runDeanalyze = find_option("deanalyze",0,0)!=0;
runAnalyze = find_option("analyze",0,0)!=0;
runCompress = find_option("compress",0,0)!=0;
zPagesize = find_option("pagesize",0,1);
showStats = find_option("stats",0,0)!=0;
optIndex = find_option("index",0,0)!=0;
optNoIndex = find_option("noindex",0,0)!=0;
optIfNeeded = find_option("ifneeded",0,0)!=0;
if( zPagesize ){
newPagesize = atoi(zPagesize);
if( newPagesize<512 || newPagesize>65536
|| (newPagesize&(newPagesize-1))!=0
){
fossil_fatal("page size must be a power of two between 512 and 65536");
}
}
activateWal = find_option("wal",0,0)!=0;
if( g.argc==3 ){
db_open_repository(g.argv[2]);
}else{
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
if( g.argc!=2 ){
usage("?REPOSITORY-FILENAME?");
}
db_close(1);
db_open_repository(g.zRepositoryName);
}
runReindex = search_index_exists();
if( optIndex ) runReindex = 1;
if( optNoIndex ) runReindex = 0;
if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){
return;
}
/* We should be done with options.. */
verify_all_options();
db_begin_transaction();
search_drop_index();
ttyOutput = 1;
errCnt = rebuild_db(randomizeFlag, 1, doClustering);
reconstruct_private_table();
db_multi_exec(
"REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
"REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());",
|
| ︙ | ︙ | |||
632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
db_multi_exec("VACUUM");
fossil_print("done\n");
}
if( activateWal ){
db_multi_exec("PRAGMA journal_mode=WAL;");
}
}
if( showStats ){
static const struct { int idx; const char *zLabel; } aStat[] = {
{ CFTYPE_ANY, "Artifacts:" },
{ CFTYPE_MANIFEST, "Manifests:" },
{ CFTYPE_CLUSTER, "Clusters:" },
{ CFTYPE_CONTROL, "Tags:" },
{ CFTYPE_WIKI, "Wikis:" },
| > | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
db_multi_exec("VACUUM");
fossil_print("done\n");
}
if( activateWal ){
db_multi_exec("PRAGMA journal_mode=WAL;");
}
}
if( runReindex ) search_rebuild_index();
if( showStats ){
static const struct { int idx; const char *zLabel; } aStat[] = {
{ CFTYPE_ANY, "Artifacts:" },
{ CFTYPE_MANIFEST, "Manifests:" },
{ CFTYPE_CLUSTER, "Clusters:" },
{ CFTYPE_CONTROL, "Tags:" },
{ CFTYPE_WIKI, "Wikis:" },
|
| ︙ | ︙ | |||
797 798 799 800 801 802 803 |
int bVerily = find_option("verily",0,0)!=0;
int bForce = find_option("force", "f", 0)!=0;
int privateOnly = find_option("private",0,0)!=0;
int bNeedRebuild = 0;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
db_close(1);
db_open_repository(g.zRepositoryName);
| | | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 |
int bVerily = find_option("verily",0,0)!=0;
int bForce = find_option("force", "f", 0)!=0;
int privateOnly = find_option("private",0,0)!=0;
int bNeedRebuild = 0;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
db_close(1);
db_open_repository(g.zRepositoryName);
/* We should be done with options.. */
verify_all_options();
if( !bForce ){
Blob ans;
char cReply;
prompt_user(
|
| ︙ | ︙ | |||
927 928 929 930 931 932 933 |
}
if( file_isdir(g.argv[3])!=1 ){
fossil_print("\"%s\" is not a directory\n\n", g.argv[3]);
usage("FILENAME DIRECTORY");
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
| | | 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
}
if( file_isdir(g.argv[3])!=1 ){
fossil_print("\"%s\" is not a directory\n\n", g.argv[3]);
usage("FILENAME DIRECTORY");
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
/* We should be done with options.. */
verify_all_options();
db_open_config(0);
db_begin_transaction();
db_initial_setup(0, 0, 0, 1);
|
| ︙ | ︙ |
Changes to src/regexp.c.
| ︙ | ︙ | |||
125 126 127 128 129 130 131 | unsigned i; for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return; pSet->aState[pSet->nState++] = newState; } /* Extract the next unicode character from *pzIn and return it. Advance ** *pzIn to the first byte past the end of the character returned. To | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
unsigned i;
for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
pSet->aState[pSet->nState++] = newState;
}
/* Extract the next unicode character from *pzIn and return it. Advance
** *pzIn to the first byte past the end of the character returned. To
** be clear: this routine converts utf8 to unicode. This routine is
** optimized for the common case where the next character is a single byte.
*/
static unsigned re_next_char(ReInput *p){
unsigned c;
if( p->i>=p->mx ) return 0;
c = p->z[p->i++];
if( c>=0x80 ){
|
| ︙ | ︙ | |||
189 190 191 192 193 194 195 | int c = RE_EOF+1; int cPrev = 0; int rc = 0; ReInput in; in.z = zIn; in.i = 0; | | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
int c = RE_EOF+1;
int cPrev = 0;
int rc = 0;
ReInput in;
in.z = zIn;
in.i = 0;
in.mx = nIn>=0 ? nIn : strlen((const char*)zIn);
/* Look for the initial prefix match, if there is one. */
if( pRe->nInit ){
unsigned char x = pRe->zInit[0];
while( in.i+pRe->nInit<=in.mx
&& (zIn[in.i]!=x ||
strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
){
in.i++;
}
if( in.i+pRe->nInit>in.mx ) return 0;
}
|
| ︙ | ︙ | |||
301 302 303 304 305 306 307 |
}else{
j++;
}
}
}
if( pRe->aOp[x]==RE_OP_CC_EXC ) hit = !hit;
if( hit ) re_add_state(pNext, x+n);
| | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
}else{
j++;
}
}
}
if( pRe->aOp[x]==RE_OP_CC_EXC ) hit = !hit;
if( hit ) re_add_state(pNext, x+n);
break;
}
}
}
}
for(i=0; i<pNext->nState; i++){
if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
}
|
| ︙ | ︙ | |||
462 463 464 465 466 467 468 |
int iStart;
unsigned c;
const char *zErr;
while( (c = p->xNextChar(&p->sIn))!=0 ){
iStart = p->nState;
switch( c ){
case '|':
| | | | 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 |
int iStart;
unsigned c;
const char *zErr;
while( (c = p->xNextChar(&p->sIn))!=0 ){
iStart = p->nState;
switch( c ){
case '|':
case '$':
case ')': {
p->sIn.i--;
return 0;
}
case '(': {
zErr = re_subcompile_re(p);
if( zErr ) return zErr;
if( rePeek(p)!=')' ) return "unmatched '('";
p->sIn.i++;
break;
}
case '.': {
if( rePeek(p)=='*' ){
re_append(p, RE_OP_ANYSTAR, 0);
p->sIn.i++;
}else{
re_append(p, RE_OP_ANY, 0);
}
break;
}
case '*': {
if( iPrev<0 ) return "'*' without operand";
re_insert(p, iPrev, RE_OP_GOTO, p->nState - iPrev + 1);
|
| ︙ | ︙ | |||
650 651 652 653 654 655 656 |
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
| | | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 - those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
|
| ︙ | ︙ | |||
687 688 689 690 691 692 693 | ** pattern and the second argument is the string. So, the SQL statements: ** ** A REGEXP B ** ** is implemented as regexp(B,A). */ static void re_sql_func( | | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
** pattern and the second argument is the string. So, the SQL statements:
**
** A REGEXP B
**
** is implemented as regexp(B,A).
*/
static void re_sql_func(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
ReCompiled *pRe; /* Compiled regular expression */
const char *zPattern; /* The regular expression */
const unsigned char *zStr;/* String being searched */
const char *zErr; /* Compile error message */
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#ifndef SQLITE_RECURSIVE
# define SQLITE_RECURSIVE 33
#endif
/*
** WEBPAGE: /reportlist
*/
void view_list(void){
const char *zScript;
Blob ril; /* Report Item List */
Stmt q;
int rn = 0;
int cnt = 0;
login_check_credentials();
| > > | > > > > | 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 |
#ifndef SQLITE_RECURSIVE
# define SQLITE_RECURSIVE 33
#endif
/*
** WEBPAGE: /reportlist
**
** Main menu for Tickets.
*/
void view_list(void){
const char *zScript;
Blob ril; /* Report Item List */
Stmt q;
int rn = 0;
int cnt = 0;
login_check_credentials();
if( !g.perm.RdTkt && !g.perm.NewTkt ){
login_needed(g.anon.RdTkt || g.anon.NewTkt);
return;
}
style_header("Ticket Main Menu");
ticket_standard_submenu(T_ALL_BUT(T_REPLIST));
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
zScript = ticket_reportlist_code();
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
blob_zero(&ril);
ticket_init();
|
| ︙ | ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
int rc = SQLITE_OK;
if( *(char**)pError ){
/* We've already seen an error. No need to continue. */
return SQLITE_OK;
}
switch( code ){
case SQLITE_SELECT:
case SQLITE_FUNCTION: {
break;
}
case SQLITE_READ: {
static const char *const azAllowed[] = {
"ticket",
"ticketchng",
| > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
int rc = SQLITE_OK;
if( *(char**)pError ){
/* We've already seen an error. No need to continue. */
return SQLITE_OK;
}
switch( code ){
case SQLITE_SELECT:
case SQLITE_RECURSIVE:
case SQLITE_FUNCTION: {
break;
}
case SQLITE_READ: {
static const char *const azAllowed[] = {
"ticket",
"ticketchng",
|
| ︙ | ︙ | |||
199 200 201 202 203 204 205 |
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
rc = SQLITE_DENY;
}else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
rc = SQLITE_IGNORE;
}
break;
}
| < < < < < | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
rc = SQLITE_DENY;
}else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
rc = SQLITE_IGNORE;
}
break;
}
default: {
*(char**)pError = mprintf("only SELECT statements are allowed");
rc = SQLITE_DENY;
break;
}
}
return rc;
|
| ︙ | ︙ | |||
238 239 240 241 242 243 244 | int i; char *zErr = 0; const char *zTail; sqlite3_stmt *pStmt; int rc; /* First make sure the SQL is a single query command by verifying that | | > | > | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
int i;
char *zErr = 0;
const char *zTail;
sqlite3_stmt *pStmt;
int rc;
/* First make sure the SQL is a single query command by verifying that
** the first token is "SELECT" or "WITH" and that there are no unquoted
** semicolons.
*/
for(i=0; fossil_isspace(zSql[i]); i++){}
if( fossil_strnicmp(&zSql[i], "select", 6)!=0
&& fossil_strnicmp(&zSql[i], "with", 4)!=0 ){
return mprintf("The SQL must be a SELECT or WITH statement");
}
for(i=0; zSql[i]; i++){
if( zSql[i]==';' ){
int bad;
int c = zSql[i+1];
zSql[i+1] = 0;
bad = sqlite3_complete(zSql);
|
| ︙ | ︙ | |||
290 291 292 293 294 295 296 |
const char *zSQL;
const char *zOwner;
const char *zClrKey;
Stmt q;
login_check_credentials();
if( !g.perm.TktFmt ){
| | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
const char *zSQL;
const char *zOwner;
const char *zClrKey;
Stmt q;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
rn = atoi(PD("rn","0"));
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
"FROM reportfmt WHERE rn=%d",rn);
style_header("SQL For Report Format Number %d", rn);
if( db_step(&q)!=SQLITE_ROW ){
|
| ︙ | ︙ | |||
340 341 342 343 344 345 346 |
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
login_check_credentials();
if( !g.perm.TktFmt ){
| | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
/*view_add_functions(0);*/
rn = atoi(PD("rn","0"));
zTitle = P("t");
zOwner = PD("w",g.zLogin);
z = P("s");
|
| ︙ | ︙ | |||
934 935 936 937 938 939 940 941 942 943 944 945 946 947 | ** argument. Each character of the second argument represent a column. ** ** t Sort by text ** n Sort numerically ** k Sort by the data-sortkey property ** x This column is not sortable ** ** If there are fewer characters in zColumnTypes[] than their are columns, ** the all extra columns assume type "t" (text). ** ** The third parameter is the column that was initially sorted (using 1-based ** column numbers, like SQL). Make this value 0 if none of the columns are ** initially sorted. Make the value negative if the column is initially sorted ** in reverse order. | > | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | ** argument. Each character of the second argument represent a column. ** ** t Sort by text ** n Sort numerically ** k Sort by the data-sortkey property ** x This column is not sortable ** ** Capital letters mean sort in reverse order. ** If there are fewer characters in zColumnTypes[] than their are columns, ** the all extra columns assume type "t" (text). ** ** The third parameter is the column that was initially sorted (using 1-based ** column numbers, like SQL). Make this value 0 if none of the columns are ** initially sorted. Make the value negative if the column is initially sorted ** in reverse order. |
| ︙ | ︙ | |||
957 958 959 960 961 962 963 |
@ function SortableTable(tableEl,columnTypes,initSort){
@ this.tbody = tableEl.getElementsByTagName('tbody');
@ this.columnTypes = columnTypes;
@ this.sort = function (cell) {
@ var column = cell.cellIndex;
@ var sortFn;
@ switch( cell.sortType ){
| | | | | > > > | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 |
@ function SortableTable(tableEl,columnTypes,initSort){
@ this.tbody = tableEl.getElementsByTagName('tbody');
@ this.columnTypes = columnTypes;
@ this.sort = function (cell) {
@ var column = cell.cellIndex;
@ var sortFn;
@ switch( cell.sortType ){
@ case "N": case "n": sortFn = this.sortNumeric; break;
@ case "T": case "t": sortFn = this.sortText; break;
@ case "K": case "k": sortFn = this.sortKey; break;
@ default: return;
@ }
@ this.sortIndex = column;
@ var newRows = new Array();
@ for (j = 0; j < this.tbody[0].rows.length; j++) {
@ newRows[j] = this.tbody[0].rows[j];
@ }
@ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){
@ newRows.reverse();
@ this.prevColumn = -this.prevColumn;
@ }else{
@ newRows.sort(sortFn);
@ this.prevColumn = this.sortIndex+1;
@ if( cell.sortType>="A" && cell.sortType<="Z" ){
@ newRows.reverse();
@ }
@ }
@ for (i=0;i<newRows.length;i++) {
@ this.tbody[0].appendChild(newRows[i]);
@ }
@ this.setHdrIcons();
@ }
@ this.setHdrIcons = function() {
|
| ︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 |
@ hdrCell.className = clsName;
@ }
@ }
@ this.sortText = function(a,b) {
@ var i = thisObject.sortIndex;
@ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
| | > | | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 |
@ hdrCell.className = clsName;
@ }
@ }
@ this.sortText = function(a,b) {
@ var i = thisObject.sortIndex;
@ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@ if(aa==bb) return a.rowIndex-b.rowIndex;
@ if(aa<bb) return -1;
@ return 1;
@ }
@ this.sortNumeric = function(a,b) {
@ var i = thisObject.sortIndex;
@ aa = parseFloat(a.cells[i].textContent);
@ if (isNaN(aa)) aa = 0;
@ bb = parseFloat(b.cells[i].textContent);
@ if (isNaN(bb)) bb = 0;
@ if(aa==bb) return a.rowIndex-b.rowIndex;
@ return aa-bb;
@ }
@ this.sortKey = function(a,b) {
@ var i = thisObject.sortIndex;
@ aa = a.cells[i].getAttribute("data-sortkey");
@ bb = b.cells[i].getAttribute("data-sortkey");
@ if(aa==bb) return a.rowIndex-b.rowIndex;
@ if(aa<bb) return -1;
@ return 1;
@ }
@ var x = tableEl.getElementsByTagName('thead');
@ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
@ return;
@ }
|
| ︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | char *zClrKey; int tabs; Stmt q; char *zErr1 = 0; char *zErr2 = 0; login_check_credentials(); | | | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
char *zClrKey;
int tabs;
Stmt q;
char *zErr1 = 0;
char *zErr2 = 0;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
rn = atoi(PD("rn","0"));
if( rn==0 ){
cgi_redirect("reportlist");
return;
}
tabs = P("tablist")!=0;
/* view_add_functions(tabs); */
|
| ︙ | ︙ |
Changes to src/rss.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 |
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
@ (SELECT count(*) FROM plink WHERE cid=blob.rid)
@ FROM event, blob
@ WHERE blob.rid=event.objid
;
login_check_credentials();
| | | | 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 |
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
@ (SELECT count(*) FROM plink WHERE cid=blob.rid)
@ FROM event, blob
@ WHERE blob.rid=event.objid
;
login_check_credentials();
if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
return;
}
blob_zero(&bSQL);
blob_append( &bSQL, zSQL1, -1 );
if( zType[0]!='a' ){
if( zType[0]=='c' && !g.perm.Read ) zType = "x";
if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
blob_append_sql(&bSQL, " AND event.type=%Q", zType);
}else{
if( !g.perm.Read ){
if( g.perm.RdTkt && g.perm.RdWiki ){
blob_append(&bSQL, " AND event.type!='ci'", -1);
}else if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type=='t'", -1);
}else{
blob_append(&bSQL, " AND event.type=='w'", -1);
}
}else if( !g.perm.RdWiki ){
if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type!='w'", -1);
}else{
|
| ︙ | ︙ |
Changes to src/schema.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains string constants that implement the database schema. */ #include "config.h" #include "schema.h" /* ** The database schema for the ~/.fossil configuration database. |
| ︙ | ︙ | |||
43 44 45 46 47 48 49 | ** changes. The aux tables have an arbitrary version number (typically ** a date) which can change frequently. When the content schema changes, ** we have to execute special procedures to update the schema. When ** the aux schema changes, all we need to do is rebuild the database. */ #define CONTENT_SCHEMA "2" #define AUX_SCHEMA_MIN "2011-04-25 19:50" | | > > > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ** changes. The aux tables have an arbitrary version number (typically ** a date) which can change frequently. When the content schema changes, ** we have to execute special procedures to update the schema. When ** the aux schema changes, all we need to do is rebuild the database. */ #define CONTENT_SCHEMA "2" #define AUX_SCHEMA_MIN "2011-04-25 19:50" #define AUX_SCHEMA_MAX "2015-01-24" /* NB: Some features require the latest schema. Warning or error messages ** will appear if an older schema is used. However, the older schemas are ** adequate for many common functions. */ #endif /* INTERFACE */ /* ** The schema for a repository database. ** |
| ︙ | ︙ | |||
79 80 81 82 83 84 85 | @ rcvid INTEGER, -- Origin of this record @ size INTEGER, -- Size of content. -1 for a phantom. @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content @ content BLOB, -- Compressed content of this record @ CHECK( length(uuid)==40 AND rid>0 ) @ ); @ CREATE TABLE delta( | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | @ rcvid INTEGER, -- Origin of this record @ size INTEGER, -- Size of content. -1 for a phantom. @ uuid TEXT UNIQUE NOT NULL, -- SHA1 hash of the content @ content BLOB, -- Compressed content of this record @ CHECK( length(uuid)==40 AND rid>0 ) @ ); @ CREATE TABLE delta( @ rid INTEGER PRIMARY KEY, -- BLOB that is delta-compressed @ srcid INTEGER NOT NULL REFERENCES blob -- Baseline for delta-compression @ ); @ CREATE INDEX delta_i1 ON delta(srcid); @ @ ------------------------------------------------------------------------- @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil @ -- project; the stuff that is normally exchanged during "sync". The |
| ︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 | @ fnid INTEGER PRIMARY KEY, -- Filename ID @ name TEXT UNIQUE -- Name of file page @ ); @ @ -- Linkages between checkins, files created by each checkin, and @ -- the names of those files. @ -- @ -- pid==0 if the file is added by checkin mid. @ -- fid==0 if the file is removed by checkin mid. @ -- @ CREATE TABLE mlink( | > > > > > > > > > > > > > > > > > > > | > | < | > | | 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 | @ fnid INTEGER PRIMARY KEY, -- Filename ID @ name TEXT UNIQUE -- Name of file page @ ); @ @ -- Linkages between checkins, files created by each checkin, and @ -- the names of those files. @ -- @ -- Each entry represents a file that changed content from pid to fid @ -- due to the check-in that goes from pmid to mid. fnid is the name @ -- of the file in the mid check-in. If the file was renamed as part @ -- of the mid check-in, then pfnid is the previous filename. @ @ -- There can be multiple entries for (mid,fid) if the mid checkin was @ -- a merge. Entries with isaux==0 are from the primary parent. Merge @ -- parents have isaux set to true. @ -- @ -- Field name mnemonics: @ -- mid = Manifest ID. (Each check-in is stored as a "Manifest") @ -- fid = File ID. @ -- pmid = Parent Manifest ID. @ -- pid = Parent file ID. @ -- fnid = File Name ID. @ -- pfnid = Parent File Name ID. @ -- isaux = pmid IS AUXiliary parent, not primary parent @ -- @ -- pid==0 if the file is added by checkin mid. @ -- fid==0 if the file is removed by checkin mid. @ -- @ CREATE TABLE mlink( @ mid INTEGER REFERENCES plink(cid), -- Checkin that contains fid @ fid INTEGER REFERENCES blob, -- New file content. 0 if deleted @ pmid INTEGER REFERENCES plink(cid), -- Checkin that contains pid @ pid INTEGER REFERENCES blob, -- Prev file content. 0 if new @ fnid INTEGER REFERENCES filename, -- Name of the file @ pfnid INTEGER REFERENCES filename, -- Previous name. 0 if unchanged @ mperm INTEGER, -- File permissions. 1==exec @ isaux BOOLEAN DEFAULT 0 -- TRUE if pmid is the primary @ ); @ CREATE INDEX mlink_i1 ON mlink(mid); @ CREATE INDEX mlink_i2 ON mlink(fnid); @ CREATE INDEX mlink_i3 ON mlink(fid); @ CREATE INDEX mlink_i4 ON mlink(pid); @ @ -- Parent/child linkages between checkins @ -- @ CREATE TABLE plink( @ pid INTEGER REFERENCES blob, -- Parent manifest @ cid INTEGER REFERENCES blob, -- Child manifest @ isprim BOOLEAN, -- pid is the primary parent of cid @ mtime DATETIME, -- the date/time stamp on cid. Julian day. @ baseid INTEGER REFERENCES blob, -- Baseline if cid is a delta manifest. @ UNIQUE(pid, cid) @ ); @ CREATE INDEX plink_i2 ON plink(cid,pid); @ @ -- A "leaf" checkin is a checkin that has no children in the same @ -- branch. The set of all leaves is easily computed with a join, @ -- between the plink and tagxref tables, but it is a slower join for |
| ︙ | ︙ | |||
486 487 488 489 490 491 492 | @ -- done by an --integrate merge. The difference between vfile.chnged==3|5 @ -- and a regular add is that with vfile.chnged==3|5 we know that the @ -- current version of the file is already in the repository. @ -- @ CREATE TABLE vfile( @ id INTEGER PRIMARY KEY, -- ID of the checked out file @ vid INTEGER REFERENCES blob, -- The baseline this file is part of. | | | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | @ -- done by an --integrate merge. The difference between vfile.chnged==3|5 @ -- and a regular add is that with vfile.chnged==3|5 we know that the @ -- current version of the file is already in the repository. @ -- @ CREATE TABLE vfile( @ id INTEGER PRIMARY KEY, -- ID of the checked out file @ vid INTEGER REFERENCES blob, -- The baseline this file is part of. @ chnged INT DEFAULT 0, -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng 5:i-add @ deleted BOOLEAN DEFAULT 0, -- True if deleted @ isexe BOOLEAN, -- True if file should be executable @ islink BOOLEAN, -- True if file should be symlink @ rid INTEGER, -- Originally from this repository record @ mrid INTEGER, -- Based on this record due to a merge @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 @ pathname TEXT, -- Full pathname relative to root |
| ︙ | ︙ |
Changes to src/search.c.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
** full functionality of FTS4.
*/
#include "config.h"
#include "search.h"
#include <assert.h>
#if INTERFACE
/*
** A compiled search pattern
*/
struct Search {
int nTerm; /* Number of search terms */
struct srchTerm { /* For each search term */
char *z; /* Text */
int n; /* length */
| > > > > | < < | < | < | < | | > | | < < < < < < < < < < < < | < | > > > < > | < | | 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 |
** full functionality of FTS4.
*/
#include "config.h"
#include "search.h"
#include <assert.h>
#if INTERFACE
/* Maximum number of search terms */
#define SEARCH_MAX_TERM 8
/*
** A compiled search pattern
*/
struct Search {
int nTerm; /* Number of search terms */
struct srchTerm { /* For each search term */
char *z; /* Text */
int n; /* length */
} a[SEARCH_MAX_TERM];
/* Snippet controls */
char *zPattern; /* The search pattern */
char *zMarkBegin; /* Start of a match */
char *zMarkEnd; /* End of a match */
char *zMarkGap; /* A gap between two matches */
unsigned fSrchFlg; /* Flags */
int iScore; /* Score of the last match attempt */
Blob snip; /* Snippet for the most recent match */
};
#define SRCHFLG_HTML 0x01 /* Escape snippet text for HTML */
#define SRCHFLG_STATIC 0x04 /* The static gSearch object */
#endif
/*
** There is a single global Search object:
*/
static Search gSearch;
/*
** Theses characters constitute a word boundary
*/
static const char isBoundary[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
| ︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /* | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > < | | | > | > > | > | > > | > > | < > > > > > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > | | | > | | < > | < > > | | > | | < | > | | | | < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > | > > > > > > > | > > > > > | > > > > > | > > > > > > | > | > | > > | > > > > > > > > > | | > > | > > > > > > > > > > > > > > | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#define ISALNUM(x) (!isBoundary[(x)&0xff])
/*
** Destroy a search context.
*/
void search_end(Search *p){
if( p ){
fossil_free(p->zPattern);
fossil_free(p->zMarkBegin);
fossil_free(p->zMarkEnd);
fossil_free(p->zMarkGap);
if( p->iScore ) blob_reset(&p->snip);
memset(p, 0, sizeof(*p));
if( p!=&gSearch ) fossil_free(p);
}
}
/*
** Compile a search pattern
*/
Search *search_init(
const char *zPattern, /* The search pattern */
const char *zMarkBegin, /* Start of a match */
const char *zMarkEnd, /* End of a match */
const char *zMarkGap, /* A gap between two matches */
unsigned fSrchFlg /* Flags */
){
Search *p;
char *z;
int i;
if( fSrchFlg & SRCHFLG_STATIC ){
p = &gSearch;
search_end(p);
}else{
p = fossil_malloc(sizeof(*p));
memset(p, 0, sizeof(*p));
}
p->zPattern = z = mprintf("%s", zPattern);
p->zMarkBegin = mprintf("%s", zMarkBegin);
p->zMarkEnd = mprintf("%s", zMarkEnd);
p->zMarkGap = mprintf("%s", zMarkGap);
p->fSrchFlg = fSrchFlg;
blob_init(&p->snip, 0, 0);
while( *z && p->nTerm<SEARCH_MAX_TERM ){
while( *z && !ISALNUM(*z) ){ z++; }
if( *z==0 ) break;
p->a[p->nTerm].z = z;
for(i=1; ISALNUM(z[i]); i++){}
p->a[p->nTerm].n = i;
z += i;
p->nTerm++;
}
return p;
}
/*
** Append n bytes of text to snippet zTxt. Encode the text appropriately.
*/
static void snippet_text_append(
Search *p, /* The search context */
Blob *pSnip, /* Append to this snippet */
const char *zTxt, /* Text to append */
int n /* How many bytes to append */
){
if( n>0 ){
if( p->fSrchFlg & SRCHFLG_HTML ){
blob_appendf(pSnip, "%#h", n, zTxt);
}else{
blob_append(pSnip, zTxt, n);
}
}
}
/*
** Compare a search pattern against one or more input strings which
** collectively comprise a document. Return a match score. Any
** postive value means there was a match. Zero means that one or
** more terms are missing.
**
** The score and a snippet are record for future use.
**
** Scoring:
** * All terms must match at least once or the score is zero
** * One point for each matching term
** * Extra points if consecutive words of the pattern are consecutive
** in the document
*/
static int search_match(
Search *p, /* Search pattern and flags */
int nDoc, /* Number of strings in this document */
const char **azDoc /* Text of each string */
){
int score; /* Final score */
int i; /* Offset into current document */
int ii; /* Loop counter */
int j; /* Loop over search terms */
int k; /* Loop over prior terms */
int iWord = 0; /* Current word number */
int iDoc; /* Current document number */
int wantGap = 0; /* True if a zMarkGap is wanted */
const char *zDoc; /* Current document text */
const int CTX = 50; /* Amount of snippet context */
int anMatch[SEARCH_MAX_TERM]; /* Number of terms in best match */
int aiBestDoc[SEARCH_MAX_TERM]; /* Document containing best match */
int aiBestOfst[SEARCH_MAX_TERM]; /* Byte offset to start of best match */
int aiLastDoc[SEARCH_MAX_TERM]; /* Document containing most recent match */
int aiLastOfst[SEARCH_MAX_TERM]; /* Byte offset to the most recent match */
int aiWordIdx[SEARCH_MAX_TERM]; /* Word index of most recent match */
memset(anMatch, 0, sizeof(anMatch));
memset(aiWordIdx, 0xff, sizeof(aiWordIdx));
for(iDoc=0; iDoc<nDoc; iDoc++){
zDoc = azDoc[iDoc];
if( zDoc==0 ) continue;
iWord++;
for(i=0; zDoc[i]; i++){
if( !ISALNUM(zDoc[i]) ) continue;
iWord++;
for(j=0; j<p->nTerm; j++){
int n = p->a[j].n;
if( sqlite3_strnicmp(p->a[j].z, &zDoc[i], n)==0
&& (!ISALNUM(zDoc[i+n]) || p->a[j].z[n]=='*')
){
aiWordIdx[j] = iWord;
aiLastDoc[j] = iDoc;
aiLastOfst[j] = i;
for(k=1; j-k>=0 && anMatch[j-k] && aiWordIdx[j-k]==iWord-k; k++){}
for(ii=0; ii<k; ii++){
if( anMatch[j-ii]<k ){
anMatch[j-ii] = k*(nDoc-iDoc);
aiBestDoc[j-ii] = aiLastDoc[j-ii];
aiBestOfst[j-ii] = aiLastOfst[j-ii];
}
}
break;
}
}
while( ISALNUM(zDoc[i]) ){ i++; }
if( zDoc[i]==0 ) break;
}
}
/* Finished search all documents.
** Every term must be seen or else the score is zero
*/
score = 1;
for(j=0; j<p->nTerm; j++) score *= anMatch[j];
blob_reset(&p->snip);
p->iScore = score;
if( score==0 ) return score;
/* Prepare a snippet that describes the matching text.
*/
while(1){
int iOfst;
int iTail;
int iBest;
for(ii=0; ii<p->nTerm && anMatch[ii]==0; ii++){}
if( ii>=p->nTerm ) break; /* This is where the loop exits */
iBest = ii;
iDoc = aiBestDoc[ii];
iOfst = aiBestOfst[ii];
for(; ii<p->nTerm; ii++){
if( anMatch[ii]==0 ) continue;
if( aiBestDoc[ii]>iDoc ) continue;
if( aiBestOfst[ii]>iOfst ) continue;
iDoc = aiBestDoc[ii];
iOfst = aiBestOfst[ii];
iBest = ii;
}
iTail = iOfst + p->a[iBest].n;
anMatch[iBest] = 0;
for(ii=0; ii<p->nTerm; ii++){
if( anMatch[ii]==0 ) continue;
if( aiBestDoc[ii]!=iDoc ) continue;
if( aiBestOfst[ii]<=iTail+CTX*2 ){
if( iTail<aiBestOfst[ii]+p->a[ii].n ){
iTail = aiBestOfst[ii]+p->a[ii].n;
}
anMatch[ii] = 0;
ii = -1;
continue;
}
}
zDoc = azDoc[iDoc];
iOfst -= CTX;
if( iOfst<0 ) iOfst = 0;
while( iOfst>0 && ISALNUM(zDoc[iOfst-1]) ) iOfst--;
while( zDoc[iOfst] && !ISALNUM(zDoc[iOfst]) ) iOfst++;
for(ii=0; ii<CTX && zDoc[iTail]; ii++, iTail++){}
while( ISALNUM(zDoc[iTail]) ) iTail++;
if( iOfst>0 || wantGap ) blob_append(&p->snip, p->zMarkGap, -1);
wantGap = zDoc[iTail]!=0;
zDoc += iOfst;
iTail -= iOfst;
/* Add a snippet segment using characters iOfst..iOfst+iTail from zDoc */
for(i=0; i<iTail; i++){
if( !ISALNUM(zDoc[i]) ) continue;
for(j=0; j<p->nTerm; j++){
int n = p->a[j].n;
if( sqlite3_strnicmp(p->a[j].z, &zDoc[i], n)==0
&& (!ISALNUM(zDoc[i+n]) || p->a[j].z[n]=='*')
){
snippet_text_append(p, &p->snip, zDoc, i);
zDoc += i;
iTail -= i;
blob_append(&p->snip, p->zMarkBegin, -1);
if( p->a[j].z[n]=='*' ){
while( ISALNUM(zDoc[n]) ) n++;
}
snippet_text_append(p, &p->snip, zDoc, n);
zDoc += n;
iTail -= n;
blob_append(&p->snip, p->zMarkEnd, -1);
i = -1;
break;
} /* end-if */
} /* end for(j) */
if( j<p->nTerm ){
while( ISALNUM(zDoc[i]) && i<iTail ){ i++; }
}
} /* end for(i) */
snippet_text_append(p, &p->snip, zDoc, iTail);
}
if( wantGap ) blob_append(&p->snip, p->zMarkGap, -1);
return score;
}
/*
** COMMAND: test-match
**
** Usage: fossil test-match SEARCHSTRING FILE1 FILE2 ...
*/
void test_match_cmd(void){
Search *p;
int i;
Blob x;
int score;
char *zDoc;
int flg = 0;
char *zBegin = (char*)find_option("begin",0,1);
char *zEnd = (char*)find_option("end",0,1);
char *zGap = (char*)find_option("gap",0,1);
if( find_option("html",0,0)!=0 ) flg |= SRCHFLG_HTML;
if( find_option("static",0,0)!=0 ) flg |= SRCHFLG_STATIC;
verify_all_options();
if( g.argc<4 ) usage("SEARCHSTRING FILE1...");
if( zBegin==0 ) zBegin = "[[";
if( zEnd==0 ) zEnd = "]]";
if( zGap==0 ) zGap = " ... ";
p = search_init(g.argv[2], zBegin, zEnd, zGap, flg);
for(i=3; i<g.argc; i++){
blob_read_from_file(&x, g.argv[i]);
zDoc = blob_str(&x);
score = search_match(p, 1, (const char**)&zDoc);
fossil_print("%s: %d\n", g.argv[i], p->iScore);
blob_reset(&x);
if( score ){
fossil_print("%.78c\n%s\n%.78c\n\n", '=', blob_str(&p->snip), '=');
}
}
search_end(p);
}
/*
** An SQL function to initialize the global search pattern:
**
** search_init(PATTERN,BEGIN,END,GAP,FLAGS)
**
** All arguments are optional.
*/
static void search_init_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zPattern = 0;
const char *zBegin = "<mark>";
const char *zEnd = "</mark>";
const char *zGap = " ... ";
unsigned int flg = SRCHFLG_HTML;
switch( argc ){
default:
flg = (unsigned int)sqlite3_value_int(argv[4]);
case 4:
zGap = (const char*)sqlite3_value_text(argv[3]);
case 3:
zEnd = (const char*)sqlite3_value_text(argv[2]);
case 2:
zBegin = (const char*)sqlite3_value_text(argv[1]);
case 1:
zPattern = (const char*)sqlite3_value_text(argv[0]);
}
if( zPattern && zPattern[0] ){
search_init(zPattern, zBegin, zEnd, zGap, flg | SRCHFLG_STATIC);
}else{
search_end(&gSearch);
}
}
/*
** Try to match the input text against the search parameters set up
** by the previous search_init() call. Remember the results globally.
** Return non-zero on a match and zero on a miss.
*/
static void search_match_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *azDoc[5];
int nDoc;
int rc;
for(nDoc=0; nDoc<ArraySize(azDoc) && nDoc<argc; nDoc++){
azDoc[nDoc] = (const char*)sqlite3_value_text(argv[nDoc]);
if( azDoc[nDoc]==0 ) azDoc[nDoc] = "";
}
rc = search_match(&gSearch, nDoc, azDoc);
sqlite3_result_int(context, rc);
}
/*
** These SQL functions return the results of the last
** call to the search_match() SQL function.
*/
static void search_score_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
sqlite3_result_int(context, gSearch.iScore);
}
static void search_snippet_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
if( blob_size(&gSearch.snip)>0 ){
sqlite3_result_text(context, blob_str(&gSearch.snip), -1, fossil_free);
blob_init(&gSearch.snip, 0, 0);
}
}
/*
** This is an SQLite function that computes the searchable text.
** It is a wrapper around the search_stext() routine. See the
** search_stext() routine for further detail.
*/
static void search_stext_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zType = (const char*)sqlite3_value_text(argv[0]);
int rid = sqlite3_value_int(argv[1]);
const char *zName = (const char*)sqlite3_value_text(argv[2]);
sqlite3_result_text(context, search_stext_cached(zType[0],rid,zName,0), -1,
SQLITE_TRANSIENT);
}
static void search_title_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zType = (const char*)sqlite3_value_text(argv[0]);
int rid = sqlite3_value_int(argv[1]);
const char *zName = (const char*)sqlite3_value_text(argv[2]);
int nHdr;
char *z = search_stext_cached(zType[0], rid, zName, &nHdr);
if( nHdr || zType[0]!='d' ){
sqlite3_result_text(context, z, nHdr, SQLITE_TRANSIENT);
}else{
sqlite3_result_value(context, argv[2]);
}
}
static void search_body_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zType = (const char*)sqlite3_value_text(argv[0]);
int rid = sqlite3_value_int(argv[1]);
const char *zName = (const char*)sqlite3_value_text(argv[2]);
int nHdr;
char *z = search_stext_cached(zType[0], rid, zName, &nHdr);
sqlite3_result_text(context, z+nHdr+1, -1, SQLITE_TRANSIENT);
}
/*
** Encode a string for use as a query parameter in a URL
*/
static void search_urlencode_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
char *z = mprintf("%T",sqlite3_value_text(argv[0]));
sqlite3_result_text(context, z, -1, fossil_free);
}
/*
** Register the "score()" SQL function to score its input text
** using the given Search object. Once this function is registered,
** do not delete the Search object.
*/
void search_sql_setup(sqlite3 *db){
static int once = 0;
if( once++ ) return;
sqlite3_create_function(db, "search_match", -1, SQLITE_UTF8, 0,
search_match_sqlfunc, 0, 0);
sqlite3_create_function(db, "search_score", 0, SQLITE_UTF8, 0,
search_score_sqlfunc, 0, 0);
sqlite3_create_function(db, "search_snippet", 0, SQLITE_UTF8, 0,
search_snippet_sqlfunc, 0, 0);
sqlite3_create_function(db, "search_init", -1, SQLITE_UTF8, 0,
search_init_sqlfunc, 0, 0);
sqlite3_create_function(db, "stext", 3, SQLITE_UTF8, 0,
search_stext_sqlfunc, 0, 0);
sqlite3_create_function(db, "title", 3, SQLITE_UTF8, 0,
search_title_sqlfunc, 0, 0);
sqlite3_create_function(db, "body", 3, SQLITE_UTF8, 0,
search_body_sqlfunc, 0, 0);
sqlite3_create_function(db, "urlencode", 1, SQLITE_UTF8, 0,
search_urlencode_sqlfunc, 0, 0);
}
/*
** Testing the search function.
**
** COMMAND: search*
** %fossil search [-all|-a] [-limit|-n #] [-width|-W #] pattern...
|
| ︙ | ︙ | |||
196 197 198 199 200 201 202 |
** all matches, regardless of their search score.
** The -limit option can be used to limit the number
** of entries returned. The -width option can be
** used to set the output width used when printing
** matches.
*/
void search_cmd(void){
| < | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
** all matches, regardless of their search score.
** The -limit option can be used to limit the number
** of entries returned. The -width option can be
** used to set the output width used when printing
** matches.
*/
void search_cmd(void){
Blob pattern;
int i;
Blob sql = empty_blob;
Stmt q;
int iBest;
char fAll = NULL != find_option("all", "a", 0); /* If set, do not lop
off the end of the
|
| ︙ | ︙ | |||
225 226 227 228 229 230 231 |
db_must_be_within_tree();
if( g.argc<2 ) return;
blob_init(&pattern, g.argv[2], -1);
for(i=3; i<g.argc; i++){
blob_appendf(&pattern, " %s", g.argv[i]);
}
| | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
db_must_be_within_tree();
if( g.argc<2 ) return;
blob_init(&pattern, g.argv[2], -1);
for(i=3; i<g.argc; i++){
blob_appendf(&pattern, " %s", g.argv[i]);
}
(void)search_init(blob_str(&pattern),"*","*","...",SRCHFLG_STATIC);
blob_reset(&pattern);
search_sql_setup(g.db);
db_multi_exec(
"CREATE TEMP TABLE srch(rid,uuid,date,comment,x);"
"CREATE INDEX srch_idx1 ON srch(x);"
"INSERT INTO srch(rid,uuid,date,comment,x)"
" SELECT blob.rid, uuid, datetime(event.mtime%s),"
" coalesce(ecomment,comment),"
|
| ︙ | ︙ | |||
253 254 255 256 257 258 259 | } blob_append(&sql, "ORDER BY x DESC, date DESC ", -1); db_prepare(&q, "%s", blob_sql_text(&sql)); blob_reset(&sql); print_timeline(&q, nLimit, width, 0); db_finalize(&q); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 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 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 |
}
blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
db_prepare(&q, "%s", blob_sql_text(&sql));
blob_reset(&sql);
print_timeline(&q, nLimit, width, 0);
db_finalize(&q);
}
#if INTERFACE
/* What to search for */
#define SRCH_CKIN 0x0001 /* Search over check-in comments */
#define SRCH_DOC 0x0002 /* Search over embedded documents */
#define SRCH_TKT 0x0004 /* Search over tickets */
#define SRCH_WIKI 0x0008 /* Search over wiki */
#define SRCH_ALL 0x000f /* Search over everything */
#endif
/*
** Remove bits from srchFlags which are disallowed by either the
** current server configuration or by user permissions.
*/
unsigned int search_restrict(unsigned int srchFlags){
static unsigned int knownGood = 0;
static unsigned int knownBad = 0;
static const struct { unsigned m; const char *zKey; } aSetng[] = {
{ SRCH_CKIN, "search-ci" },
{ SRCH_DOC, "search-doc" },
{ SRCH_TKT, "search-tkt" },
{ SRCH_WIKI, "search-wiki" },
};
int i;
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
for(i=0; i<ArraySize(aSetng); i++){
unsigned int m = aSetng[i].m;
if( (srchFlags & m)==0 ) continue;
if( ((knownGood|knownBad) & m)!=0 ) continue;
if( db_get_boolean(aSetng[i].zKey,0) ){
knownGood |= m;
}else{
knownBad |= m;
}
}
return srchFlags & ~knownBad;
}
/*
** When this routine is called, there already exists a table
**
** x(label,url,score,date,snip).
**
** And the srchFlags parameter has been validated. This routine
** fills the X table with search results using a full-text scan.
**
** The companion indexed scan routine is search_indexed().
*/
static void search_fullscan(
const char *zPattern, /* The query pattern */
unsigned int srchFlags /* What to search over */
){
search_init(zPattern, "<mark>", "</mark>", " ... ",
SRCHFLG_STATIC|SRCHFLG_HTML);
if( (srchFlags & SRCH_DOC)!=0 ){
char *zDocGlob = db_get("doc-glob","");
char *zDocBr = db_get("doc-branch","trunk");
if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
db_multi_exec(
"CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;"
);
db_multi_exec(
"INSERT INTO x(label,url,score,id,date,snip)"
" SELECT printf('Document: %%s',title('d',blob.rid,foci.filename)),"
" printf('/doc/%T/%%s',foci.filename),"
" search_score(),"
" 'd'||blob.rid,"
" (SELECT datetime(event.mtime) FROM event"
" WHERE objid=symbolic_name_to_rid('trunk')),"
" search_snippet()"
" FROM foci CROSS JOIN blob"
" WHERE checkinID=symbolic_name_to_rid('trunk')"
" AND blob.uuid=foci.uuid"
" AND search_match(title('d',blob.rid,foci.filename),"
" body('d',blob.rid,foci.filename))"
" AND %z",
zDocBr, glob_expr("foci.filename", zDocGlob)
);
}
}
if( (srchFlags & SRCH_WIKI)!=0 ){
db_multi_exec(
"WITH wiki(name,rid,mtime) AS ("
" SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"
" FROM tag, tagxref"
" WHERE tag.tagname GLOB 'wiki-*'"
" AND tagxref.tagid=tag.tagid"
" GROUP BY 1"
")"
"INSERT INTO x(label,url,score,id,date,snip)"
" SELECT printf('Wiki: %%s',name),"
" printf('/wiki?name=%%s',urlencode(name)),"
" search_score(),"
" 'w'||rid,"
" datetime(mtime),"
" search_snippet()"
" FROM wiki"
" WHERE search_match(title('w',rid,name),body('w',rid,name));"
);
}
if( (srchFlags & SRCH_CKIN)!=0 ){
db_multi_exec(
"WITH ckin(uuid,rid,mtime) AS ("
" SELECT blob.uuid, event.objid, event.mtime"
" FROM event, blob"
" WHERE event.type='ci'"
" AND blob.rid=event.objid"
")"
"INSERT INTO x(label,url,score,id,date,snip)"
" SELECT printf('Check-in [%%.10s] on %%s',uuid,datetime(mtime)),"
" printf('/timeline?c=%%s&n=8&y=ci',uuid),"
" search_score(),"
" 'c'||rid,"
" datetime(mtime),"
" search_snippet()"
" FROM ckin"
" WHERE search_match('',body('c',rid,NULL));"
);
}
if( (srchFlags & SRCH_TKT)!=0 ){
db_multi_exec(
"INSERT INTO x(label,url,score,id,date,snip)"
" SELECT printf('Ticket: %%s (%%s)',title('t',tkt_id,NULL),"
"datetime(tkt_mtime)),"
" printf('/tktview/%%.20s',tkt_uuid),"
" search_score(),"
" 't'||tkt_id,"
" datetime(tkt_mtime),"
" search_snippet()"
" FROM ticket"
" WHERE search_match(title('t',tkt_id,NULL),body('t',tkt_id,NULL));"
);
}
}
/*
** Number of significant bits in a u32
*/
static int nbits(u32 x){
int n = 0;
while( x ){ n++; x >>= 1; }
return n;
}
/*
** Implemenation of the rank() function used with rank(matchinfo(*,'pcsx')).
*/
static void search_rank_sqlfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned *aVal = (unsigned int*)sqlite3_value_blob(argv[0]);
int nVal = sqlite3_value_bytes(argv[0])/4;
int nCol; /* Number of columns in the index */
int nTerm; /* Number of search terms in the query */
int i, j; /* Loop counter */
double r = 0.0; /* Score */
const unsigned *aX, *aS;
if( nVal<2 ) return;
nTerm = aVal[0];
nCol = aVal[1];
if( nVal<2+3*nCol*nTerm+nCol ) return;
aS = aVal+2;
aX = aS+nCol;
for(j=0; j<nCol; j++){
double x;
if( aS[j]>0 ){
x = 0.0;
for(i=0; i<nTerm; i++){
int hits_this_row;
int hits_all_rows;
int rows_with_hit;
double avg_hits_per_row;
hits_this_row = aX[j + i*nCol*3];
if( hits_this_row==0 )continue;
hits_all_rows = aX[j + i*nCol*3 + 1];
rows_with_hit = aX[j + i*nCol*3 + 2];
if( rows_with_hit==0 ) continue;
avg_hits_per_row = hits_all_rows/(double)rows_with_hit;
x += hits_this_row/(avg_hits_per_row*nbits(rows_with_hit));
}
x *= (1<<((30*(aS[j]-1))/nTerm));
}else{
x = 0.0;
}
r = r*10.0 + x;
}
#define SEARCH_DEBUG_RANK 0
#if SEARCH_DEBUG_RANK
{
Blob x;
blob_init(&x,0,0);
blob_appendf(&x,"%08x", (int)r);
for(i=0; i<nVal; i++){
blob_appendf(&x," %d", aVal[i]);
}
blob_appendf(&x," r=%g", r);
sqlite3_result_text(context, blob_str(&x), -1, fossil_free);
}
#else
sqlite3_result_double(context, r);
#endif
}
/*
** When this routine is called, there already exists a table
**
** x(label,url,score,date,snip).
**
** And the srchFlags parameter has been validated. This routine
** fills the X table with search results using a index scan.
**
** The companion full-text scan routine is search_fullscan().
*/
static void search_indexed(
const char *zPattern, /* The query pattern */
unsigned int srchFlags /* What to search over */
){
Blob sql;
if( srchFlags==0 ) return;
sqlite3_create_function(g.db, "rank", 1, SQLITE_UTF8, 0,
search_rank_sqlfunc, 0, 0);
blob_init(&sql, 0, 0);
blob_appendf(&sql,
"INSERT INTO x(label,url,score,id,date,snip) "
" SELECT ftsdocs.label,"
" ftsdocs.url,"
" rank(matchinfo(ftsidx,'pcsx')),"
" ftsdocs.type || ftsdocs.rid,"
" datetime(ftsdocs.mtime),"
" snippet(ftsidx,'<mark>','</mark>',' ... ',-1,35)"
" FROM ftsidx CROSS JOIN ftsdocs"
" WHERE ftsidx MATCH %Q"
" AND ftsdocs.rowid=ftsidx.docid",
zPattern
);
if( srchFlags!=SRCH_ALL ){
const char *zSep = " AND (";
static const struct { unsigned m; char c; } aMask[] = {
{ SRCH_CKIN, 'c' },
{ SRCH_DOC, 'd' },
{ SRCH_TKT, 't' },
{ SRCH_WIKI, 'w' },
};
int i;
for(i=0; i<ArraySize(aMask); i++){
if( srchFlags & aMask[i].m ){
blob_appendf(&sql, "%sftsdocs.type='%c'", zSep, aMask[i].c);
zSep = " OR ";
}
}
blob_append(&sql,")",1);
}
db_multi_exec("%s",blob_str(&sql)/*safe-for-%s*/);
#if SEARCH_DEBUG_RANK
db_multi_exec("UPDATE x SET label=printf('%%s (score=%%s)',label,score)");
#endif
}
/*
** If z[] is of the form "<mark>TEXT</mark>" where TEXT contains
** no white-space or punctuation, then return the length of the mark.
*/
static int isSnippetMark(const char *z){
int n;
if( strncmp(z,"<mark>",6)!=0 ) return 0;
n = 6;
while( fossil_isalnum(z[n]) ) n++;
if( strncmp(&z[n],"</mark>",7)!=0 ) return 0;
return n+7;
}
/*
** Return a copy of zSnip (in memory obtained from fossil_malloc()) that
** has all "<" characters, other than those on <mark> and </mark>,
** converted into "<". This is similar to htmlize() except that
** <mark> and </mark> are preserved.
*/
static char *cleanSnippet(const char *zSnip){
int i;
int n = 0;
char *z;
for(i=0; zSnip[i]; i++) if( zSnip[i]=='<' ) n++;
z = fossil_malloc( i+n*4+1 );
i = 0;
while( zSnip[0] ){
if( zSnip[0]=='<' ){
n = isSnippetMark(zSnip);
if( n ){
memcpy(&z[i], zSnip, n);
zSnip += n;
i += n;
continue;
}else{
memcpy(&z[i], "<", 4);
i += 4;
zSnip++;
}
}else{
z[i++] = zSnip[0];
zSnip++;
}
}
z[i] = 0;
return z;
}
/*
** This routine generates web-page output for a search operation.
** Other web-pages can invoke this routine to add search results
** in the middle of the page.
**
** Return the number of rows.
*/
int search_run_and_output(
const char *zPattern, /* The query pattern */
unsigned int srchFlags, /* What to search over */
int fDebug /* Extra debugging output */
){
Stmt q;
int nRow = 0;
srchFlags = search_restrict(srchFlags);
if( srchFlags==0 ) return 0;
search_sql_setup(g.db);
add_content_sql_commands(g.db);
db_multi_exec(
"CREATE TEMP TABLE x(label,url,score,id,date,snip);"
);
if( !search_index_exists() ){
search_fullscan(zPattern, srchFlags);
}else{
search_update_index(srchFlags);
search_indexed(zPattern, srchFlags);
}
db_prepare(&q, "SELECT url, snip, label, score, id"
" FROM x"
" ORDER BY score DESC, date DESC;");
while( db_step(&q)==SQLITE_ROW ){
const char *zUrl = db_column_text(&q, 0);
const char *zSnippet = db_column_text(&q, 1);
const char *zLabel = db_column_text(&q, 2);
if( nRow==0 ){
@ <ol>
}
nRow++;
@ <li><p><a href='%R%s(zUrl)'>%h(zLabel)</a>
if( fDebug ){
@ (%e(db_column_double(&q,3)), %s(db_column_text(&q,4)))
}
@ <br><span class='snippet'>%z(cleanSnippet(zSnippet))</span></li>
}
db_finalize(&q);
if( nRow ){
@ </ol>
}
return nRow;
}
/*
** Generate some HTML for doing search. At a minimum include the
** Search-Text entry form. If the "s" query parameter is present, also
** show search results.
**
** The srchFlags parameter restricts the set of documents to be searched.
** srchFlags should normally be either a single search category or all
** categories. Any srchFlags with two or more bits set
** is treated like SRCH_ALL for display purposes.
**
** This routine automatically restricts srchFlag according to user
** permissions and the server configuration. The entry box is shown
** disabled if srchFlags is 0 after these restrictions are applied.
**
** If useYparam is true, then this routine also looks at the y= query
** parameter for further search restrictions.
*/
void search_screen(unsigned srchFlags, int useYparam){
const char *zType = 0;
const char *zClass = 0;
const char *zDisable1;
const char *zDisable2;
const char *zPattern;
int fDebug = PB("debug");
srchFlags = search_restrict(srchFlags);
switch( srchFlags ){
case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break;
case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break;
case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break;
case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break;
}
if( srchFlags==0 ){
zDisable1 = " disabled";
zDisable2 = " disabled";
zPattern = "";
}else{
zDisable1 = " autofocus";
zDisable2 = "";
zPattern = PD("s","");
}
@ <form method='GET' action='%R/%t(g.zPath)'>
if( zClass ){
@ <div class='searchForm searchForm%s(zClass)'>
}else{
@ <div class='searchForm'>
}
@ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable1)>
if( useYparam && (srchFlags & (srchFlags-1))!=0 && useYparam ){
static const struct { char *z; char *zNm; unsigned m; } aY[] = {
{ "all", "All", SRCH_ALL },
{ "c", "Check-ins", SRCH_CKIN },
{ "d", "Docs", SRCH_DOC },
{ "t", "Tickets", SRCH_TKT },
{ "w", "Wiki", SRCH_WIKI },
};
const char *zY = PD("y","all");
unsigned newFlags = srchFlags;
int i;
@ <select size='1' name='y'>
for(i=0; i<ArraySize(aY); i++){
if( (aY[i].m & srchFlags)==0 ) continue;
cgi_printf("<option value='%s'", aY[i].z);
if( fossil_strcmp(zY,aY[i].z)==0 ){
newFlags &= aY[i].m;
cgi_printf(" selected");
}
cgi_printf(">%s</option>\n", aY[i].zNm);
}
@ </select>
srchFlags = newFlags;
}
if( fDebug ){
@ <input type="hidden" name="debug" value="1">
}
@ <input type="submit" value="Search%s(zType)"%s(zDisable2)>
if( srchFlags==0 ){
@ <p class="generalError">Search is disabled</p>
}
@ </div></form>
while( fossil_isspace(zPattern[0]) ) zPattern++;
if( zPattern[0] ){
if( zClass ){
@ <div class='searchResult searchResult%s(zClass)'>
}else{
@ <div class='searchResult'>
}
if( search_run_and_output(zPattern, srchFlags, fDebug)==0 ){
@ <p class='searchEmpty'>No matches for: <span>%h(zPattern)</span></p>
}
@ </div>
}
}
/*
** WEBPAGE: /search
**
** Search for check-in comments, documents, tickets, or wiki that
** match a user-supplied pattern.
*/
void search_page(void){
login_check_credentials();
style_header("Search");
search_screen(SRCH_ALL, 1);
style_footer();
}
/*
** This is a helper function for search_stext(). Writing into pOut
** the search text obtained from pIn according to zMimetype.
**
** The title of the document is the first line of text. All subsequent
** lines are the body. If the document has no title, the first line
** is blank.
*/
static void get_stext_by_mimetype(
Blob *pIn,
const char *zMimetype,
Blob *pOut
){
Blob html, title;
blob_init(&html, 0, 0);
blob_init(&title, 0, 0);
if( zMimetype==0 ) zMimetype = "text/plain";
if( fossil_strcmp(zMimetype,"text/x-fossil-wiki")==0 ){
Blob tail;
blob_init(&tail, 0, 0);
if( wiki_find_title(pIn, &title, &tail) ){
blob_appendf(pOut, "%s\n", blob_str(&title));
wiki_convert(&tail, &html, 0);
blob_reset(&tail);
}else{
blob_append(pOut, "\n", 1);
wiki_convert(pIn, &html, 0);
}
html_to_plaintext(blob_str(&html), pOut);
}else if( fossil_strcmp(zMimetype,"text/x-markdown")==0 ){
markdown_to_html(pIn, &title, &html);
if( blob_size(&title) ){
blob_appendf(pOut, "%s\n", blob_str(&title));
}else{
blob_append(pOut, "\n", 1);
}
html_to_plaintext(blob_str(&html), pOut);
}else if( fossil_strcmp(zMimetype,"text/html")==0 ){
if( doc_is_embedded_html(pIn, &title) ){
blob_appendf(pOut, "%s\n", blob_str(&title));
}
html_to_plaintext(blob_str(pIn), pOut);
}else{
blob_append(pOut, blob_buffer(pIn), blob_size(pIn));
}
blob_reset(&html);
blob_reset(&title);
}
/*
** Query pQuery is pointing at a single row of output. Append a text
** representation of every text-compatible column to pAccum.
*/
static void append_all_ticket_fields(Blob *pAccum, Stmt *pQuery, int iTitle){
int n = db_column_count(pQuery);
int i;
const char *zMime = 0;
if( iTitle>=0 && iTitle<n ){
if( db_column_type(pQuery,iTitle)==SQLITE_TEXT ){
blob_append(pAccum, db_column_text(pQuery,iTitle), -1);
}
blob_append(pAccum, "\n", 1);
}
for(i=0; i<n; i++){
const char *zColName = db_column_name(pQuery,i);
int eType = db_column_type(pQuery,i);
if( i==iTitle ) continue;
if( fossil_strnicmp(zColName,"tkt_",4)==0 ) continue;
if( fossil_strnicmp(zColName,"private_",8)==0 ) continue;
if( eType==SQLITE_BLOB || eType==SQLITE_NULL ) continue;
if( fossil_stricmp(zColName,"mimetype")==0 ){
zMime = db_column_text(pQuery,i);
if( fossil_strcmp(zMime,"text/plain")==0 ) zMime = 0;
}else if( zMime==0 || eType!=SQLITE_TEXT ){
blob_appendf(pAccum, "%s: %s |\n", zColName, db_column_text(pQuery,i));
}else{
Blob txt;
blob_init(&txt, db_column_text(pQuery,i), -1);
blob_appendf(pAccum, "%s: ", zColName);
get_stext_by_mimetype(&txt, zMime, pAccum);
blob_append(pAccum, " |", 2);
blob_reset(&txt);
}
}
}
/*
** Return "search text" - a reduced version of a document appropriate for
** full text search and/or for constructing a search result snippet.
**
** cType: d Embedded documentation
** w Wiki page
** c Check-in comment
** t Ticket text
**
** rid The RID of an artifact that defines the object
** being searched.
**
** zName Name of the object being searched.
*/
void search_stext(
char cType, /* Type of document */
int rid, /* BLOB.RID or TAG.TAGID value for document */
const char *zName, /* Auxiliary information */
Blob *pOut /* OUT: Initialize to the search text */
){
blob_init(pOut, 0, 0);
switch( cType ){
case 'd': { /* Documents */
Blob doc;
content_get(rid, &doc);
blob_to_utf8_no_bom(&doc, 0);
get_stext_by_mimetype(&doc, mimetype_from_name(zName), pOut);
blob_reset(&doc);
break;
}
case 'w': { /* Wiki */
Manifest *pWiki = manifest_get(rid, CFTYPE_WIKI,0);
Blob wiki;
if( pWiki==0 ) break;
blob_init(&wiki, pWiki->zWiki, -1);
get_stext_by_mimetype(&wiki, wiki_filter_mimetypes(pWiki->zMimetype),
pOut);
blob_reset(&wiki);
manifest_destroy(pWiki);
break;
}
case 'c': { /* Check-in Comments */
static Stmt q;
static int isPlainText = -1;
db_static_prepare(&q,
"SELECT coalesce(ecomment,comment)"
" ||' (user: '||coalesce(euser,user,'?')"
" ||', tags: '||"
" (SELECT group_concat(substr(tag.tagname,5),',')"
" FROM tag, tagxref"
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
" AND tagxref.rid=event.objid AND tagxref.tagtype>0)"
" ||')'"
" FROM event WHERE objid=:x AND type='ci'");
if( isPlainText<0 ){
isPlainText = db_get_boolean("timeline-plaintext",0);
}
db_bind_int(&q, ":x", rid);
if( db_step(&q)==SQLITE_ROW ){
blob_append(pOut, "\n", 1);
if( isPlainText ){
db_column_blob(&q, 0, pOut);
}else{
Blob x;
blob_init(&x,0,0);
db_column_blob(&q, 0, &x);
get_stext_by_mimetype(&x, "text/x-fossil-wiki", pOut);
blob_reset(&x);
}
}
db_reset(&q);
break;
}
case 't': { /* Tickets */
static Stmt q1;
static int iTitle = -1;
db_static_prepare(&q1, "SELECT * FROM ticket WHERE tkt_id=:rid");
db_bind_int(&q1, ":rid", rid);
if( db_step(&q1)==SQLITE_ROW ){
if( iTitle<0 ){
int n = db_column_count(&q1);
for(iTitle=0; iTitle<n; iTitle++){
if( fossil_stricmp(db_column_name(&q1,iTitle),"title")==0 ) break;
}
}
append_all_ticket_fields(pOut, &q1, iTitle);
}
db_reset(&q1);
if( db_table_exists("repository","ticketchng") ){
static Stmt q2;
db_static_prepare(&q2, "SELECT * FROM ticketchng WHERE tkt_id=:rid"
" ORDER BY tkt_mtime");
db_bind_int(&q2, ":rid", rid);
while( db_step(&q2)==SQLITE_ROW ){
append_all_ticket_fields(pOut, &q2, -1);
}
db_reset(&q2);
}
break;
}
}
}
/*
** This routine is a wrapper around search_stext().
**
** This routine looks up the search text, stores it in an internal
** buffer, and returns a pointer to the text. Subsequent requests
** for the same document return the same pointer. The returned pointer
** is valid until the next invocation of this routine. Call this routine
** with an eType of 0 to clear the cache.
*/
char *search_stext_cached(
char cType, /* Type of document */
int rid, /* BLOB.RID or TAG.TAGID value for document */
const char *zName, /* Auxiliary information */
int *pnTitle /* OUT: length of title in bytes excluding \n */
){
static struct {
Blob stext; /* Cached search text */
char cType; /* The type */
int rid; /* The RID */
int nTitle; /* Number of bytes in title */
} cache;
int i;
char *z;
if( cType!=cache.cType || rid!=cache.rid ){
if( cache.rid>0 ){
blob_reset(&cache.stext);
}else{
blob_init(&cache.stext,0,0);
}
cache.cType = cType;
cache.rid = rid;
if( cType==0 ) return 0;
search_stext(cType, rid, zName, &cache.stext);
z = blob_str(&cache.stext);
for(i=0; z[i] && z[i]!='\n'; i++){}
cache.nTitle = i;
}
if( pnTitle ) *pnTitle = cache.nTitle;
return blob_str(&cache.stext);
}
/*
** COMMAND: test-search-stext
**
** Usage: fossil test-search-stext TYPE ARG1 ARG2
*/
void test_search_stext(void){
Blob out;
db_find_and_open_repository(0,0);
if( g.argc!=5 ) usage("TYPE RID NAME");
search_stext(g.argv[2][0], atoi(g.argv[3]), g.argv[4], &out);
fossil_print("%s\n",blob_str(&out));
blob_reset(&out);
}
/*
** COMMAND: test-convert-stext
**
** Usage: fossil test-convert-stext FILE MIMETYPE
**
** Read the content of FILE and convert it to stext according to MIMETYPE.
** Send the result to standard output.
*/
void test_convert_stext(void){
Blob in, out;
db_find_and_open_repository(0,0);
if( g.argc!=4 ) usage("FILENAME MIMETYPE");
blob_read_from_file(&in, g.argv[2]);
blob_init(&out, 0, 0);
get_stext_by_mimetype(&in, g.argv[3], &out);
fossil_print("%s\n",blob_str(&out));
blob_reset(&in);
blob_reset(&out);
}
/* The schema for the full-text index
*/
static const char zFtsSchema[] =
@ -- One entry for each possible search result
@ CREATE TABLE IF NOT EXISTS "%w".ftsdocs(
@ rowid INTEGER PRIMARY KEY, -- Maps to the ftsidx.docid
@ type CHAR(1), -- Type of document
@ rid INTEGER, -- BLOB.RID or TAG.TAGID for the document
@ name TEXT, -- Additional document description
@ idxed BOOLEAN, -- True if currently in the index
@ label TEXT, -- Label to print on search results
@ url TEXT, -- URL to access this document
@ mtime DATE, -- Date when document created
@ bx TEXT, -- Temporary "body" content cache
@ UNIQUE(type,rid)
@ );
@ CREATE INDEX "%w".ftsdocIdxed ON ftsdocs(type,rid,name) WHERE idxed==0;
@ CREATE INDEX "%w".ftsdocName ON ftsdocs(name) WHERE type='w';
@ CREATE VIEW IF NOT EXISTS "%w".ftscontent AS
@ SELECT rowid, type, rid, name, idxed, label, url, mtime,
@ title(type,rid,name) AS 'title', body(type,rid,name) AS 'body'
@ FROM ftsdocs;
@ CREATE VIRTUAL TABLE IF NOT EXISTS "%w".ftsidx
@ USING fts4(content="ftscontent", title, body%s);
;
static const char zFtsDrop[] =
@ DROP TABLE IF EXISTS "%w".ftsidx;
@ DROP VIEW IF EXISTS "%w".ftscontent;
@ DROP TABLE IF EXISTS "%w".ftsdocs;
;
/*
** Create or drop the tables associated with a full-text index.
*/
static int searchIdxExists = -1;
void search_create_index(void){
const char *zDb = db_name("repository");
int useStemmer = db_get_boolean("search-stemmer",0);
const char *zExtra = useStemmer ? ",tokenize=porter" : "";
search_sql_setup(g.db);
db_multi_exec(zFtsSchema/*works-like:"%w%w%w%w%w%s"*/,
zDb, zDb, zDb, zDb, zDb, zExtra/*safe-for-%s*/);
searchIdxExists = 1;
}
void search_drop_index(void){
const char *zDb = db_name("repository");
db_multi_exec(zFtsDrop/*works-like:"%w%w%w"*/, zDb, zDb, zDb);
searchIdxExists = 0;
}
/*
** Return true if the full-text search index exists
*/
int search_index_exists(void){
if( searchIdxExists<0 ){
searchIdxExists = db_table_exists("repository","ftsdocs");
}
return searchIdxExists;
}
/*
** Fill the FTSDOCS table with unindexed entries for everything
** in the repository. This uses INSERT OR IGNORE so entries already
** in FTSDOCS are unchanged.
*/
void search_fill_index(void){
if( !search_index_exists() ) return;
search_sql_setup(g.db);
db_multi_exec(
"INSERT OR IGNORE INTO ftsdocs(type,rid,idxed)"
" SELECT 'c', objid, 0 FROM event WHERE type='ci';"
);
db_multi_exec(
"WITH latest_wiki(rid,name,mtime) AS ("
" SELECT tagxref.rid, substr(tag.tagname,6), max(tagxref.mtime)"
" FROM tag, tagxref"
" WHERE tag.tagname GLOB 'wiki-*'"
" AND tagxref.tagid=tag.tagid"
" AND tagxref.value>0"
" GROUP BY 2"
") INSERT OR IGNORE INTO ftsdocs(type,rid,name,idxed)"
" SELECT 'w', rid, name, 0 FROM latest_wiki;"
);
db_multi_exec(
"INSERT OR IGNORE INTO ftsdocs(type,rid,idxed)"
" SELECT 't', tkt_id, 0 FROM ticket;"
);
}
/*
** The document described by cType,rid,zName is about to be added or
** updated. If the document has already been indexed, then unindex it
** now while we still have access to the old content. Add the document
** to the queue of documents that need to be indexed or reindexed.
*/
void search_doc_touch(char cType, int rid, const char *zName){
if( search_index_exists() ){
char zType[2];
zType[0] = cType;
zType[1] = 0;
search_sql_setup(g.db);
db_multi_exec(
"DELETE FROM ftsidx WHERE docid IN"
" (SELECT rowid FROM ftsdocs WHERE type=%Q AND rid=%d AND idxed)",
zType, rid
);
db_multi_exec(
"REPLACE INTO ftsdocs(type,rid,name,idxed)"
" VALUES(%Q,%d,%Q,0)",
zType, rid, zName
);
if( cType=='w' ){
db_multi_exec(
"DELETE FROM ftsidx WHERE docid IN"
" (SELECT rowid FROM ftsdocs WHERE type='w' AND name=%Q AND idxed)",
zName
);
db_multi_exec(
"DELETE FROM ftsdocs WHERE type='w' AND name=%Q AND rid!=%d",
zName, rid
);
}
}
}
/*
** If the doc-glob and doc-br settings are valid for document search
** and if the latest check-in on doc-br is in the unindexed set of
** check-ins, then update all 'd' entries in FTSDOCS that have
** changed.
*/
static void search_update_doc_index(void){
const char *zDocBr = db_get("doc-branch","trunk");
int ckid = zDocBr ? symbolic_name_to_rid(zDocBr,"ci") : 0;
double rTime;
char *zBrUuid;
if( ckid==0 ) return;
if( !db_exists("SELECT 1 FROM ftsdocs WHERE type='c' AND rid=%d"
" AND NOT idxed", ckid) ) return;
/* If we get this far, it means that changes to 'd' entries are
** required. */
rTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", ckid);
zBrUuid = db_text("","SELECT substr(uuid,1,20) FROM blob WHERE rid=%d",ckid);
db_multi_exec(
"CREATE TEMP TABLE current_docs(rid INTEGER PRIMARY KEY, name);"
"CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;"
"INSERT OR IGNORE INTO current_docs(rid, name)"
" SELECT blob.rid, foci.filename FROM foci, blob"
" WHERE foci.checkinID=%d AND blob.uuid=foci.uuid"
" AND %z",
ckid, glob_expr("foci.filename", db_get("doc-glob",""))
);
db_multi_exec(
"DELETE FROM ftsidx WHERE docid IN"
" (SELECT rowid FROM ftsdocs WHERE type='d'"
" AND rid NOT IN (SELECT rid FROM current_docs))"
);
db_multi_exec(
"DELETE FROM ftsdocs WHERE type='d'"
" AND rid NOT IN (SELECT rid FROM current_docs)"
);
db_multi_exec(
"INSERT OR IGNORE INTO ftsdocs(type,rid,name,idxed,label,bx,url,mtime)"
" SELECT 'd', rid, name, 0,"
" title('d',rid,name),"
" body('d',rid,name),"
" printf('/doc/%q/%%s',urlencode(name)),"
" %.17g"
" FROM current_docs",
zBrUuid, rTime
);
db_multi_exec(
"INSERT INTO ftsidx(docid,title,body)"
" SELECT rowid, label, bx FROM ftsdocs WHERE type='d' AND NOT idxed"
);
db_multi_exec(
"UPDATE ftsdocs SET"
" idxed=1,"
" bx=NULL,"
" label='Document: '||label"
" WHERE type='d' AND NOT idxed"
);
}
/*
** Deal with all of the unindexed 'c' terms in FTSDOCS
*/
static void search_update_checkin_index(void){
db_multi_exec(
"INSERT INTO ftsidx(docid,title,body)"
" SELECT rowid, '', body('c',rid,NULL) FROM ftsdocs"
" WHERE type='c' AND NOT idxed;"
);
db_multi_exec(
"REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
" SELECT ftsdocs.rowid, 1, 'c', ftsdocs.rid, NULL,"
" printf('Check-in [%%.16s] on %%s',blob.uuid,datetime(event.mtime)),"
" printf('/timeline?y=ci&c=%%.20s',blob.uuid),"
" event.mtime"
" FROM ftsdocs, event, blob"
" WHERE ftsdocs.type='c' AND NOT ftsdocs.idxed"
" AND event.objid=ftsdocs.rid"
" AND blob.rid=ftsdocs.rid"
);
}
/*
** Deal with all of the unindexed 't' terms in FTSDOCS
*/
static void search_update_ticket_index(void){
db_multi_exec(
"INSERT INTO ftsidx(docid,title,body)"
" SELECT rowid, title('t',rid,NULL), body('t',rid,NULL) FROM ftsdocs"
" WHERE type='t' AND NOT idxed;"
);
if( db_changes()==0 ) return;
db_multi_exec(
"REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
" SELECT ftsdocs.rowid, 1, 't', ftsdocs.rid, NULL,"
" printf('Ticket: %%s (%%s)',title('t',tkt_id,null),"
" datetime(tkt_mtime)),"
" printf('/tktview/%%.20s',tkt_uuid),"
" tkt_mtime"
" FROM ftsdocs, ticket"
" WHERE ftsdocs.type='t' AND NOT ftsdocs.idxed"
" AND ticket.tkt_id=ftsdocs.rid"
);
}
/*
** Deal with all of the unindexed 'w' terms in FTSDOCS
*/
static void search_update_wiki_index(void){
db_multi_exec(
"INSERT INTO ftsidx(docid,title,body)"
" SELECT rowid, title('w',rid,NULL),body('w',rid,NULL) FROM ftsdocs"
" WHERE type='w' AND NOT idxed;"
);
if( db_changes()==0 ) return;
db_multi_exec(
"REPLACE INTO ftsdocs(rowid,idxed,type,rid,name,label,url,mtime)"
" SELECT ftsdocs.rowid, 1, 'w', ftsdocs.rid, ftsdocs.name,"
" 'Wiki: '||ftsdocs.name,"
" '/wiki?name='||urlencode(ftsdocs.name),"
" tagxref.mtime"
" FROM ftsdocs, tagxref"
" WHERE ftsdocs.type='w' AND NOT ftsdocs.idxed"
" AND tagxref.rid=ftsdocs.rid"
);
}
/*
** Deal with all of the unindexed entries in the FTSDOCS table - that
** is to say, all the entries with FTSDOCS.IDXED=0. Add them to the
** index.
*/
void search_update_index(unsigned int srchFlags){
if( !search_index_exists() ) return;
if( !db_exists("SELECT 1 FROM ftsdocs WHERE NOT idxed") ) return;
search_sql_setup(g.db);
if( srchFlags & (SRCH_CKIN|SRCH_DOC) ){
search_update_doc_index();
search_update_checkin_index();
}
if( srchFlags & SRCH_TKT ){
search_update_ticket_index();
}
if( srchFlags & SRCH_WIKI ){
search_update_wiki_index();
}
}
/*
** Construct, prepopulate, and then update the full-text index.
*/
void search_rebuild_index(void){
fossil_print("rebuilding the search index...");
fflush(stdout);
search_create_index();
search_fill_index();
search_update_index(search_restrict(SRCH_ALL));
fossil_print(" done\n");
}
/*
** COMMAND: fts-config*
**
** Usage: fossil fts-config ?SUBCOMMAND? ?ARGUMENT?
**
** The "fossil fts-config" command configures the full-text search capabilities
** of the repository. Subcommands:
**
** reindex Rebuild the search index. This is a no-op if
** index search is disabled
**
** index (on|off) Turn the search index on or off
**
** enable cdtw Enable various kinds of search. c=Check-ins,
** d=Documents, t=Tickets, w=Wiki.
**
** disable cdtw Disable versious kinds of search
**
** stemmer (on|off) Turn the Porter stemmer on or off for indexed
** search. (Unindexed search is never stemmed.)
**
** The current search settings are displayed after any changes are applied.
** Run this command with no arguments to simply see the settings.
*/
void test_fts_cmd(void){
static const struct { int iCmd; const char *z; } aCmd[] = {
{ 1, "reindex" },
{ 2, "index" },
{ 3, "disable" },
{ 4, "enable" },
{ 5, "stemmer" },
};
static const struct { char *zSetting; char *zName; char *zSw; } aSetng[] = {
{ "search-ckin", "check-in search:", "c" },
{ "search-doc", "document search:", "d" },
{ "search-tkt", "ticket search:", "t" },
{ "search-wiki", "wiki search:", "w" },
};
char *zSubCmd = 0;
int i, j, n;
int iCmd = 0;
int iAction = 0;
db_find_and_open_repository(0, 0);
if( g.argc>2 ){
zSubCmd = g.argv[2];
n = (int)strlen(zSubCmd);
for(i=0; i<ArraySize(aCmd); i++){
if( fossil_strncmp(aCmd[i].z, zSubCmd, n)==0 ) break;
}
if( i>=ArraySize(aCmd) ){
Blob all;
blob_init(&all,0,0);
for(i=0; i<ArraySize(aCmd); i++) blob_appendf(&all, " %s", aCmd[i].z);
fossil_fatal("unknown \"%s\" - should be on of:%s",
zSubCmd, blob_str(&all));
return;
}
iCmd = aCmd[i].iCmd;
}
if( iCmd==1 ){
if( search_index_exists() ) iAction = 2;
}
if( iCmd==2 ){
if( g.argc<3 ) usage("index (on|off)");
iAction = 1 + is_truth(g.argv[3]);
}
db_begin_transaction();
/* Adjust search settings */
if( iCmd==3 || iCmd==4 ){
const char *zCtrl;
if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
zCtrl = g.argv[3];
for(j=0; j<ArraySize(aSetng); j++){
if( strchr(zCtrl, aSetng[j].zSw[0])!=0 ){
db_set_int(aSetng[j].zSetting, iCmd-3, 0);
}
}
}
if( iCmd==5 ){
if( g.argc<4 ) usage("porter ON/OFF");
db_set_int("search-stemmer", is_truth(g.argv[3]), 0);
}
/* destroy or rebuild the index, if requested */
if( iAction>=1 ){
search_drop_index();
}
if( iAction>=2 ){
search_rebuild_index();
}
/* Always show the status before ending */
for(i=0; i<ArraySize(aSetng); i++){
fossil_print("%-16s %s\n", aSetng[i].zName,
db_get_boolean(aSetng[i].zSetting,0) ? "on" : "off");
}
fossil_print("%-16s %s\n", "Porter stemmer:",
db_get_boolean("search-stemmer",0) ? "on" : "off");
if( search_index_exists() ){
fossil_print("%-16s enabled\n", "full-text index:");
fossil_print("%-16s %d\n", "documents:",
db_int(0, "SELECT count(*) FROM ftsdocs"));
}else{
fossil_print("%-16s disabled\n", "full-text index:");
}
db_end_transaction(0);
}
|
Changes to src/setup.c.
| ︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
if( zLink && zLink[0] ){
@ <a href="%s(zLink)">%h(zTitle)</a>
}else{
@ %h(zTitle)
}
@ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
}
/*
** WEBPAGE: /setup
*/
void setup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| > > | > > > > > > > > > > > > > > | > > | 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 |
if( zLink && zLink[0] ){
@ <a href="%s(zLink)">%h(zTitle)</a>
}else{
@ %h(zTitle)
}
@ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
}
/*
** WEBPAGE: /setup
*/
void setup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
}
style_header("Server Administration");
/* Make sure the header contains <base href="...">. Issue a warning
** if it does not. */
if( !cgi_header_contains("<base href=") ){
@ <p class="generalError"><b>Configuration Error:</b> Please add
@ <tt><base href="$secureurl/$current_page"></tt> after
@ <tt><head></tt> in the <a href="setup_header">HTML header</a>!</p>
}
#if !defined(_WIN32)
/* Check for /dev/null and /dev/urandom. We want both devices to be present,
** but they are sometimes omitted (by mistake) from chroot jails. */
if( access("/dev/null", R_OK|W_OK) ){
@ <p class="generalError">WARNING: Device "/dev/null" is not available
@ for reading and writing.</p>
}
if( access("/dev/urandom", R_OK) ){
@ <p class="generalError">WARNING: Device "/dev/urandom" is not available
@ for reading. This means that the pseudo-random number generator used
@ by SQLite will be poorly seeded.</p>
}
#endif
@ <table border="0" cellspacing="3">
setup_menu_entry("Users", "setup_ulist",
"Grant privileges to individual users.");
setup_menu_entry("Access", "setup_access",
"Control access settings.");
setup_menu_entry("Configuration", "setup_config",
"Configure the WWW components of the repository");
setup_menu_entry("Settings", "setup_settings",
"Web interface to the \"fossil settings\" command");
setup_menu_entry("Timeline", "setup_timeline",
"Timeline display preferences");
setup_menu_entry("Login-Group", "setup_login_group",
"Manage single sign-on between this repository and others"
" on the same server");
setup_menu_entry("Tickets", "tktsetup",
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("Search","srchsetup",
"Configure the built-in search engine");
setup_menu_entry("Transfers", "xfersetup",
"Configure the transfer system for this repository");
setup_menu_entry("Skins", "setup_skin",
"Select from a menu of prepackaged \"skins\" for the web interface");
setup_menu_entry("CSS", "setup_editcss",
"Edit the Cascading Style Sheet used by all pages of this repository");
setup_menu_entry("Header", "setup_header",
|
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
*/
void setup_ulist(void){
Stmt s;
int prevLevel = 0;
login_check_credentials();
if( !g.perm.Admin ){
| | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
*/
void setup_ulist(void){
Stmt s;
int prevLevel = 0;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_submenu_element("Add", "Add User", "setup_uedit");
style_header("User List");
@ <table class="usetupLayoutTable">
@ <tr><td class="usetupColumnLayout">
|
| ︙ | ︙ | |||
316 317 318 319 320 321 322 | char *inherit[128]; int a[128]; const char *oa[128]; /* Must have ADMIN privileges to access this page */ login_check_credentials(); | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
char *inherit[128];
int a[128];
const char *oa[128];
/* Must have ADMIN privileges to access this page
*/
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
/* Check to see if an ADMIN user is trying to edit a SETUP account.
** Don't allow that.
*/
zId = PD("id", "0");
uid = atoi(zId);
if( zId && !g.perm.Setup && uid>0 ){
|
| ︙ | ︙ | |||
811 812 813 814 815 816 817 | @ <h2>Special Logins</h2> @ @ <ul> @ <li><p> @ No login is required for user <span class="usertype">nobody</span>. The @ capabilities of the <span class="usertype">nobody</span> user are @ inherited by all users, regardless of whether or not they are logged in. | | < < < < | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | @ <h2>Special Logins</h2> @ @ <ul> @ <li><p> @ No login is required for user <span class="usertype">nobody</span>. The @ capabilities of the <span class="usertype">nobody</span> user are @ inherited by all users, regardless of whether or not they are logged in. @ To disable universal access to the repository, make sure that the @ <span class="usertype">nobody</span> user has no capabilities @ enabled. The password for <span class="usertype">nobody</span> is ignored. @ </p></li> @ @ <li><p> @ Login is required for user <span class="usertype">anonymous</span> but the @ password is displayed on the login screen beside the password entry box @ so anybody who can read should be able to login as anonymous. @ On the other hand, spiders and web-crawlers will typically not |
| ︙ | ︙ | |||
982 983 984 985 986 987 988 |
/*
** WEBPAGE: setup_access
*/
void setup_access(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | | | | | | | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
/*
** WEBPAGE: setup_access
*/
void setup_access(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Access Control Settings");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_access" method="post"><div>
login_insert_csrf_secret();
@ <hr />
onoff_attribute("Redirect to HTTPS on the Login page",
"redirect-to-https", "redirhttps", 0, 0);
@ <p>When selected, force the use of HTTPS for the Login page.
@ <p>Details: When enabled, this option causes the $secureurl TH1
@ variable is set to an "https:" variant of $baseurl. Otherwise,
@ $secureurl is just an alias for $baseurl. Also when enabled, the
@ Login page redirects to https if accessed via http.
@ <hr />
onoff_attribute("Require password for local access",
"localauth", "localauth", 0, 0);
@ <p>When enabled, the password sign-in is always required for
@ web access. When disabled, unrestricted web access from 127.0.0.1
@ is allowed for the <a href="%R/help/ui">fossil ui</a> command or
@ from the <a href="%R/help/server">fossil server</a>,
@ <a href="%R/help/http">fossil http</a> commands when the
@ "--localauth" command line options is used, or from the
@ <a href="%R/help/cgi">fossil cgi</a> if a line containing
@ the word "localauth" appears in the CGI script.
@
@ <p>A password is always required if any one or more
@ of the following are true:
@ <ol>
@ <li> This button is checked
@ <li> The inbound TCP/IP connection is not from 127.0.0.1
@ <li> The server is started using either of the
@ <a href="%R/help/server">fossil server</a> or
@ <a href="%R/help/server">fossil http</a> commands
@ without the "--localauth" option.
@ <li> The server is started from CGI without the "localauth" keyword
@ in the CGI script.
@ </ol>
@
@ <hr />
onoff_attribute("Enable /test_env",
|
| ︙ | ︙ | |||
1187 1188 1189 1190 1191 1192 1193 |
const char *zRepo = PD("repo", "");
const char *zLogin = PD("login", "");
const char *zPw = PD("pw", "");
const char *zNewName = PD("newname", "New Login Group");
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
const char *zRepo = PD("repo", "");
const char *zLogin = PD("login", "");
const char *zPw = PD("pw", "");
const char *zNewName = PD("newname", "New Login Group");
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
file_canonical_name(g.zRepositoryName, &fullName, 0);
zSelfRepo = fossil_strdup(blob_str(&fullName));
blob_reset(&fullName);
if( P("join")!=0 ){
login_group_join(zRepo, zLogin, zPw, zNewName, &zErrMsg);
}else if( P("leave") ){
|
| ︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
@ </table>
@
@ <p><form action="%s(g.zTop)/setup_login_group" method="post"><div>
login_insert_csrf_secret();
@ To leave this login group press
@ <input type="submit" value="Leave Login Group" name="leave">
@ </form></p>
}
style_footer();
}
/*
** WEBPAGE: setup_timeline
*/
void setup_timeline(void){
double tmDiff;
char zTmDiff[20];
static const char *const azTimeFormats[] = {
"0", "HH:MM",
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
login_check_credentials();
if( !g.perm.Setup ){
| > > > > > > > > > > > > > > > > > | > | 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 |
@ </table>
@
@ <p><form action="%s(g.zTop)/setup_login_group" method="post"><div>
login_insert_csrf_secret();
@ To leave this login group press
@ <input type="submit" value="Leave Login Group" name="leave">
@ </form></p>
@ <hr><h2>Implementation Details</h2>
@ <p>The following are fields from the CONFIG table related to login-groups,
@ provided here for instructional and debugging purposes:</p>
@ <table border='1' id='configTab'>
@ <thead><tr><th>Config.Name<th>Config.Value<th>Config.mtime</tr></thead><tbody>
db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config"
" WHERE name GLOB 'peer-*'"
" OR name GLOB 'project-*'"
" ORDER BY name");
while( db_step(&q)==SQLITE_ROW ){
@ <tr><td>%h(db_column_text(&q,0))</td>
@ <td>%h(db_column_text(&q,1))</td>
@ <td>%h(db_column_text(&q,2))</td></tr>
}
db_finalize(&q);
@ </tbody></table>
output_table_sorting_javascript("configTab","ttt",1);
}
style_footer();
}
/*
** WEBPAGE: setup_timeline
*/
void setup_timeline(void){
double tmDiff;
char zTmDiff[20];
static const char *const azTimeFormats[] = {
"0", "HH:MM",
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Timeline Display Preferences");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
login_insert_csrf_secret();
|
| ︙ | ︙ | |||
1356 1357 1358 1359 1360 1361 1362 |
style_footer();
}
/*
** WEBPAGE: setup_settings
*/
void setup_settings(void){
| | | > | | | | | | | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 |
style_footer();
}
/*
** WEBPAGE: setup_settings
*/
void setup_settings(void){
Setting const *pSet;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
(void) aCmdHelp; /* NOTE: Silence compiler warning. */
style_header("Settings");
if(!g.repositoryOpen){
/* Provide read-only access to versioned settings,
but only if no repo file was explicitly provided. */
db_open_local(0);
}
db_begin_transaction();
@ <p>This page provides a simple interface to the "fossil setting" command.
@ See the "fossil help setting" output below for further information on
@ the meaning of each setting.</p><hr />
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
@ <table border="0"><tr><td valign="top">
login_insert_csrf_secret();
for(pSet=aSetting; pSet->name!=0; pSet++){
if( pSet->width==0 ){
int hasVersionableValue = pSet->versionable &&
(db_get_versioned(pSet->name, NULL)!=0);
onoff_attribute(pSet->name, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
is_truth(pSet->def), hasVersionableValue);
if( pSet->versionable ){
@ (v)<br />
} else {
@ <br />
}
}
}
@ <br /><input type="submit" name="submit" value="Apply Changes" />
@ </td><td style="width:50px;"></td><td valign="top">
for(pSet=aSetting; pSet->name!=0; pSet++){
if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
(char*)pSet->def, 0);
@ <br />
}
}
for(pSet=aSetting; pSet->name!=0; pSet++){
if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
@<b>%s(pSet->name)</b><br />
textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
(char*)pSet->def, 0);
@ <br />
}
}
@ </td><td style="width:50px;"></td><td valign="top">
for(pSet=aSetting; pSet->name!=0; pSet++){
if( pSet->width!=0 && pSet->versionable ){
int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
@<b>%s(pSet->name)</b> (v)<br />
textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
(char*)pSet->def, hasVersionableValue);
@<br />
}
}
|
| ︙ | ︙ | |||
1440 1441 1442 1443 1444 1445 1446 |
/*
** WEBPAGE: setup_config
*/
void setup_config(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 |
/*
** WEBPAGE: setup_config
*/
void setup_config(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("WWW Configuration");
db_begin_transaction();
@ <form action="%s(g.zTop)/setup_config" method="post"><div>
login_insert_csrf_secret();
@ <hr />
|
| ︙ | ︙ | |||
1518 1519 1520 1521 1522 1523 1524 |
/*
** WEBPAGE: setup_editcss
*/
void setup_editcss(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | | > | > | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 |
/*
** WEBPAGE: setup_editcss
*/
void setup_editcss(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='css'");
cgi_replace_parameter("css", builtin_text("skins/default/css.txt"));
db_end_transaction(0);
cgi_redirect("setup_editcss");
}
if( P("submit")!=0 ){
textarea_attribute(0, 0, 0, "css", "css",
builtin_text("skins/default/css.txt"), 0);
db_end_transaction(0);
cgi_redirect("setup_editcss");
}
style_header("Edit CSS");
@ <form action="%s(g.zTop)/setup_editcss" method="post"><div>
login_insert_csrf_secret();
@ Edit the CSS below:<br />
textarea_attribute("", 35, 80, "css", "css",
builtin_text("skins/default/css.txt"), 0);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes" />
@ <input type="submit" name="clear" value="Revert To Default" />
@ </div></form>
@ <p><span class="note">Note:</span> Press your browser Reload button after
@ modifying the CSS in order to pull in the modified CSS file.</p>
@ <hr />
|
| ︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 |
/*
** WEBPAGE: setup_header
*/
void setup_header(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | | > | > | 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 |
/*
** WEBPAGE: setup_header
*/
void setup_header(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='header'");
cgi_replace_parameter("header", builtin_text("skins/default/header.txt"));
}else if( P("submit")!=0 ){
textarea_attribute(0, 0, 0, "header", "header",
builtin_text("skins/default/header.txt"), 0);
}else if( P("fixbase")!=0 ){
const char *z = db_get("header",
(char*)builtin_text("skins/default/header.txt"));
char *zHead = strstr(z, "<head>");
if( strstr(z, "<base href=")==0 && zHead!=0 ){
char *zNew;
char *zTail = &zHead[6];
while( fossil_isspace(zTail[0]) ) zTail++;
zNew = mprintf("%.*s\n<base href=\"$secureurl/$current_page\" />\n%s",
zHead+6-z, z, zTail);
|
| ︙ | ︙ | |||
1596 1597 1598 1599 1600 1601 1602 |
@ <p class="generalError">Please add
@ <tt><base href="$secureurl/$current_page"></tt> after
@ <tt><head></tt> in the header!
@ <input type="submit" name="fixbase" value="Add <base> Now"></p>
}
login_insert_csrf_secret();
| | | > | | > | | | > | | > | | | 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 |
@ <p class="generalError">Please add
@ <tt><base href="$secureurl/$current_page"></tt> after
@ <tt><head></tt> in the header!
@ <input type="submit" name="fixbase" value="Add <base> Now"></p>
}
login_insert_csrf_secret();
@ <p>Edit HTML text with embedded TH1 (a Tcl dialect) that will be used to
@ generate the beginning of every page through start of the main
@ menu.</p>
textarea_attribute("", 35, 80, "header", "header",
builtin_text("skins/default/header.txt"), 0);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes" />
@ <input type="submit" name="clear" value="Revert To Default" />
@ </div></form>
@ <hr />
@ The default header is shown below for reference. Other examples
@ of headers can be seen on the <a href="setup_skin">skins page</a>.
@ See also the <a href="setup_editcss">CSS</a> and
@ <a href="setup_footer">footer</a> editing screens.
@ <blockquote><pre>
@ %h(builtin_text("skins/default/header.txt"))
@ </pre></blockquote>
style_footer();
db_end_transaction(0);
}
/*
** WEBPAGE: setup_footer
*/
void setup_footer(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='footer'");
cgi_replace_parameter("footer", builtin_text("skins/default/footer.txt"));
}
style_header("Edit Page Footer");
@ <form action="%s(g.zTop)/setup_footer" method="post"><div>
login_insert_csrf_secret();
@ <p>Edit HTML text with embedded TH1 (a Tcl dialect) that will be used to
@ generate the end of every page.</p>
textarea_attribute("", 20, 80, "footer", "footer",
builtin_text("skins/default/footer.txt"), 0);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes" />
@ <input type="submit" name="clear" value="Revert To Default" />
@ </div></form>
@ <hr />
@ The default footer is shown below for reference. Other examples
@ of footers can be seen on the <a href="setup_skin">skins page</a>.
@ See also the <a href="setup_editcss">CSS</a> and
@ <a href="setup_header">header</a> editing screens.
@ <blockquote><pre>
@ %h(builtin_text("skins/default/footer.txt"))
@ </pre></blockquote>
style_footer();
db_end_transaction(0);
}
/*
** WEBPAGE: setup_modreq
*/
void setup_modreq(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Moderator For Wiki And Tickets");
db_begin_transaction();
@ <form action="%R/setup_modreq" method="post"><div>
login_insert_csrf_secret();
@ <hr />
onoff_attribute("Moderate ticket changes",
"modreq-tkt", "modreq-tkt", 0, 0);
@ <p>When enabled, any change to tickets is subject to the approval
@ by a ticket moderator - a user with the "q" or Mod-Tkt privilege.
@ Ticket changes enter the system and are shown locally, but are not
@ synced until they are approved. The moderator has the option to
@ delete the change rather than approve it. Ticket changes made by
@ a user who has the Mod-Tkt privilege are never subject to
@ moderation.
@
@ <hr />
onoff_attribute("Moderate wiki changes",
"modreq-wiki", "modreq-wiki", 0, 0);
@ <p>When enabled, any change to wiki is subject to the approval
@ by a wiki moderator - a user with the "l" or Mod-Wiki privilege.
@ Wiki changes enter the system and are shown locally, but are not
@ synced until they are approved. The moderator has the option to
@ delete the change rather than approve it. Wiki changes made by
@ a user who has the Mod-Wiki privilege are never subject to
@ moderation.
@ </p>
|
| ︙ | ︙ | |||
1702 1703 1704 1705 1706 1707 1708 |
/*
** WEBPAGE: setup_adunit
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 |
/*
** WEBPAGE: setup_adunit
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name GLOB 'adunit*'");
cgi_replace_parameter("adunit","");
}
style_header("Edit Ad Unit");
@ <form action="%s(g.zTop)/setup_adunit" method="post"><div>
login_insert_csrf_secret();
@ <b>Banner Ad-Unit:</b><br />
textarea_attribute("", 6, 80, "adunit", "adunit", "", 0);
@ <br />
@ <b>Right-Column Ad-Unit:</b><br />
textarea_attribute("", 6, 80, "adunit-right", "adright", "", 0);
@ <br />
onoff_attribute("Omit ads to administrator",
"adunit-omit-if-admin", "oia", 0, 0);
@ <br />
onoff_attribute("Omit ads to logged-in users",
"adunit-omit-if-user", "oiu", 0, 0);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes" />
@ <input type="submit" name="clear" value="Delete Ad-Unit" />
@ </div></form>
@ <hr />
@ <b>Ad-Unit Notes:</b><ul>
@ <li>Leave both Ad-Units blank to disable all advertising.
@ <li>The "Banner Ad-Unit" is used for wide pages.
@ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
@ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
@ <li>Suggested <a href="setup_editcss">CSS</a> changes:
@ <blockquote><pre>
@ div.adunit_banner {
@ margin: auto;
@ width: 100%;
@ }
@ div.adunit_right {
@ float: right;
@ }
@ div.adunit_right_container {
@ min-height: <i>height-of-right-column-ad-unit</i>;
@ }
@ </pre></blockquote>
@ <li>For a place-holder Ad-Unit for testing, Copy/Paste the following
@ with appropriate adjustments to "width:" and "height:".
@ <blockquote><pre>
@ <div style='
@ margin: 0 auto;
@ width: 600px;
@ height: 90px;
@ border: 1px solid #f11;
@ background-color: #fcc;
@ '>Demo Ad</div>
@ </pre></blockquote>
@ </li>
style_footer();
db_end_transaction(0);
}
/*
** WEBPAGE: setup_logo
*/
|
| ︙ | ︙ | |||
1750 1751 1752 1753 1754 1755 1756 |
zLogoMime = PD("logoim:mimetype","image/gif");
}
if( szBgImg>0 ){
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
zLogoMime = PD("logoim:mimetype","image/gif");
}
if( szBgImg>0 ){
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aLogoImg, szLogoImg);
db_prepare(&ins,
|
| ︙ | ︙ | |||
1889 1890 1891 1892 1893 1894 1895 |
** Run raw SQL commands against the database file using the web interface.
*/
void sql_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 |
** Run raw SQL commands against the database file using the web interface.
*/
void sql_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
style_header("Raw SQL Commands");
@ <p><b>Caution:</b> There are no restrictions on the SQL that can be
@ run by this page. You can do serious and irrepairable damage to the
@ repository. Proceed with extreme caution.</p>
@
|
| ︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 |
** may be run as well.
*/
void th1_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 |
** may be run as well.
*/
void th1_page(void){
const char *zQ = P("q");
int go = P("go")!=0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
style_header("Raw TH1 Commands");
@ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
@ run by this page. If Tcl integration was enabled at compile-time and
@ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
@
|
| ︙ | ︙ | |||
2070 2071 2072 2073 2074 2075 2076 |
Stmt stLog = empty_Stmt;
Blob qLog = empty_blob;
int limit;
int fLogEnabled;
int counter = 0;
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
| | > | 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 |
Stmt stLog = empty_Stmt;
Blob qLog = empty_blob;
int limit;
int fLogEnabled;
int counter = 0;
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Admin Log");
create_admin_log_table();
limit = atoi(PD("n","20"));
fLogEnabled = db_get_boolean("admin-log", 0);
@ <div>Admin logging is %s(fLogEnabled?"on":"off").</div>
|
| ︙ | ︙ | |||
2101 2102 2103 2104 2105 2106 2107 |
@ <thead>
@ <th>Time</th>
@ <th>User</th>
@ <th>Page</th>
@ <th width="60%%">Message</th>
@ </thead><tbody>
while( SQLITE_ROW == db_step(&stLog) ){
| | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 |
@ <thead>
@ <th>Time</th>
@ <th>User</th>
@ <th>Page</th>
@ <th width="60%%">Message</th>
@ </thead><tbody>
while( SQLITE_ROW == db_step(&stLog) ){
const char *zTime = db_column_text(&stLog, 0);
const char *zUser = db_column_text(&stLog, 1);
const char *zPage = db_column_text(&stLog, 2);
const char *zMessage = db_column_text(&stLog, 3);
@ <tr class="row%d(counter++%2)">
@ <td class="adminTime">%s(zTime)</td>
@ <td>%s(zUser)</td>
@ <td>%s(zPage)</td>
@ <td>%h(zMessage)</td>
@ </tr>
}
@ </tbody></table>
if(limit>0 && counter<limit){
@ <div>%d(counter) entries shown.</div>
}
style_footer();
}
/*
** WEBPAGE: srchsetup
**
** Configure the search engine.
*/
void page_srchsetup(){
login_check_credentials();
if( !g.perm.Setup && !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Search Configuration");
@ <form action="%s(g.zTop)/srchsetup" method="post"><div>
login_insert_csrf_secret();
@ <div style="text-align:center;font-weight:bold;">
@ Server-specific settings that affect the
@ <a href="%R/search">/search</a> webpage.
@ </div>
@ <hr />
textarea_attribute("Document Glob List", 3, 35, "doc-glob", "dg", "", 0);
@ <p>The "Document Glob List" is a comma- or newline-separated list
@ of GLOB expressions that identify all documents within the source
@ tree that are to be searched when "Document Search" is enabled.
@ Some examples:
@ <table border=0 cellpadding=2 align=center>
@ <tr><td>*.wiki,*.html,*.md,*.txt<td style="width: 4x;">
@ <td>Search all wiki, HTML, Markdown, and Text files</tr>
@ <tr><td>doc/*.md,*/README.txt,README.txt<td>
@ <td>Search all Markdown files in the doc/ subfolder and all README.txt
@ files.</tr>
@ <tr><td>*<td><td>Search all checked-in files</tr>
@ <tr><td><i>(blank)</i><td>
@ <td>Search nothing. (Disables document search).</tr>
@ </table>
@ <hr />
entry_attribute("Document Branch", 20, "doc-branch", "db", "trunk", 0);
@ <p>When searching documents, use the versions of the files found at the
@ type of the "Document Branch" branch. Recommended value: "trunk".
@ Document search is disabled if blank.
@ <hr/>
onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0);
@ <br>
onoff_attribute("Search Documents", "search-doc", "sd", 0, 0);
@ <br>
onoff_attribute("Search Tickets", "search-tkt", "st", 0, 0);
@ <br>
onoff_attribute("Search Wiki","search-wiki", "sw", 0, 0);
@ <hr/>
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr/>
if( P("fts0") ){
search_drop_index();
}else if( P("fts1") ){
search_drop_index();
search_create_index();
search_fill_index();
search_update_index(search_restrict(SRCH_ALL));
}
if( search_index_exists() ){
@ <p>Currently using an SQLite FTS4 search index. This makes search
@ run faster, especially on large repositories, but takes up space.</p>
onoff_attribute("Use Porter Stemmer","search-stemmer","ss",0,0);
@ <p><input type="submit" name="fts0" value="Delete The Full-Text Index">
@ <input type="submit" name="fts1" value="Rebuild The Full-Text Index">
}else{
@ <p>The SQLite FTS4 search index is disabled. All searching will be
@ a full-text scan. This usually works fine, but can be slow for
@ larger repositories.</p>
onoff_attribute("Use Porter Stemmer","search-stemmer","ss",0,0);
@ <p><input type="submit" name="fts1" value="Create A Full-Text Index">
}
@ </div></form>
style_footer();
}
|
Changes to src/sha1.c.
| ︙ | ︙ | |||
62 63 64 65 66 67 68 |
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
^block[(i+2)&15]^block[i&15],1))
/*
* (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
*
| | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
^block[(i+2)&15]^block[i&15],1))
/*
* (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
*
* Rl0() for little-endian and Rb0() for big-endian. Endianness is
* determined at run-time.
*/
#define Rl0(v,w,x,y,z,i) \
z+=((w&(x^y))^y)+blk0le(i)+0x5A827999+rol(v,5);w=ror(w,2);
#define Rb0(v,w,x,y,z,i) \
z+=((w&(x^y))^y)+blk0be(i)+0x5A827999+rol(v,5);w=ror(w,2);
#define R1(v,w,x,y,z,i) \
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
/*
** Convert a digest into base-16. digest should be declared as
** "unsigned char digest[20]" in the calling function. The SHA1
** digest is stored in the first 20 bytes. zBuf should
** be "char zBuf[41]".
*/
static void DigestToBase16(unsigned char *digest, char *zBuf){
| | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
/*
** Convert a digest into base-16. digest should be declared as
** "unsigned char digest[20]" in the calling function. The SHA1
** digest is stored in the first 20 bytes. zBuf should
** be "char zBuf[41]".
*/
static void DigestToBase16(unsigned char *digest, char *zBuf){
static const char zEncode[] = "0123456789abcdef";
int ix;
for(ix=0; ix<20; ix++){
*zBuf++ = zEncode[(*digest>>4)&0xf];
*zBuf++ = zEncode[*digest++ & 0xf];
}
*zBuf = '\0';
|
| ︙ | ︙ | |||
256 257 258 259 260 261 262 |
*/
void sha1sum_step_blob(Blob *p){
sha1sum_step_text(blob_buffer(p), blob_size(p));
}
/*
** Finish the incremental SHA1 checksum. Store the result in blob pOut
| | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
*/
void sha1sum_step_blob(Blob *p){
sha1sum_step_text(blob_buffer(p), blob_size(p));
}
/*
** Finish the incremental SHA1 checksum. Store the result in blob pOut
** if pOut!=0. Also return a pointer to the result.
**
** This resets the incremental checksum preparing for the next round
** of computation. The return pointer points to a static buffer that
** is overwritten by subsequent calls to this function.
*/
char *sha1sum_finish(Blob *pOut){
unsigned char zResult[20];
|
| ︙ | ︙ | |||
293 294 295 296 297 298 299 |
unsigned char zResult[20];
char zBuf[10240];
if( file_wd_islink(zFilename) ){
/* Instead of file content, return sha1 of link destination path */
Blob destinationPath;
int rc;
| | | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
unsigned char zResult[20];
char zBuf[10240];
if( file_wd_islink(zFilename) ){
/* Instead of file content, return sha1 of link destination path */
Blob destinationPath;
int rc;
blob_read_link(&destinationPath, zFilename);
rc = sha1sum_blob(&destinationPath, pCksum);
blob_reset(&destinationPath);
return rc;
}
in = fossil_fopen(zFilename,"rb");
|
| ︙ | ︙ | |||
361 362 363 364 365 366 367 |
SHA1Final(&ctx, zResult);
DigestToBase16(zResult, zDigest);
return mprintf("%s", zDigest);
}
/*
** Convert a cleartext password for a specific user into a SHA1 hash.
| | | | 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 |
SHA1Final(&ctx, zResult);
DigestToBase16(zResult, zDigest);
return mprintf("%s", zDigest);
}
/*
** Convert a cleartext password for a specific user into a SHA1 hash.
**
** The algorithm here is:
**
** SHA1( project-code + "/" + login + "/" + password )
**
** In words: The users login name and password are appended to the
** project ID code and the SHA1 hash of the result is computed.
**
** The result of this function is the shared secret used by a client
** to authenticate to a server for the sync protocol. It is also the
** value stored in the USER.PW field of the database. By mixing in the
** login name and the project id with the hash, different shared secrets
** are obtained even if two users select the same password, or if a
** single user selects the same password for multiple projects.
*/
char *sha1_shared_secret(
const char *zPw, /* The password to encrypt */
const char *zLogin, /* Username */
const char *zProjCode /* Project-code. Use built-in project code if NULL */
){
|
| ︙ | ︙ | |||
455 456 457 458 459 460 461 |
** Compute an SHA1 checksum of all files named on the command-line.
** If an file is named "-" then take its content from standard input.
*/
void sha1sum_test(void){
int i;
Blob in;
Blob cksum;
| | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
** Compute an SHA1 checksum of all files named on the command-line.
** If an file is named "-" then take its content from standard input.
*/
void sha1sum_test(void){
int i;
Blob in;
Blob cksum;
for(i=2; i<g.argc; i++){
blob_init(&cksum, "************** not found ***************", -1);
if( g.argv[i][0]=='-' && g.argv[i][1]==0 ){
blob_read_from_channel(&in, stdin, -1);
sha1sum_blob(&in, &cksum);
}else{
sha1sum_file(g.argv[i], &cksum);
}
fossil_print("%s %s\n", blob_str(&cksum), g.argv[i]);
blob_reset(&cksum);
}
}
|
Changes to src/shell.c.
| ︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
#endif
/* ctype macros that work with signed characters */
#define IsSpace(X) isspace((unsigned char)X)
#define IsDigit(X) isdigit((unsigned char)X)
#define ToLower(X) (char)tolower((unsigned char)X)
/* True if the timer is enabled */
static int enableTimer = 0;
/* Return the current wall-clock time */
static sqlite3_int64 timeOfDay(void){
static sqlite3_vfs *clockVfs = 0;
| > > > > > > > > > > > > > > > > > > > > | 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 |
#endif
/* ctype macros that work with signed characters */
#define IsSpace(X) isspace((unsigned char)X)
#define IsDigit(X) isdigit((unsigned char)X)
#define ToLower(X) (char)tolower((unsigned char)X)
/* On Windows, we normally run with output mode of TEXT so that \n characters
** are automatically translated into \r\n. However, this behavior needs
** to be disabled in some cases (ex: when generating CSV output and when
** rendering quoted strings that contain \n characters). The following
** routines take care of that.
*/
#if defined(_WIN32) || defined(WIN32)
static void setBinaryMode(FILE *out){
fflush(out);
_setmode(_fileno(out), _O_BINARY);
}
static void setTextMode(FILE *out){
fflush(out);
_setmode(_fileno(out), _O_TEXT);
}
#else
# define setBinaryMode(X)
# define setTextMode(X)
#endif
/* True if the timer is enabled */
static int enableTimer = 0;
/* Return the current wall-clock time */
static sqlite3_int64 timeOfDay(void){
static sqlite3_vfs *clockVfs = 0;
|
| ︙ | ︙ | |||
580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
/*
** Output the given string as a quoted string using SQL quoting conventions.
*/
static void output_quoted_string(FILE *out, const char *z){
int i;
int nSingle = 0;
for(i=0; z[i]; i++){
if( z[i]=='\'' ) nSingle++;
}
if( nSingle==0 ){
fprintf(out,"'%s'",z);
}else{
fprintf(out,"'");
| > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
/*
** Output the given string as a quoted string using SQL quoting conventions.
*/
static void output_quoted_string(FILE *out, const char *z){
int i;
int nSingle = 0;
setBinaryMode(out);
for(i=0; z[i]; i++){
if( z[i]=='\'' ) nSingle++;
}
if( nSingle==0 ){
fprintf(out,"'%s'",z);
}else{
fprintf(out,"'");
|
| ︙ | ︙ | |||
602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
}else{
fprintf(out,"%s",z);
break;
}
}
fprintf(out,"'");
}
}
/*
** Output the given string as a quoted according to C or TCL quoting rules.
*/
static void output_c_string(FILE *out, const char *z){
unsigned int c;
| > | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
}else{
fprintf(out,"%s",z);
break;
}
}
fprintf(out,"'");
}
setTextMode(out);
}
/*
** Output the given string as a quoted according to C or TCL quoting rules.
*/
static void output_c_string(FILE *out, const char *z){
unsigned int c;
|
| ︙ | ︙ | |||
904 905 906 907 908 909 910 |
output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
}
fprintf(p->out, "%s", p->rowSeparator);
break;
}
case MODE_Csv: {
| < | < < < | < < | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
}
fprintf(p->out, "%s", p->rowSeparator);
break;
}
case MODE_Csv: {
setBinaryMode(p->out);
if( p->cnt++==0 && p->showHeader ){
for(i=0; i<nArg; i++){
output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
}
fprintf(p->out, "%s", p->rowSeparator);
}
if( nArg>0 ){
for(i=0; i<nArg; i++){
output_csv(p, azArg[i], i<nArg-1);
}
fprintf(p->out, "%s", p->rowSeparator);
}
setTextMode(p->out);
break;
}
case MODE_Insert: {
p->cnt++;
if( azArg==0 ) break;
fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
for(i=0; i<nArg; i++){
|
| ︙ | ︙ | |||
1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | ** Text of a help message */ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail on|off Stop after hitting an error. Default OFF\n" ".clone NEWDB Clone data into NEWDB from the existing database\n" ".databases List names and files of attached databases\n" ".dump ?TABLE? ... Dump the database in an SQL text format\n" " If TABLE specified, only dump tables matching\n" " LIKE pattern TABLE.\n" ".echo on|off Turn command echo on or off\n" ".eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN\n" ".exit Exit this program\n" ".explain ?on|off? Turn output mode suitable for EXPLAIN on or off.\n" " With no args, it turns EXPLAIN on.\n" ".fullschema Show schema and the content of sqlite_stat tables\n" ".headers on|off Turn display of headers on or off\n" ".help Show this message\n" ".import FILE TABLE Import data from FILE into TABLE\n" | > | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 | ** Text of a help message */ static char zHelp[] = ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" ".bail on|off Stop after hitting an error. Default OFF\n" ".clone NEWDB Clone data into NEWDB from the existing database\n" ".databases List names and files of attached databases\n" ".dbinfo ?DB? Show status information about the database\n" ".dump ?TABLE? ... Dump the database in an SQL text format\n" " If TABLE specified, only dump tables matching\n" " LIKE pattern TABLE.\n" ".echo on|off Turn command echo on or off\n" ".eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN\n" ".exit Exit this program\n" ".explain ?on|off? Turn output mode suitable for EXPLAIN on or off.\n" " With no args, it turns EXPLAIN on.\n" ".fullschema Show schema and the content of sqlite_stat tables\n" ".headers on|off Turn display of headers on or off\n" ".help Show this message\n" ".import FILE TABLE Import data from FILE into TABLE\n" ".indexes ?TABLE? Show names of all indexes\n" " If TABLE specified, only show indexes for tables\n" " matching LIKE pattern TABLE.\n" #ifdef SQLITE_ENABLE_IOTRACE ".iotrace FILE Enable I/O diagnostic logging to FILE\n" #endif #ifndef SQLITE_OMIT_LOAD_EXTENSION ".load FILE ?ENTRY? Load an extension library\n" #endif |
| ︙ | ︙ | |||
2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 |
pclose(p->out);
}else{
output_file_close(p->out);
}
p->outfile[0] = 0;
p->out = stdout;
}
/*
** If an input line begins with "." then invoke this routine to
** process that line.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 |
pclose(p->out);
}else{
output_file_close(p->out);
}
p->outfile[0] = 0;
p->out = stdout;
}
/*
** Run an SQL command and return the single integer result.
*/
static int db_int(ShellState *p, const char *zSql){
sqlite3_stmt *pStmt;
int res = 0;
sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
res = sqlite3_column_int(pStmt,0);
}
sqlite3_finalize(pStmt);
return res;
}
/*
** Convert a 2-byte or 4-byte big-endian integer into a native integer
*/
unsigned int get2byteInt(unsigned char *a){
return (a[0]<<8) + a[1];
}
unsigned int get4byteInt(unsigned char *a){
return (a[0]<<24) + (a[1]<<16) + (a[2]<<8) + a[3];
}
/*
** Implementation of the ".info" command.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
static const struct { const char *zName; int ofst; } aField[] = {
{ "file change counter:", 24 },
{ "database page count:", 28 },
{ "freelist page count:", 36 },
{ "schema cookie:", 40 },
{ "schema format:", 44 },
{ "default cache size:", 48 },
{ "autovacuum top root:", 52 },
{ "incremental vacuum:", 64 },
{ "text encoding:", 56 },
{ "user version:", 60 },
{ "application id:", 68 },
{ "software version:", 96 },
};
static const struct { const char *zName; const char *zSql; } aQuery[] = {
{ "number of tables:",
"SELECT count(*) FROM %s WHERE type='table'" },
{ "number of indexes:",
"SELECT count(*) FROM %s WHERE type='index'" },
{ "number of triggers:",
"SELECT count(*) FROM %s WHERE type='trigger'" },
{ "number of views:",
"SELECT count(*) FROM %s WHERE type='view'" },
{ "schema size:",
"SELECT total(length(sql)) FROM %s" },
};
sqlite3_file *pFile;
int i;
char *zSchemaTab;
char *zDb = nArg>=2 ? azArg[1] : "main";
unsigned char aHdr[100];
open_db(p, 0);
if( p->db==0 ) return 1;
sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_FILE_POINTER, &pFile);
if( pFile==0 || pFile->pMethods==0 || pFile->pMethods->xRead==0 ){
return 1;
}
i = pFile->pMethods->xRead(pFile, aHdr, 100, 0);
if( i!=SQLITE_OK ){
fprintf(stderr, "unable to read database header\n");
return 1;
}
i = get2byteInt(aHdr+16);
if( i==1 ) i = 65536;
fprintf(p->out, "%-20s %d\n", "database page size:", i);
fprintf(p->out, "%-20s %d\n", "write format:", aHdr[18]);
fprintf(p->out, "%-20s %d\n", "read format:", aHdr[19]);
fprintf(p->out, "%-20s %d\n", "reserved bytes:", aHdr[20]);
for(i=0; i<sizeof(aField)/sizeof(aField[0]); i++){
int ofst = aField[i].ofst;
unsigned int val = get4byteInt(aHdr + ofst);
fprintf(p->out, "%-20s %u", aField[i].zName, val);
switch( ofst ){
case 56: {
if( val==1 ) fprintf(p->out, " (utf8)");
if( val==2 ) fprintf(p->out, " (utf16le)");
if( val==3 ) fprintf(p->out, " (utf16be)");
}
}
fprintf(p->out, "\n");
}
if( zDb==0 ){
zSchemaTab = sqlite3_mprintf("main.sqlite_master");
}else if( strcmp(zDb,"temp")==0 ){
zSchemaTab = sqlite3_mprintf("%s", "sqlite_temp_master");
}else{
zSchemaTab = sqlite3_mprintf("\"%w\".sqlite_master", zDb);
}
for(i=0; i<sizeof(aQuery)/sizeof(aQuery[0]); i++){
char *zSql = sqlite3_mprintf(aQuery[i].zSql, zSchemaTab);
int val = db_int(p, zSql);
sqlite3_free(zSql);
fprintf(p->out, "%-20s %d\n", aQuery[i].zName, val);
}
sqlite3_free(zSchemaTab);
return 0;
}
/*
** If an input line begins with "." then invoke this routine to
** process that line.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
|
| ︙ | ︙ | |||
2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 |
sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
rc = 1;
}
}else
if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
open_db(p, 0);
/* When playing back a "dump", the content might appear in an order
** which causes immediate foreign key constraints to be violated.
** So disable foreign-key constraint enforcement to prevent problems. */
if( nArg!=1 && nArg!=2 ){
| > > > > | 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 |
sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
rc = 1;
}
}else
if( c=='d' && strncmp(azArg[0], "dbinfo", n)==0 ){
rc = shell_dbinfo_command(p, nArg, azArg);
}else
if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
open_db(p, 0);
/* When playing back a "dump", the content might appear in an order
** which causes immediate foreign key constraints to be violated.
** So disable foreign-key constraint enforcement to prevent problems. */
if( nArg!=1 && nArg!=2 ){
|
| ︙ | ︙ | |||
2898 2899 2900 2901 2902 2903 2904 |
*/
if( p->mode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break;
sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
fprintf(stderr, "%s:%d: expected %d columns but found %d - "
"filling the rest with NULL\n",
sCtx.zFile, startLine, nCol, i+1);
| | | 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 |
*/
if( p->mode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break;
sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
fprintf(stderr, "%s:%d: expected %d columns but found %d - "
"filling the rest with NULL\n",
sCtx.zFile, startLine, nCol, i+1);
i += 2;
while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
}
}
if( sCtx.cTerm==sCtx.cColSep ){
do{
xRead(&sCtx);
i++;
|
| ︙ | ︙ | |||
2927 2928 2929 2930 2931 2932 2933 |
xCloser(sCtx.in);
sqlite3_free(sCtx.z);
sqlite3_finalize(pStmt);
if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
}else
| | > | 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 |
xCloser(sCtx.in);
sqlite3_free(sCtx.z);
sqlite3_finalize(pStmt);
if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
}else
if( c=='i' && (strncmp(azArg[0], "indices", n)==0
|| strncmp(azArg[0], "indexes", n)==0) ){
ShellState data;
char *zErrMsg = 0;
open_db(p, 0);
memcpy(&data, p, sizeof(data));
data.showHeader = 0;
data.mode = MODE_List;
if( nArg==1 ){
|
| ︙ | ︙ | |||
2957 2958 2959 2960 2961 2962 2963 |
"SELECT name FROM sqlite_temp_master "
"WHERE type='index' AND tbl_name LIKE shellstatic() "
"ORDER BY 1",
callback, &data, &zErrMsg
);
zShellStatic = 0;
}else{
| | | 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 |
"SELECT name FROM sqlite_temp_master "
"WHERE type='index' AND tbl_name LIKE shellstatic() "
"ORDER BY 1",
callback, &data, &zErrMsg
);
zShellStatic = 0;
}else{
fprintf(stderr, "Usage: .indexes ?LIKE-PATTERN?\n");
rc = 1;
goto meta_command_exit;
}
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
rc = 1;
|
| ︙ | ︙ | |||
3320 3321 3322 3323 3324 3325 3326 |
}
}else
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
extern int sqlite3SelectTrace;
| | | 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 |
}
}else
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
extern int sqlite3SelectTrace;
sqlite3SelectTrace = integerValue(azArg[1]);
}else
#endif
#ifdef SQLITE_DEBUG
/* Undocumented commands for internal testing. Subject to change
** without notice. */
|
| ︙ | ︙ | |||
3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 |
{ "assert", SQLITE_TESTCTRL_ASSERT },
{ "always", SQLITE_TESTCTRL_ALWAYS },
{ "reserve", SQLITE_TESTCTRL_RESERVE },
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS },
{ "iskeyword", SQLITE_TESTCTRL_ISKEYWORD },
{ "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC },
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER },
};
int testctrl = -1;
int rc = 0;
int i, n;
open_db(p, 0);
/* convert testctrl text option to value. allow any unique prefix
| > | 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 |
{ "assert", SQLITE_TESTCTRL_ASSERT },
{ "always", SQLITE_TESTCTRL_ALWAYS },
{ "reserve", SQLITE_TESTCTRL_RESERVE },
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS },
{ "iskeyword", SQLITE_TESTCTRL_ISKEYWORD },
{ "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC },
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER },
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT },
};
int testctrl = -1;
int rc = 0;
int i, n;
open_db(p, 0);
/* convert testctrl text option to value. allow any unique prefix
|
| ︙ | ︙ | |||
3592 3593 3594 3595 3596 3597 3598 |
fprintf(stderr,"Error: testctrl %s takes a single unsigned"
" int option\n", azArg[1]);
}
break;
/* sqlite3_test_control(int, int) */
case SQLITE_TESTCTRL_ASSERT:
| | > | 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 |
fprintf(stderr,"Error: testctrl %s takes a single unsigned"
" int option\n", azArg[1]);
}
break;
/* sqlite3_test_control(int, int) */
case SQLITE_TESTCTRL_ASSERT:
case SQLITE_TESTCTRL_ALWAYS:
case SQLITE_TESTCTRL_NEVER_CORRUPT:
if( nArg==3 ){
int opt = booleanValue(azArg[2]);
rc = sqlite3_test_control(testctrl, opt);
fprintf(p->out, "%d (0x%08x)\n", rc, rc);
} else {
fprintf(stderr,"Error: testctrl %s takes a single int option\n",
azArg[1]);
|
| ︙ | ︙ | |||
4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 |
#if USE_SYSTEM_SQLITE+0!=1
if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
sqlite3_sourceid(), SQLITE_SOURCE_ID);
exit(1);
}
#endif
Argv0 = argv[0];
main_init(&data);
stdin_is_interactive = isatty(0);
/* Make sure we have a valid signal handler early, before anything
** else is done.
*/
| > > | 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 |
#if USE_SYSTEM_SQLITE+0!=1
if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
sqlite3_sourceid(), SQLITE_SOURCE_ID);
exit(1);
}
#endif
setBinaryMode(stdin);
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
Argv0 = argv[0];
main_init(&data);
stdin_is_interactive = isatty(0);
/* Make sure we have a valid signal handler early, before anything
** else is done.
*/
|
| ︙ | ︙ |
Changes to src/shun.c.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 |
const char *zRcvid = P("rcvid");
int nRcvid = 0;
int numRows = 3;
char *zCanonical = 0;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
const char *zRcvid = P("rcvid");
int nRcvid = 0;
int numRows = 3;
char *zCanonical = 0;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
if( P("rebuild") ){
db_close(1);
db_open_repository(g.zRepositoryName);
db_begin_transaction();
rebuild_db(0, 0, 0);
admin_log("Rebuilt database.");
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
}
admin_log("Unshunned %Q", p);
p += UUID_SIZE+1;
}
if( allExist ){
@ <p class="noMoreShun">Artifact(s)<br />
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
| | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
}
admin_log("Unshunned %Q", p);
p += UUID_SIZE+1;
}
if( allExist ){
@ <p class="noMoreShun">Artifact(s)<br />
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@ <a href="%R/artifact/%s(p)">%s(p)</a><br />
}
@ are no longer being shunned.</p>
}else{
@ <p class="noMoreShun">Artifact(s)<br />
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@ %s(p)<br />
}
|
| ︙ | ︙ | |||
144 145 146 147 148 149 150 |
db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
}
admin_log("Shunned %Q", p);
p += UUID_SIZE+1;
}
@ <p class="shunned">Artifact(s)<br />
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
| | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
}
admin_log("Shunned %Q", p);
p += UUID_SIZE+1;
}
@ <p class="shunned">Artifact(s)<br />
for( p = zUuid ; *p ; p += UUID_SIZE+1 ){
@ <a href="%R/artifact/%s(p)">%s(p)</a><br />
}
@ have been shunned. They will no longer be pushed.
@ They will be removed from the repository the next time the repository
@ is rebuilt using the <b>fossil rebuild</b> command-line</p>
}
if( zRcvid ){
nRcvid = atoi(zRcvid);
|
| ︙ | ︙ | |||
246 247 248 249 250 251 252 |
"SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)"
" FROM shun ORDER BY uuid");
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
int stillExists = db_column_int(&q, 1);
cnt++;
if( stillExists ){
| | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
"SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)"
" FROM shun ORDER BY uuid");
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
int stillExists = db_column_int(&q, 1);
cnt++;
if( stillExists ){
@ <b><a href="%R/artifact/%s(zUuid)">%s(zUuid)</a></b><br />
}else{
@ <b>%s(zUuid)</b><br />
}
}
if( cnt==0 ){
@ <i>no artifacts are shunned on this server</i>
}
|
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
int ofst = atoi(PD("ofst","0"));
int showAll = P("all")!=0;
int cnt;
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
int ofst = atoi(PD("ofst","0"));
int showAll = P("all")!=0;
int cnt;
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Artifact Receipts");
if( showAll ){
ofst = 0;
}else{
style_submenu_element("All", "All", "rcvfromlist?all=1");
}
|
| ︙ | ︙ | |||
379 380 381 382 383 384 385 |
*/
void rcvfrom_page(void){
int rcvid = atoi(PD("rcvid","0"));
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
| | > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
*/
void rcvfrom_page(void){
int rcvid = atoi(PD("rcvid","0"));
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Artifact Receipt %d", rcvid);
if( db_exists(
"SELECT 1 FROM blob WHERE rcvid=%d AND"
" NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
){
style_submenu_element("Shun All", "Shun All",
|
| ︙ | ︙ | |||
434 435 436 437 438 439 440 |
@ <tr><th valign="top" align="right">Artifacts:</th>
@ <td valign="top">
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 1);
int size = db_column_int(&q, 2);
const char *zDesc = db_column_text(&q, 3);
if( zDesc==0 ) zDesc = "";
| | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
@ <tr><th valign="top" align="right">Artifacts:</th>
@ <td valign="top">
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 1);
int size = db_column_int(&q, 2);
const char *zDesc = db_column_text(&q, 3);
if( zDesc==0 ) zDesc = "";
@ <a href="%R/info/%s(zUuid)">%s(zUuid)</a>
@ %h(zDesc) (size: %d(size))<br />
}
@ </td></tr>
@ </table>
db_finalize(&q);
style_footer();
}
|
Changes to src/sitemap.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 |
** WEBPAGE: sitemap
**
** Show an incomplete list of web pages offered by the Fossil web engine.
*/
void sitemap_page(void){
login_check_credentials();
style_header("Site Map");
@ <p>
@ The following links are just a few of the many web-pages available for
@ this Fossil repository:
@ </p>
@
@ <ul>
| > | > > > | > | | > | | < | > > > > > | | > | > > | < > | 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 |
** WEBPAGE: sitemap
**
** Show an incomplete list of web pages offered by the Fossil web engine.
*/
void sitemap_page(void){
login_check_credentials();
style_header("Site Map");
style_adunit_config(ADUNIT_RIGHT_OK);
@ <p>
@ The following links are just a few of the many web-pages available for
@ this Fossil repository:
@ </p>
@
@ <ul>
@ <li>%z(href("%R/home"))Home Page</a>
@ <ul>
@ <li>%z(href("%R/docsrc"))Search Project Documentation</a></li>
@ </ul></li>
@ <li>%z(href("%R/tree"))File Browser</a></li>
@ <ul>
@ <li>%z(href("%R/tree?type=tree&ci=trunk"))Tree-view,
@ Trunk Checkin</a></li>
@ <li>%z(href("%R/tree?type=flat"))Flat-view</a></li>
@ <li>%z(href("%R/fileage?name=trunk"))File ages for Trunk</a></li>
@ </ul>
@ <li>%z(href("%R/timeline?n=200"))Project Timeline</a></li>
@ <ul>
@ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10
@ checkins</a></li>
@ <li>%z(href("%R/timeline?n=all&namechng"))All checkins with file name
@ changes</a></li>
@ <li>%z(href("%R/reports"))Activity Reports</a></li>
@ </ul>
@ <li>%z(href("%R/brlist"))Branches</a></li>
@ <ul>
@ <li>%z(href("%R/leaves"))Leaf Checkins</a></li>
@ <li>%z(href("%R/taglist"))List of Tags</a></li>
@ </ul>
@ </li>
@ <li>%z(href("%R/wikihelp"))Wiki</a>
@ <ul>
@ <li>%z(href("%R/wikisrch"))Wiki Search</a></li>
@ <li>%z(href("%R/wcontent"))List of Wiki Pages</a></li>
@ <li>%z(href("%R/timeline?y=w"))Recent activity</a></li>
@ <li>%z(href("%R/wiki_rules"))Wiki Formatting Rules</a></li>
@ <li>%z(href("%R/md_rules"))Markdown Formatting Rules</a></li>
@ <li>%z(href("%R/wiki?name=Sandbox"))Sandbox</a></li>
@ <li>%z(href("%R/attachlist"))List of Attachments</a></li>
@ </ul>
@ </li>
@ <li>%z(href("%R/reportlist"))Tickets</a>
@ <ul>
@ <li>%z(href("%R/tktsrch"))Ticket Search</a></li>
@ <li>%z(href("%R/timeline?y=t"))Recent activity</a></li>
@ <li>%z(href("%R/attachlist"))List of Attachments</a></li>
@ </ul>
@ </li>
@ <li>%z(href("%R/search"))Full-Text Search</a></li>
@ <li>%z(href("%R/login"))Login/Logout/Change Password</a></li>
@ <li>%z(href("%R/stat"))Repository Status</a>
@ <ul>
@ <li>%z(href("%R/hash-collisions"))Collisions on SHA1 hash
@ prefixes</a></li>
@ <li>%z(href("%R/urllist"))List of URLs used to access
@ this repository</a></li>
@ <li>%z(href("%R/bloblist"))List of Artifacts</a></li>
@ </ul></li>
@ <li>On-line Documentation
@ <ul>
@ <li>%z(href("%R/help"))List of All Commands and Web Pages</a></li>
@ <li>%z(href("%R/test-all-help"))All "help" text on a single page</a></li>
@ <li>%z(href("%R/mimetype_list"))Filename suffix to mimetype map</a></li>
@ </ul></li>
@ <li>%z(href("%R/setup"))Administration Pages</a>
@ <ul>
@ <li>%z(href("%R/modreq"))Pending Moderation Requests</a></li>
@ <li>%z(href("%R/admin_log"))Admin log</a></li>
@ <li>%z(href("%R/cachestat"))Status of the web-page cache</a></li>
@ </ul></li>
@ <li>Test Pages
@ <ul>
@ <li>%z(href("%R/test_env"))CGI Environment Test</a></li>
@ <li>%z(href("%R/test_timewarps"))List of "Timewarp" Checkins</a></li>
@ <li>%z(href("%R/test-rename-list"))List of file renames</a></li>
@ <li>%z(href("%R/hash-color-test"))Page to experiment with the automatic
|
| ︙ | ︙ |
Changes to src/skins.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** Implementation of the Setup page for "skins". */ #include "config.h" #include <assert.h> #include "skins.h" | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > | | > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
**
** Implementation of the Setup page for "skins".
*/
#include "config.h"
#include <assert.h>
#include "skins.h"
/*
** An array of available built-in skins.
**
** To add new built-in skins:
**
** 1. Pick a name for the new skin. (Here we use "xyzzy").
**
** 2. Install files skins/xyzzy/css.txt, skins/xyzzy/header.txt,
** and skins/xyzzy/footer.txt into the source tree.
**
** 3. Rerun "tclsh makemake.tcl" in the src/ folder in order to
** rebuild the makefiles to reference the new CSS, headers, and footers.
**
** 4. Make an entry in the following array for the new skin.
*/
static struct BuiltinSkin {
const char *zDesc; /* Description of this skin */
const char *zLabel; /* The directory under skins/ holding this skin */
int whiteForeground; /* True if this skin uses a light-colored foreground */
char *zSQL; /* Filled in at run-time with SQL to insert this skin */
} aBuiltinSkin[] = {
{ "Default", "default", 0, 0 },
{ "Plain Gray, No Logo", "plain_gray", 0, 0 },
{ "Khaki, No Logo", "khaki", 0, 0 },
{ "Black & White, Menu on Left", "black_and_white", 0, 0 },
{ "Shadow boxes & Rounded Corners", "rounded1", 0, 0 },
{ "Enhanced Default", "enhanced1", 0, 0 },
{ "San Francisco Modern", "etienne1", 0, 0 },
{ "Eagle", "eagle", 1, 0 },
};
/*
** Alternative skins can be specified in the CGI script or by options
** on the "http", "ui", and "server" commands. The alternative skin
** name must be one of the aBuiltinSkin[].zLabel names. If there is
** a match, that alternative is used.
**
** The following static variable holds the name of the alternative skin,
** or NULL if the skin should be as configured.
*/
static struct BuiltinSkin *pAltSkin = 0;
static char *zAltSkinDir = 0;
/*
** Invoke this routine to set the alternative skin. Return NULL if the
** alternative was successfully installed. Return a string listing all
** available skins if zName does not match an available skin. Memory
** for the returned string comes from fossil_malloc() and should be freed
** by the caller.
**
** If the alternative skin name contains one or more '/' characters, then
** it is assumed to be a directory on disk that holds override css.txt,
** footer.txt, and header.txt. This mode can be used for interactive
** development of new skins.
*/
char *skin_use_alternative(const char *zName){
int i;
Blob err = BLOB_INITIALIZER;
if( strchr(zName, '/')!=0 ){
zAltSkinDir = fossil_strdup(zName);
return 0;
}
for(i=0; i<ArraySize(aBuiltinSkin); i++){
if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
pAltSkin = &aBuiltinSkin[i];
return 0;
}
}
blob_appendf(&err, "available skins: %s", aBuiltinSkin[0].zLabel);
for(i=1; i<ArraySize(aBuiltinSkin); i++){
blob_append(&err, " ", 1);
blob_append(&err, aBuiltinSkin[i].zLabel, -1);
}
return blob_str(&err);
}
/*
** Look for the --skin command-line option and process it. Or
** call fossil_fatal() if an unknown skin is specified.
*/
void skin_override(void){
const char *zSkin = find_option("skin",0,1);
if( zSkin ){
char *zErr = skin_use_alternative(zSkin);
if( zErr ) fossil_fatal("%s", zErr);
}
}
/*
** The following routines return the various components of the skin
** that should be used for the current run.
*/
const char *skin_get(const char *zWhat){
const char *zOut;
char *z;
if( zAltSkinDir ){
char *z = mprintf("%s/%s.txt", zAltSkinDir, zWhat);
if( file_isfile(z) ){
Blob x;
blob_read_from_file(&x, z);
fossil_free(z);
return blob_str(&x);
}
fossil_free(z);
}
if( pAltSkin ){
z = mprintf("skins/%s/%s.txt", pAltSkin->zLabel, zWhat);
zOut = builtin_text(z);
fossil_free(z);
}else{
zOut = db_get(zWhat, 0);
if( zOut==0 ){
z = mprintf("skins/default/%s.txt", zWhat);
zOut = builtin_text(z);
fossil_free(z);
}
}
return zOut;
}
int skin_white_foreground(void){
int rc;
if( pAltSkin ){
rc = pAltSkin->whiteForeground;
}else{
rc = db_get_boolean("white-foreground",0);
}
return rc;
}
/*
** For a skin named zSkinName, compute the name of the CONFIG table
** entry where that skin is stored and return it.
**
** Return NULL if zSkinName is NULL or an empty string.
**
|
| ︙ | ︙ | |||
1284 1285 1286 1287 1288 1289 1290 |
free(z);
z = 0;
}
return z;
}
/*
| > > > > | > > > > > | > > > > > | > > > > > | < > > > > | | < < | > | > > | | < > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > > > > | < < < < < < < < < < | < | < < | > > > > | < | | | | | | > | | | | < > > > > > > > > | | > | | > | < | > > > | > > > > | > < < < | | < > > > > > > > > | > > | 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 |
free(z);
z = 0;
}
return z;
}
/*
** Return true if there exists a skin name "zSkinName".
*/
static int skinExists(const char *zSkinName){
int i;
if( zSkinName==0 ) return 0;
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
if( fossil_strcmp(zSkinName, aBuiltinSkin[i].zDesc)==0 ) return 1;
}
return db_exists("SELECT 1 FROM config WHERE name='skin:%q'", zSkinName);
}
/*
** Construct and return an string of SQL statements that represents
** a "skin" setting. If zName==0 then return the skin currently
** installed. Otherwise, return one of the built-in skins designated
** by zName.
**
** Memory to hold the returned string is obtained from malloc.
*/
static char *getSkin(const char *zName){
const char *z;
char *zLabel;
static const char *azType[] = { "css", "header", "footer" };
int i;
Blob val;
blob_zero(&val);
for(i=0; i<sizeof(azType)/sizeof(azType[0]); i++){
if( zName ){
zLabel = mprintf("skins/%s/%s.txt", zName, azType[i]);
z = builtin_text(zLabel);
fossil_free(zLabel);
}else{
z = db_get(azType[i], 0);
if( z==0 ){
zLabel = mprintf("skins/default/%s.txt", azType[i]);
z = builtin_text(zLabel);
fossil_free(zLabel);
}
}
blob_appendf(&val,
"REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now());\n",
azType[i], z
);
}
return blob_str(&val);
}
/*
** Respond to a Rename button press. Return TRUE if a dialog was painted.
** Return FALSE to continue with the main Skins page.
*/
static int skinRename(void){
const char *zOldName;
const char *zNewName;
int ex = 0;
if( P("rename")==0 ) return 0;
zOldName = P("sn");
zNewName = P("newname");
if( zOldName==0 ) return 0;
if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
if( zNewName==0 ) zNewName = zOldName;
style_header("Rename A Skin");
if( ex ){
@ <p><span class="generalError">There is already another skin
@ named "%h(zNewName)". Choose a different name.</span></p>
}
@ <form action="%s(g.zTop)/setup_skin" method="post"><div>
@ <table border="0"><tr>
@ <tr><td align="right">Current name:<td align="left"><b>%h(zOldName)</b>
@ <tr><td align="right">New name:<td align="left">
@ <input type="text" size="35" name="newname" value="%h(zNewName)">
@ <tr><td><td>
@ <input type="hidden" name="sn" value="%h(zOldName)">
@ <input type="submit" name="rename" value="Rename">
@ <input type="submit" name="canren" value="Cancel">
@ </table>
login_insert_csrf_secret();
@ </div></form>
style_footer();
return 1;
}
db_multi_exec(
"UPDATE config SET name='skin:%q' WHERE name='skin:%q';",
zNewName, zOldName
);
return 0;
}
/*
** Respond to a Save button press. Return TRUE if a dialog was painted.
** Return FALSE to continue with the main Skins page.
*/
static int skinSave(const char *zCurrent){
const char *zNewName;
int ex = 0;
if( P("save")==0 ) return 0;
zNewName = P("svname");
if( zNewName && zNewName[0]!=0 ){
}
if( zNewName==0 || zNewName[0]==0 || (ex = skinExists(zNewName))!=0 ){
if( zNewName==0 ) zNewName = "";
style_header("Save Current Skin");
if( ex ){
@ <p><span class="generalError">There is already another skin
@ named "%h(zNewName)". Choose a different name.</span></p>
}
@ <form action="%s(g.zTop)/setup_skin" method="post"><div>
@ <table border="0"><tr>
@ <tr><td align="right">Name for this skin:<td align="left">
@ <input type="text" size="35" name="svname" value="%h(zNewName)">
@ <tr><td><td>
@ <input type="submit" name="save" value="Save">
@ <input type="submit" name="cansave" value="Cancel">
@ </table>
login_insert_csrf_secret();
@ </div></form>
style_footer();
return 1;
}
db_multi_exec(
"INSERT OR IGNORE INTO config(name, value, mtime)"
"VALUES('skin:%q',%Q,now())",
zNewName, zCurrent
);
return 0;
}
/*
** WEBPAGE: setup_skin
*/
void setup_skin(void){
const char *z;
char *zName;
char *zErr = 0;
const char *zCurrent = 0; /* Current skin */
int i; /* Loop counter */
Stmt q;
int seenCurrent = 0;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_transaction();
zCurrent = getSkin(0);
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
}
/* Process requests to delete a user-defined skin */
if( P("del1") && (zName = skinVarName(P("sn"), 1))!=0 ){
style_header("Confirm Custom Skin Delete");
@ <form action="%s(g.zTop)/setup_skin" method="post"><div>
@ <p>Deletion of a custom skin is a permanent action that cannot
@ be undone. Please confirm that this is what you want to do:</p>
@ <input type="hidden" name="sn" value="%h(P("sn"))" />
@ <input type="submit" name="del2" value="Confirm - Delete The Skin" />
@ <input type="submit" name="cancel" value="Cancel - Do Not Delete" />
login_insert_csrf_secret();
@ </div></form>
style_footer();
return;
}
if( P("del2")!=0 && (zName = skinVarName(P("sn"), 1))!=0 ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
if( skinRename() ) return;
if( skinSave(zCurrent) ) return;
/* The user pressed one of the "Install" buttons. */
if( P("load") && (z = P("sn"))!=0 && z[0] ){
int seen = 0;
/* Check to see if the current skin is already saved. If it is, there
** is no need to create a backup */
zCurrent = getSkin(0);
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
seen = 1;
break;
}
}
if( !seen ){
seen = db_exists("SELECT 1 FROM config WHERE name GLOB 'skin:*'"
" AND value=%Q", zCurrent);
if( !seen ){
db_multi_exec(
"INSERT INTO config(name,value,mtime) VALUES("
" strftime('skin:Backup On %%Y-%%m-%%d %%H:%%M:%%S'),"
" %Q,now())", zCurrent
);
}
}
seen = 0;
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
if( fossil_strcmp(aBuiltinSkin[i].zDesc, z)==0 ){
seen = 1;
zCurrent = aBuiltinSkin[i].zSQL;
db_multi_exec("%s", zCurrent/*safe-for-%s*/);
break;
}
}
if( !seen ){
zName = skinVarName(z,0);
zCurrent = db_get(zName, 0);
db_multi_exec("%s", zCurrent/*safe-for-%s*/);
}
}
style_header("Skins");
if( zErr ){
@ <p><font color="red">%h(zErr)</font></p>
}
@ <p>A "skin" is a combination of
@ <a href="setup_editcss">CSS</a>,
@ <a href="setup_header">Header</a>, and
@ <a href="setup_footer">Footer</a> that determines the look and feel
@ of the web interface.</p>
@
if( pAltSkin ){
@ <p class="generalError">
@ This page is generated using an skin override named
@ "%h(pAltSkin->zLabel)". You can change the skin configuration
@ below, but the changes will not take effect until the Fossil server
@ is restarted without the override.</p>
@
}
@ <h2>Available Skins:</h2>
@ <table border="0">
for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){
z = aBuiltinSkin[i].zDesc;
@ <tr><td>%d(i+1).<td>%h(z)<td> <td>
if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){
@ (Currently In Use)
seenCurrent = 1;
}else{
@ <form action="%s(g.zTop)/setup_skin" method="post">
@ <input type="hidden" name="sn" value="%h(z)" />
@ <input type="submit" name="load" value="Install" />
if( pAltSkin==&aBuiltinSkin[i] ){
@ (Current override)
}
@ </form>
}
@ </tr>
}
db_prepare(&q,
"SELECT substr(name, 6), value FROM config"
" WHERE name GLOB 'skin:*'"
" ORDER BY name"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zN = db_column_text(&q, 0);
const char *zV = db_column_text(&q, 1);
i++;
@ <tr><td>%d(i).<td>%h(zN)<td> <td>
@ <form action="%s(g.zTop)/setup_skin" method="post">
if( fossil_strcmp(zV, zCurrent)==0 ){
@ (Currently In Use)
seenCurrent = 1;
}else{
@ <input type="submit" name="load" value="Install">
@ <input type="submit" name="del1" value="Delete">
}
@ <input type="submit" name="rename" value="Rename">
@ <input type="hidden" name="sn" value="%h(zN)">
@ </form></tr>
}
db_finalize(&q);
if( !seenCurrent ){
i++;
@ <tr><td>%d(i).<td><i>Current Configuration</i><td> <td>
@ <form action="%s(g.zTop)/setup_skin" method="post">
@ <input type="submit" name="save" value="Save">
@ </form>
}
@ </table>
style_footer();
db_end_transaction(0);
}
|
Changes to src/sqlcmd.c.
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
}else{
sqlite3_result_error(context, "input is not zlib compressed", -1);
}
}
/*
| | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
}else{
sqlite3_result_error(context, "input is not zlib compressed", -1);
}
}
/*
** Add the content(), compress(), and decompress() SQL functions to
** database connection db.
*/
int add_content_sql_commands(sqlite3 *db){
sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
sqlcmd_content, 0, 0);
sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
sqlcmd_compress, 0, 0);
|
| ︙ | ︙ | |||
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
sqlite3 *db,
const char **pzErrMsg,
const void *notUsed
){
add_content_sql_commands(db);
db_add_aux_functions(db);
re_add_sql_func(db);
g.zMainDbType = "repository";
foci_register(db);
g.repositoryOpen = 1;
g.db = db;
return SQLITE_OK;
}
| > | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
sqlite3 *db,
const char **pzErrMsg,
const void *notUsed
){
add_content_sql_commands(db);
db_add_aux_functions(db);
re_add_sql_func(db);
search_sql_setup(db);
g.zMainDbType = "repository";
foci_register(db);
g.repositoryOpen = 1;
g.db = db;
return SQLITE_OK;
}
|
| ︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | ** compress(X). ** ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID) ** found in check-in X (another BLOB.RID value). ** ** symbolic_name_to_rid(X) Return a the BLOB.RID corresponding to symbolic ** name X. ** ** REGEXP The REGEXP operator works, unlike in ** standard SQLite. ** ** files_of_checkin The "files_of_check" virtual table is ** available for decoding manifests. ** | > > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | ** compress(X). ** ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID) ** found in check-in X (another BLOB.RID value). ** ** symbolic_name_to_rid(X) Return a the BLOB.RID corresponding to symbolic ** name X. ** ** now() Return the number of seconds since 1970. ** ** REGEXP The REGEXP operator works, unlike in ** standard SQLite. ** ** files_of_checkin The "files_of_check" virtual table is ** available for decoding manifests. ** |
| ︙ | ︙ |
Changes to src/sqlite3.c.
1 2 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite | | | 1 2 3 4 5 6 7 8 9 10 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.8.8.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% or more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other |
| ︙ | ︙ | |||
274 275 276 277 278 279 280 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.8.2" #define SQLITE_VERSION_NUMBER 3008008 #define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
50193 50194 50195 50196 50197 50198 50199 |
Wal *pWal, /* Wal connection */
int eMode, /* One of PASSIVE, FULL or RESTART */
int (*xBusy)(void*), /* Function to call when busy */
void *pBusyArg, /* Context argument for xBusyHandler */
int sync_flags, /* Flags for OsSync() (or 0) */
u8 *zBuf /* Temporary buffer to use */
){
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | 50193 50194 50195 50196 50197 50198 50199 50200 50201 50202 50203 50204 50205 50206 50207 50208 50209 50210 50211 50212 50213 50214 50215 50216 50217 50218 50219 50220 50221 50222 50223 50224 50225 50226 50227 50228 50229 50230 50231 50232 50233 50234 50235 50236 50237 50238 50239 50240 50241 50242 50243 50244 50245 50246 50247 50248 50249 50250 50251 50252 50253 50254 50255 50256 50257 50258 50259 50260 50261 50262 50263 50264 50265 50266 50267 50268 50269 50270 50271 50272 50273 50274 50275 50276 50277 50278 50279 50280 50281 50282 50283 50284 50285 50286 50287 50288 50289 50290 50291 50292 50293 50294 50295 50296 50297 50298 50299 50300 50301 50302 50303 50304 50305 50306 50307 50308 50309 50310 50311 50312 50313 50314 50315 50316 50317 50318 50319 50320 50321 50322 50323 50324 50325 50326 50327 50328 50329 50330 50331 50332 50333 50334 50335 50336 |
Wal *pWal, /* Wal connection */
int eMode, /* One of PASSIVE, FULL or RESTART */
int (*xBusy)(void*), /* Function to call when busy */
void *pBusyArg, /* Context argument for xBusyHandler */
int sync_flags, /* Flags for OsSync() (or 0) */
u8 *zBuf /* Temporary buffer to use */
){
int rc = SQLITE_OK; /* Return code */
int szPage; /* Database page-size */
WalIterator *pIter = 0; /* Wal iterator context */
u32 iDbpage = 0; /* Next database page to write */
u32 iFrame = 0; /* Wal frame containing data for iDbpage */
u32 mxSafeFrame; /* Max frame that can be backfilled */
u32 mxPage; /* Max database page to write */
int i; /* Loop counter */
volatile WalCkptInfo *pInfo; /* The checkpoint status information */
szPage = walPagesize(pWal);
testcase( szPage<=32768 );
testcase( szPage>=65536 );
pInfo = walCkptInfo(pWal);
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
/* Allocate the iterator */
rc = walIteratorInit(pWal, &pIter);
if( rc!=SQLITE_OK ){
return rc;
}
assert( pIter );
/* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
** in the SQLITE_CHECKPOINT_PASSIVE mode. */
assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
/* Compute in mxSafeFrame the index of the last frame of the WAL that is
** safe to write into the database. Frames beyond mxSafeFrame might
** overwrite database pages that are in use by active readers and thus
** cannot be backfilled from the WAL.
*/
mxSafeFrame = pWal->hdr.mxFrame;
mxPage = pWal->hdr.nPage;
for(i=1; i<WAL_NREADER; i++){
u32 y = pInfo->aReadMark[i];
if( mxSafeFrame>y ){
assert( y<=pWal->hdr.mxFrame );
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
if( rc==SQLITE_OK ){
pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
}else if( rc==SQLITE_BUSY ){
mxSafeFrame = y;
xBusy = 0;
}else{
goto walcheckpoint_out;
}
}
}
if( pInfo->nBackfill<mxSafeFrame
&& (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
){
i64 nSize; /* Current size of database file */
u32 nBackfill = pInfo->nBackfill;
/* Sync the WAL to disk */
if( sync_flags ){
rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
}
/* If the database may grow as a result of this checkpoint, hint
** about the eventual size of the db file to the VFS layer.
*/
if( rc==SQLITE_OK ){
i64 nReq = ((i64)mxPage * szPage);
rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
if( rc==SQLITE_OK && nSize<nReq ){
sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
}
}
/* Iterate through the contents of the WAL, copying data to the db file */
while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
i64 iOffset;
assert( walFramePgno(pWal, iFrame)==iDbpage );
if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
continue;
}
iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;
/* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */
rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
iOffset = (iDbpage-1)*(i64)szPage;
testcase( IS_BIG_INT(iOffset) );
rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
}
/* If work was actually accomplished... */
if( rc==SQLITE_OK ){
if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
i64 szDb = pWal->hdr.nPage*(i64)szPage;
testcase( IS_BIG_INT(szDb) );
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
if( rc==SQLITE_OK && sync_flags ){
rc = sqlite3OsSync(pWal->pDbFd, sync_flags);
}
}
if( rc==SQLITE_OK ){
pInfo->nBackfill = mxSafeFrame;
}
}
/* Release the reader lock held while backfilling */
walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
}
if( rc==SQLITE_BUSY ){
/* Reset the return code so as not to report a checkpoint failure
** just because there are active readers. */
rc = SQLITE_OK;
}
}
/* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the
** entire wal file has been copied into the database file, then block
** until all readers have finished using the wal file. This ensures that
** the next process to write to the database restarts the wal file.
*/
if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
assert( pWal->writeLock );
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
rc = SQLITE_BUSY;
}else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
u32 salt1;
sqlite3_randomness(4, &salt1);
assert( pInfo->nBackfill==pWal->hdr.mxFrame );
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
if( rc==SQLITE_OK ){
if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
/* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as
** SQLITE_CHECKPOINT_RESTART with the addition that it also
** truncates the log file to zero bytes just prior to a
** successful return.
|
| ︙ | ︙ | |||
67494 67495 67496 67497 67498 67499 67500 67501 67502 67503 67504 67505 67506 67507 | if( desiredResult>0 && rc>0 ) return 1; if( CORRUPT_DB ) return 1; if( pKeyInfo->db->mallocFailed ) return 1; return 0; } #endif /* ** Both *pMem1 and *pMem2 contain string values. Compare the two values ** using the collation sequence pColl. As usual, return a negative , zero ** or positive value if *pMem1 is less than, equal to or greater than ** *pMem2, respectively. Similar in spirit to "rc = (*pMem1) - (*pMem2);". */ static int vdbeCompareMemString( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 67497 67498 67499 67500 67501 67502 67503 67504 67505 67506 67507 67508 67509 67510 67511 67512 67513 67514 67515 67516 67517 67518 67519 67520 67521 67522 67523 67524 67525 67526 67527 67528 67529 67530 67531 67532 67533 67534 67535 67536 67537 67538 67539 67540 67541 67542 67543 67544 67545 |
if( desiredResult>0 && rc>0 ) return 1;
if( CORRUPT_DB ) return 1;
if( pKeyInfo->db->mallocFailed ) return 1;
return 0;
}
#endif
#if SQLITE_DEBUG
/*
** Count the number of fields (a.k.a. columns) in the record given by
** pKey,nKey. The verify that this count is less than or equal to the
** limit given by pKeyInfo->nField + pKeyInfo->nXField.
**
** If this constraint is not satisfied, it means that the high-speed
** vdbeRecordCompareInt() and vdbeRecordCompareString() routines will
** not work correctly. If this assert() ever fires, it probably means
** that the KeyInfo.nField or KeyInfo.nXField values were computed
** incorrectly.
*/
static void vdbeAssertFieldCountWithinLimits(
int nKey, const void *pKey, /* The record to verify */
const KeyInfo *pKeyInfo /* Compare size with this KeyInfo */
){
int nField = 0;
u32 szHdr;
u32 idx;
u32 notUsed;
const unsigned char *aKey = (const unsigned char*)pKey;
if( CORRUPT_DB ) return;
idx = getVarint32(aKey, szHdr);
assert( szHdr<=nKey );
while( idx<szHdr ){
idx += getVarint32(aKey+idx, notUsed);
nField++;
}
assert( nField <= pKeyInfo->nField+pKeyInfo->nXField );
}
#else
# define vdbeAssertFieldCountWithinLimits(A,B,C)
#endif
/*
** Both *pMem1 and *pMem2 contain string values. Compare the two values
** using the collation sequence pColl. As usual, return a negative , zero
** or positive value if *pMem1 is less than, equal to or greater than
** *pMem2, respectively. Similar in spirit to "rc = (*pMem1) - (*pMem2);".
*/
static int vdbeCompareMemString(
|
| ︙ | ︙ | |||
67905 67906 67907 67908 67909 67910 67911 67912 67913 67914 67915 67916 67917 67918 |
int serial_type = ((const u8*)pKey1)[1];
int res;
u32 y;
u64 x;
i64 v = pPKey2->aMem[0].u.i;
i64 lhs;
assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
switch( serial_type ){
case 1: { /* 1-byte signed integer */
lhs = ONE_BYTE_INT(aKey);
testcase( lhs<0 );
break;
}
| > | 67943 67944 67945 67946 67947 67948 67949 67950 67951 67952 67953 67954 67955 67956 67957 |
int serial_type = ((const u8*)pKey1)[1];
int res;
u32 y;
u64 x;
i64 v = pPKey2->aMem[0].u.i;
i64 lhs;
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
switch( serial_type ){
case 1: { /* 1-byte signed integer */
lhs = ONE_BYTE_INT(aKey);
testcase( lhs<0 );
break;
}
|
| ︙ | ︙ | |||
67992 67993 67994 67995 67996 67997 67998 67999 68000 68001 68002 68003 68004 68005 |
int nKey1, const void *pKey1, /* Left key */
UnpackedRecord *pPKey2 /* Right key */
){
const u8 *aKey1 = (const u8*)pKey1;
int serial_type;
int res;
getVarint32(&aKey1[1], serial_type);
if( serial_type<12 ){
res = pPKey2->r1; /* (pKey1/nKey1) is a number or a null */
}else if( !(serial_type & 0x01) ){
res = pPKey2->r2; /* (pKey1/nKey1) is a blob */
}else{
int nCmp;
| > | 68031 68032 68033 68034 68035 68036 68037 68038 68039 68040 68041 68042 68043 68044 68045 |
int nKey1, const void *pKey1, /* Left key */
UnpackedRecord *pPKey2 /* Right key */
){
const u8 *aKey1 = (const u8*)pKey1;
int serial_type;
int res;
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
getVarint32(&aKey1[1], serial_type);
if( serial_type<12 ){
res = pPKey2->r1; /* (pKey1/nKey1) is a number or a null */
}else if( !(serial_type & 0x01) ){
res = pPKey2->r2; /* (pKey1/nKey1) is a blob */
}else{
int nCmp;
|
| ︙ | ︙ | |||
105793 105794 105795 105796 105797 105798 105799 |
sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat);
pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
if( pParse->db->mallocFailed ) return;
pOp->p2 = nKey + nData;
pKI = pOp->p4.pKeyInfo;
memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */
sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);
| > | > | 105833 105834 105835 105836 105837 105838 105839 105840 105841 105842 105843 105844 105845 105846 105847 105848 105849 |
sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat);
pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
if( pParse->db->mallocFailed ) return;
pOp->p2 = nKey + nData;
pKI = pOp->p4.pKeyInfo;
memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */
sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);
testcase( pKI->nXField>2 );
pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat,
pKI->nXField-1);
addrJmp = sqlite3VdbeCurrentAddr(v);
sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);
pSort->labelBkOut = sqlite3VdbeMakeLabel(v);
pSort->regReturn = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
sqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor);
sqlite3VdbeJumpHere(v, addrFirst);
|
| ︙ | ︙ | |||
106304 106305 106306 106307 106308 106309 106310 | int nExpr; KeyInfo *pInfo; struct ExprList_item *pItem; sqlite3 *db = pParse->db; int i; nExpr = pList->nExpr; | | | 106346 106347 106348 106349 106350 106351 106352 106353 106354 106355 106356 106357 106358 106359 106360 |
int nExpr;
KeyInfo *pInfo;
struct ExprList_item *pItem;
sqlite3 *db = pParse->db;
int i;
nExpr = pList->nExpr;
pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1);
if( pInfo ){
assert( sqlite3KeyInfoIsWriteable(pInfo) );
for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){
CollSeq *pColl;
pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
if( !pColl ) pColl = db->pDfltColl;
pInfo->aColl[i-iStart] = pColl;
|
| ︙ | ︙ | |||
110174 110175 110176 110177 110178 110179 110180 |
** extracted in pre-sorted order. If that is the case, then the
** OP_OpenEphemeral instruction will be changed to an OP_Noop once
** we figure out that the sorting index is not needed. The addrSortIndex
** variable is used to facilitate that change.
*/
if( sSort.pOrderBy ){
KeyInfo *pKeyInfo;
| | | 110216 110217 110218 110219 110220 110221 110222 110223 110224 110225 110226 110227 110228 110229 110230 |
** extracted in pre-sorted order. If that is the case, then the
** OP_OpenEphemeral instruction will be changed to an OP_Noop once
** we figure out that the sorting index is not needed. The addrSortIndex
** variable is used to facilitate that change.
*/
if( sSort.pOrderBy ){
KeyInfo *pKeyInfo;
pKeyInfo = keyInfoFromExprList(pParse, sSort.pOrderBy, 0, pEList->nExpr);
sSort.iECursor = pParse->nTab++;
sSort.addrSortIndex =
sqlite3VdbeAddOp4(v, OP_OpenEphemeral,
sSort.iECursor, sSort.pOrderBy->nExpr+1+pEList->nExpr, 0,
(char*)pKeyInfo, P4_KEYINFO
);
}else{
|
| ︙ | ︙ | |||
110348 110349 110350 110351 110352 110353 110354 |
/* If there is a GROUP BY clause we might need a sorting index to
** implement it. Allocate that sorting index now. If it turns out
** that we do not need it after all, the OP_SorterOpen instruction
** will be converted into a Noop.
*/
sAggInfo.sortingIdx = pParse->nTab++;
| | | 110390 110391 110392 110393 110394 110395 110396 110397 110398 110399 110400 110401 110402 110403 110404 |
/* If there is a GROUP BY clause we might need a sorting index to
** implement it. Allocate that sorting index now. If it turns out
** that we do not need it after all, the OP_SorterOpen instruction
** will be converted into a Noop.
*/
sAggInfo.sortingIdx = pParse->nTab++;
pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, sAggInfo.nColumn);
addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen,
sAggInfo.sortingIdx, sAggInfo.nSortingColumn,
0, (char*)pKeyInfo, P4_KEYINFO);
/* Initialize memory locations used by GROUP BY aggregate processing
*/
iUseFlag = ++pParse->nMem;
|
| ︙ | ︙ | |||
128326 128327 128328 128329 128330 128331 128332 128333 128334 128335 128336 128337 128338 128339 |
if( zDb && zDb[0] ){
iDb = sqlite3FindDbName(db, zDb);
}
if( iDb<0 ){
rc = SQLITE_ERROR;
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb);
}else{
rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);
sqlite3Error(db, rc);
}
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
#endif
| > | 128368 128369 128370 128371 128372 128373 128374 128375 128376 128377 128378 128379 128380 128381 128382 |
if( zDb && zDb[0] ){
iDb = sqlite3FindDbName(db, zDb);
}
if( iDb<0 ){
rc = SQLITE_ERROR;
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb);
}else{
db->busyHandler.nBusy = 0;
rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);
sqlite3Error(db, rc);
}
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
#endif
|
| ︙ | ︙ |
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.8.8.2" #define SQLITE_VERSION_NUMBER 3008008 #define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ |
Changes to src/stat.c.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 | int szMax, szAvg; const char *zDb; int brief; char zBuf[100]; const char *p; login_check_credentials(); | | > > > | 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 |
int szMax, szAvg;
const char *zDb;
int brief;
char zBuf[100];
const char *p;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
brief = P("brief")!=0;
style_header("Repository Statistics");
style_adunit_config(ADUNIT_RIGHT_OK);
if( g.perm.Admin ){
style_submenu_element("URLs", "URLs and Checkouts", "urllist");
style_submenu_element("Schema", "Repository Schema", "repo_schema");
style_submenu_element("Web-Cache", "Web-Cache Stats", "cachestat");
}
style_submenu_element("Activity Reports", 0, "reports");
style_submenu_element("SHA1 Collisions", 0, "hash-collisions");
@ <table class="label-value">
@ <tr><th>Repository Size:</th><td>
fsize = file_size(g.zRepositoryName);
bigSizeName(sizeof(zBuf), zBuf, fsize);
@ %s(zBuf)
@ </td></tr>
if( !brief ){
|
| ︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
@ <tr><th>Server ID:</th><td>%h(db_get("server-code",""))</td></tr>
@ <tr><th>Fossil Version:</th><td>
@ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
@ (%h(RELEASE_VERSION)) [compiled using %h(COMPILER_NAME)]
@ </td></tr>
@ <tr><th>SQLite Version:</th><td>%.19s(sqlite3_sourceid())
@ [%.10s(&sqlite3_sourceid()[20])] (%s(sqlite3_libversion()))</td></tr>
@ <tr><th>Repository Rebuilt:</th><td>
@ %h(db_get_mtime("rebuilt","%Y-%m-%d %H:%M:%S","Never"))
@ By Fossil %h(db_get("rebuilt","Unknown"))</td></tr>
@ <tr><th>Database Stats:</th><td>
zDb = db_name("repository");
@ %d(db_int(0, "PRAGMA \"%w\".page_count", zDb)) pages,
@ %d(db_int(0, "PRAGMA \"%w\".page_size", zDb)) bytes/page,
| > | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
@ <tr><th>Server ID:</th><td>%h(db_get("server-code",""))</td></tr>
@ <tr><th>Fossil Version:</th><td>
@ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
@ (%h(RELEASE_VERSION)) [compiled using %h(COMPILER_NAME)]
@ </td></tr>
@ <tr><th>SQLite Version:</th><td>%.19s(sqlite3_sourceid())
@ [%.10s(&sqlite3_sourceid()[20])] (%s(sqlite3_libversion()))</td></tr>
@ <tr><th>Schema Version:</th><td>%h(g.zAuxSchema)</td></tr>
@ <tr><th>Repository Rebuilt:</th><td>
@ %h(db_get_mtime("rebuilt","%Y-%m-%d %H:%M:%S","Never"))
@ By Fossil %h(db_get("rebuilt","Unknown"))</td></tr>
@ <tr><th>Database Stats:</th><td>
zDb = db_name("repository");
@ %d(db_int(0, "PRAGMA \"%w\".page_count", zDb)) pages,
@ %d(db_int(0, "PRAGMA \"%w\".page_size", zDb)) bytes/page,
|
| ︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
if( p ){
fossil_print("%*s%s\n", colWidth, "project-id:", p);
}
#if 0
/* Server-id is not useful information any more */
fossil_print("%*s%s\n", colWidth, "server-id:", db_get("server-code", 0));
#endif
if( !omitVers ){
fossil_print("%*s%s %s [%s] (%s)\n",
colWidth, "fossil-version:",
MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION,
COMPILER_NAME);
fossil_print("%*s%.19s [%.10s] (%s)\n",
colWidth, "sqlite-version:",
| > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
if( p ){
fossil_print("%*s%s\n", colWidth, "project-id:", p);
}
#if 0
/* Server-id is not useful information any more */
fossil_print("%*s%s\n", colWidth, "server-id:", db_get("server-code", 0));
#endif
fossil_print("%*s%s\n", colWidth, "schema-version:", g.zAuxSchema);
if( !omitVers ){
fossil_print("%*s%s %s [%s] (%s)\n",
colWidth, "fossil-version:",
MANIFEST_DATE, MANIFEST_VERSION, RELEASE_VERSION,
COMPILER_NAME);
fossil_print("%*s%.19s [%.10s] (%s)\n",
colWidth, "sqlite-version:",
|
| ︙ | ︙ | |||
285 286 287 288 289 290 291 |
**
** Show ways in which this repository has been accessed
*/
void urllist_page(void){
Stmt q;
int cnt;
login_check_credentials();
| | > | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
**
** Show ways in which this repository has been accessed
*/
void urllist_page(void){
Stmt q;
int cnt;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
style_header("URLs and Checkouts");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Stat", "Repository Stats", "stat");
style_submenu_element("Schema", "Repository Schema", "repo_schema");
@ <div class="section">URLs</div>
@ <table border="0" width='100%%'>
db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')"
" FROM config WHERE name GLOB 'baseurl:*' ORDER BY 2 DESC");
cnt = 0;
|
| ︙ | ︙ | |||
331 332 333 334 335 336 337 |
** WEBPAGE: repo_schema
**
** Show the repository schema
*/
void repo_schema_page(void){
Stmt q;
login_check_credentials();
| | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
** WEBPAGE: repo_schema
**
** Show the repository schema
*/
void repo_schema_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
style_header("Repository Schema");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Stat", "Repository Stats", "stat");
style_submenu_element("URLs", "URLs and Checkouts", "urllist");
db_prepare(&q, "SELECT sql FROM %s.sqlite_master WHERE sql IS NOT NULL",
db_name("repository"));
@ <pre>
while( db_step(&q)==SQLITE_ROW ){
@ %h(db_column_text(&q, 0));
}
@ </pre>
db_finalize(&q);
style_footer();
}
|
Added src/statrep.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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
/*
** Copyright (c) 2013 Stephen Beal
**
** 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 contains code to implement the /reports web page.
**
*/
#include "config.h"
#include <string.h>
#include <time.h>
#include "statrep.h"
/*
** Used by stats_report_xxxxx() to remember which type of events
** to show. Populated by stats_report_init_view() and holds the
** return value of that function.
*/
static int statsReportType = 0;
/*
** Set by stats_report_init_view() to one of the y=XXXX values
** accepted by /timeline?y=XXXX.
*/
static const char *statsReportTimelineYFlag = NULL;
/*
** Generate a submenu element with a single parameter change.
*/
static void statrep_submenu(
HQuery *pUrl, /* Base URL */
const char *zMenuName, /* Submenu name */
const char *zParam, /* Parameter value to add or change */
const char *zValue, /* Value of the new parameter */
const char *zRemove /* Parameter to omit */
){
style_submenu_element(zMenuName, zMenuName, "%s",
url_render(pUrl, zParam, zValue, zRemove, 0));
}
/*
** Creates a TEMP VIEW named v_reports which is a wrapper around the
** EVENT table filtered on event.type. It looks for the request
** parameter 'type' (reminder: we "should" use 'y' for consistency
** with /timeline, but /reports uses 'y' for the year) and expects it
** to contain one of the conventional values from event.type or the
** value "all", which is treated as equivalent to "*". By default (if
** no 'y' is specified), "*" is assumed (that is also the default for
** invalid/unknown filter values). That 'y' filter is the one used for
** the event list. Note that a filter of "*" or "all" is equivalent to
** querying against the full event table. The view, however, adds an
** abstraction level to simplify the implementation code for the
** various /reports pages.
**
** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
** used).
*/
static int stats_report_init_view(){
const char *zType = PD("type","*"); /* analog to /timeline?y=... */
const char *zRealType = NULL; /* normalized form of zType */
int rc = 0; /* result code */
assert( !statsReportType && "Must not be called more than once." );
switch( (zType && *zType) ? *zType : 0 ){
case 'c':
case 'C':
zRealType = "ci";
rc = *zRealType;
break;
case 'e':
case 'E':
zRealType = "e";
rc = *zRealType;
break;
case 'g':
case 'G':
zRealType = "g";
rc = *zRealType;
break;
case 't':
case 'T':
zRealType = "t";
rc = *zRealType;
break;
case 'w':
case 'W':
zRealType = "w";
rc = *zRealType;
break;
default:
rc = '*';
break;
}
assert(0 != rc);
if(zRealType){
statsReportTimelineYFlag = zRealType;
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event WHERE type GLOB %Q",
zRealType);
}else{
statsReportTimelineYFlag = "a";
db_multi_exec("CREATE TEMP VIEW v_reports AS "
"SELECT * FROM event");
}
return statsReportType = rc;
}
/*
** Returns a string suitable (for a given value of suitable) for
** use in a label with the header of the /reports pages, dependent
** on the 'type' flag. See stats_report_init_view().
** The returned bytes are static.
*/
static const char *stats_report_label_for_type(){
assert( statsReportType && "Must call stats_report_init_view() first." );
switch( statsReportType ){
case 'c':
return "checkins";
case 'e':
return "technotes";
case 'w':
return "wiki changes";
case 't':
return "ticket changes";
case 'g':
return "tag changes";
default:
return "all types";
}
}
/*
** A helper for the /reports family of pages which prints out a menu
** of links for the various type=XXX flags. zCurrentViewName must be
** the name/value of the 'view' parameter which is in effect at the
** time this is called. e.g. if called from the 'byuser' view then
** zCurrentViewName must be "byuser". Any URL parameters which need to
** be added to the generated URLs should be passed in zParam. The
** caller is expected to have already encoded any zParam in the %T or
** %t encoding. */
static void stats_report_event_types_menu(const char *zCurrentViewName,
const char *zParam){
char *zTop;
if(zParam && !*zParam){
zParam = NULL;
}
zTop = mprintf("%s/reports?view=%s%s%s", g.zTop, zCurrentViewName,
zParam ? "&" : "", zParam);
cgi_printf("<div>");
cgi_printf("<span>Types:</span> ");
if('*' == statsReportType){
cgi_printf(" <strong>all</strong>", zTop);
}else{
cgi_printf(" <a href='%s'>all</a>", zTop);
}
if('c' == statsReportType){
cgi_printf(" <strong>checkins</strong>", zTop);
}else{
cgi_printf(" <a href='%s&type=ci'>checkins</a>", zTop);
}
if('e' == statsReportType){
cgi_printf(" <strong>technotes</strong>", zTop);
}else{
cgi_printf(" <a href='%s&type=e'>technotes</a>", zTop);
}
if( 't' == statsReportType ){
cgi_printf(" <strong>tickets</strong>", zTop);
}else{
cgi_printf(" <a href='%s&type=t'>tickets</a>", zTop);
}
if( 'g' == statsReportType ){
cgi_printf(" <strong>tags</strong>", zTop);
}else{
cgi_printf(" <a href='%s&type=g'>tags</a>", zTop);
}
if( 'w' == statsReportType ){
cgi_printf(" <strong>wiki</strong>", zTop);
}else{
cgi_printf(" <a href='%s&type=w'>wiki</a>", zTop);
}
fossil_free(zTop);
cgi_printf("</div>");
}
/*
** Helper for stats_report_by_month_year(), which generates a list of
** week numbers. zTimeframe should be either a timeframe in the form YYYY
** or YYYY-MM.
*/
static void stats_report_output_week_links(const char *zTimeframe){
Stmt stWeek = empty_Stmt;
char yearPart[5] = {0,0,0,0,0};
memcpy(yearPart, zTimeframe, 4);
db_prepare(&stWeek,
"SELECT DISTINCT strftime('%%W',mtime) AS wk, "
"count(*) AS n, "
"substr(date(mtime),1,%d) AS ym "
"FROM v_reports "
"WHERE ym=%Q AND mtime < current_timestamp "
"GROUP BY wk ORDER BY wk",
strlen(zTimeframe),
zTimeframe);
while( SQLITE_ROW == db_step(&stWeek) ){
const char *zWeek = db_column_text(&stWeek,0);
const int nCount = db_column_int(&stWeek,1);
cgi_printf("<a href='%R/timeline?"
"yw=%t-%t&n=%d&y=%s'>%s</a>",
yearPart, zWeek,
nCount, statsReportTimelineYFlag, zWeek);
}
db_finalize(&stWeek);
}
/*
** Implements the "byyear" and "bymonth" reports for /reports.
** If includeMonth is true then it generates the "bymonth" report,
** else the "byyear" report. If zUserName is not NULL and not empty
** then the report is restricted to events created by the named user
** account.
*/
static void stats_report_by_month_year(char includeMonth,
char includeWeeks,
const char *zUserName){
Stmt query = empty_Stmt;
int nRowNumber = 0; /* current TR number */
int nEventTotal = 0; /* Total event count */
int rowClass = 0; /* counter for alternating
row colors */
Blob sql = empty_blob; /* SQL */
const char *zTimeLabel = includeMonth ? "Year/Month" : "Year";
char zPrevYear[5] = {0}; /* For keeping track of when
we change years while looping */
int nEventsPerYear = 0; /* Total event count for the
current year */
char showYearTotal = 0; /* Flag telling us when to show
the per-year event totals */
Blob header = empty_blob; /* Page header text */
int nMaxEvents = 1; /* for calculating length of graph
bars. */
int iterations = 0; /* number of weeks/months we iterate
over */
stats_report_init_view();
stats_report_event_types_menu( includeMonth ? "bymonth" : "byyear", NULL );
blob_appendf(&header, "Timeline Events (%s) by year%s",
stats_report_label_for_type(),
(includeMonth ? "/month" : ""));
blob_append_sql(&sql,
"SELECT substr(date(mtime),1,%d) AS timeframe, "
"count(*) AS eventCount "
"FROM v_reports ",
includeMonth ? 7 : 4);
if(zUserName&&*zUserName){
blob_append_sql(&sql, " WHERE user=%Q ", zUserName);
blob_appendf(&header," for user %q", zUserName);
}
blob_append(&sql,
" GROUP BY timeframe"
" ORDER BY timeframe DESC",
-1);
db_prepare(&query, "%s", blob_sql_text(&sql));
blob_reset(&sql);
@ <h1>%b(&header)</h1>
@ <table class='statistics-report-table-events' border='0' cellpadding='2'
@ cellspacing='0' id='statsTable'>
@ <thead>
@ <th>%s(zTimeLabel)</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </thead><tbody>
blob_reset(&header);
/*
Run the query twice. The first time we calculate the maximum
number of events for a given row. Maybe someone with better SQL
Fu can re-implement this with a single query.
*/
while( SQLITE_ROW == db_step(&query) ){
const int nCount = db_column_int(&query, 1);
if(nCount>nMaxEvents){
nMaxEvents = nCount;
}
++iterations;
}
db_reset(&query);
while( SQLITE_ROW == db_step(&query) ){
const char *zTimeframe = db_column_text(&query, 0);
const int nCount = db_column_int(&query, 1);
int nSize = nCount
? (int)(100 * nCount / nMaxEvents)
: 1;
showYearTotal = 0;
if(!nSize) nSize = 1;
if(includeMonth){
/* For Month/year view, add a separator for each distinct year. */
if(!*zPrevYear ||
(0!=fossil_strncmp(zPrevYear,zTimeframe,4))){
showYearTotal = *zPrevYear;
if(showYearTotal){
rowClass = ++nRowNumber % 2;
@ <tr class='row%d(rowClass)'>
@ <td></td>
@ <td colspan='2'>Yearly total: %d(nEventsPerYear)</td>
@</tr>
}
nEventsPerYear = 0;
memcpy(zPrevYear,zTimeframe,4);
rowClass = ++nRowNumber % 2;
@ <tr class='row%d(rowClass)'>
@ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
@ </tr>
}
}
rowClass = ++nRowNumber % 2;
nEventTotal += nCount;
nEventsPerYear += nCount;
@<tr class='row%d(rowClass)'>
@ <td>
if(includeMonth){
cgi_printf("<a href='%R/timeline?"
"ym=%t&n=%d&y=%s",
zTimeframe, nCount,
statsReportTimelineYFlag );
/* Reminder: n=nCount is not actually correct for bymonth unless
that was the only user who caused events.
*/
if( zUserName && *zUserName ){
cgi_printf("&u=%t", zUserName);
}
cgi_printf("' target='_new'>%s</a>",zTimeframe);
}else {
cgi_printf("<a href='?view=byweek&y=%s&type=%c",
zTimeframe, (char)statsReportType);
if(zUserName && *zUserName){
cgi_printf("&u=%t", zUserName);
}
cgi_printf("'>%s</a>", zTimeframe);
}
@ </td><td>%d(nCount)</td>
@ <td>
@ <div class='statistics-report-graph-line'
@ style='width:%d(nSize)%%;'> </div>
@ </td>
@</tr>
if(includeWeeks){
/* This part works fine for months but it terribly slow (4.5s on my PC),
so it's only shown for by-year for now. Suggestions/patches for
a better/faster layout are welcomed. */
@ <tr class='row%d(rowClass)'>
@ <td colspan='2' class='statistics-report-week-number-label'>Week #:</td>
@ <td class='statistics-report-week-of-year-list'>
stats_report_output_week_links(zTimeframe);
@ </td></tr>
}
/*
Potential improvement: calculate the min/max event counts and
use percent-based graph bars.
*/
}
db_finalize(&query);
if(includeMonth && !showYearTotal && *zPrevYear){
/* Add final year total separator. */
rowClass = ++nRowNumber % 2;
@ <tr class='row%d(rowClass)'>
@ <td></td>
@ <td colspan='2'>Yearly total: %d(nEventsPerYear)</td>
@</tr>
}
@ </tbody></table>
if(nEventTotal){
const char *zAvgLabel = includeMonth ? "month" : "year";
int nAvg = iterations ? (nEventTotal/iterations) : 0;
@ <br><div>Total events: %d(nEventTotal)
@ <br>Average per active %s(zAvgLabel): %d(nAvg)
@ </div>
}
if( !includeMonth ){
output_table_sorting_javascript("statsTable","tnx",-1);
}
}
/*
** Implements the "byuser" view for /reports.
*/
static void stats_report_by_user(){
Stmt query = empty_Stmt;
int nRowNumber = 0; /* current TR number */
int nEventTotal = 0; /* Total event count */
int rowClass = 0; /* counter for alternating
row colors */
int nMaxEvents = 1; /* max number of events for
all rows. */
stats_report_init_view();
stats_report_event_types_menu("byuser", NULL);
db_prepare(&query,
"SELECT user, "
"COUNT(*) AS eventCount "
"FROM v_reports "
"GROUP BY user ORDER BY eventCount DESC");
@ <h1>Timeline Events
@ (%s(stats_report_label_for_type())) by User</h1>
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>User</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
const int nCount = db_column_int(&query, 1);
if(nCount>nMaxEvents){
nMaxEvents = nCount;
}
}
db_reset(&query);
while( SQLITE_ROW == db_step(&query) ){
const char *zUser = db_column_text(&query, 0);
const int nCount = db_column_int(&query, 1);
int nSize = nCount
? (int)(100 * nCount / nMaxEvents)
: 0;
if(!nCount) continue /* arguable! Possible? */;
else if(!nSize) nSize = 1;
rowClass = ++nRowNumber % 2;
nEventTotal += nCount;
@<tr class='row%d(rowClass)'>
@ <td>
@ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
@ </td><td data-sortkey='%08x(-nCount)'>%d(nCount)</td>
@ <td>
@ <div class='statistics-report-graph-line'
@ style='width:%d(nSize)%%;'> </div>
@ </td>
@</tr>
/*
Potential improvement: calculate the min/max event counts and
use percent-based graph bars.
*/
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","tkx",2);
}
/*
** Implements the "byfile" view for /reports.
*/
static void stats_report_by_file(){
Stmt query;
int mxEvent = 1; /* max number of events across all rows */
int nRowNumber = 0;
db_multi_exec(
"CREATE TEMP TABLE statrep(filename, cnt);"
"INSERT INTO statrep(filename, cnt)"
" SELECT filename.name, count(distinct mlink.mid)"
" FROM filename, mlink"
" WHERE filename.fnid=mlink.fnid"
" GROUP BY 1"
);
db_prepare(&query,
"SELECT filename, cnt FROM statrep ORDER BY cnt DESC, filename /*sort*/"
);
mxEvent = db_int(1, "SELECT max(cnt) FROM statrep");
@ <h1>Checkins Per File</h1>
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>File</th>
@ <th>Checkins</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
const char *zFile = db_column_text(&query, 0);
const int n = db_column_int(&query, 1);
int sz;
if( n<=0 ) continue;
sz = (int)(100*n/mxEvent);
if( sz==0 ) sz = 1;
@<tr class='row%d(++nRowNumber%2)'>
@ <td>%z(href("%R/finfo?name=%T",zFile))%h(zFile)</a></td>
@ <td>%d(n)</td>
@ <td>
@ <div class='statistics-report-graph-line'
@ style='width:%d(sz)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","tNx",2);
}
/*
** Implements the "byweekday" view for /reports.
*/
static void stats_report_day_of_week(){
Stmt query = empty_Stmt;
int nRowNumber = 0; /* current TR number */
int nEventTotal = 0; /* Total event count */
int rowClass = 0; /* counter for alternating
row colors */
int nMaxEvents = 1; /* max number of events for
all rows. */
static const char *const daysOfWeek[] = {
"Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"
};
stats_report_init_view();
stats_report_event_types_menu("byweekday", NULL);
db_prepare(&query,
"SELECT cast(mtime %% 7 AS INTEGER) dow, "
"COUNT(*) AS eventCount "
"FROM v_reports "
"GROUP BY dow ORDER BY dow");
@ <h1>Timeline Events
@ (%s(stats_report_label_for_type())) by Day of the Week</h1>
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>DoW</th>
@ <th>Day</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
const int nCount = db_column_int(&query, 1);
if(nCount>nMaxEvents){
nMaxEvents = nCount;
}
}
db_reset(&query);
while( SQLITE_ROW == db_step(&query) ){
const int dayNum =db_column_int(&query, 0);
const int nCount = db_column_int(&query, 1);
int nSize = nCount
? (int)(100 * nCount / nMaxEvents)
: 0;
if(!nCount) continue /* arguable! Possible? */;
else if(!nSize) nSize = 1;
rowClass = ++nRowNumber % 2;
nEventTotal += nCount;
@<tr class='row%d(rowClass)'>
@ <td>%d(dayNum)</td>
@ <td>%s(daysOfWeek[dayNum])</td>
@ <td>%d(nCount)</td>
@ <td>
@ <div class='statistics-report-graph-line'
@ style='width:%d(nSize)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","ntnx",1);
}
/*
** Helper for stats_report_by_month_year(), which generates a list of
** week numbers. zTimeframe should be either a timeframe in the form YYYY
** or YYYY-MM.
*/
static void stats_report_year_weeks(const char *zUserName){
const char *zYear = P("y");
int nYear = zYear ? strlen(zYear) : 0;
int i = 0;
Stmt qYears = empty_Stmt;
char *zDefaultYear = NULL;
Blob sql = empty_blob;
int nMaxEvents = 1; /* max number of events for
all rows. */
int iterations = 0; /* # of active time periods. */
stats_report_init_view();
if(4==nYear){
Blob urlParams = empty_blob;
blob_appendf(&urlParams, "y=%T", zYear);
stats_report_event_types_menu("byweek", blob_str(&urlParams));
blob_reset(&urlParams);
}else{
stats_report_event_types_menu("byweek", NULL);
}
blob_append(&sql,
"SELECT DISTINCT substr(date(mtime),1,4) AS y "
"FROM v_reports WHERE 1 ", -1);
if(zUserName&&*zUserName){
blob_append_sql(&sql,"AND user=%Q ", zUserName);
}
blob_append(&sql,"GROUP BY y ORDER BY y", -1);
db_prepare(&qYears, "%s", blob_sql_text(&sql));
blob_reset(&sql);
cgi_printf("Select year: ");
while( SQLITE_ROW == db_step(&qYears) ){
const char *zT = db_column_text(&qYears, 0);
if( i++ ){
cgi_printf(" ");
}
cgi_printf("<a href='?view=byweek&y=%s&type=%c", zT,
(char)statsReportType);
if(zUserName && *zUserName){
cgi_printf("&user=%t",zUserName);
}
cgi_printf("'>%s</a>",zT);
}
db_finalize(&qYears);
cgi_printf("<br/>");
if(!zYear || !*zYear){
zDefaultYear = db_text("????", "SELECT strftime('%%Y')");
zYear = zDefaultYear;
nYear = 4;
}
if(4 == nYear){
Stmt stWeek = empty_Stmt;
int rowCount = 0;
int total = 0;
Blob header = empty_blob;
blob_appendf(&header, "Timeline events (%s) for the calendar weeks "
"of %h", stats_report_label_for_type(),
zYear);
blob_append_sql(&sql,
"SELECT DISTINCT strftime('%%W',mtime) AS wk, "
"count(*) AS n "
"FROM v_reports "
"WHERE %Q=substr(date(mtime),1,4) "
"AND mtime < current_timestamp ",
zYear);
if(zUserName&&*zUserName){
blob_append_sql(&sql, " AND user=%Q ", zUserName);
blob_appendf(&header," for user %h", zUserName);
}
blob_append_sql(&sql, "GROUP BY wk ORDER BY wk DESC");
cgi_printf("<h1>%h</h1>", blob_str(&header));
blob_reset(&header);
cgi_printf("<table class='statistics-report-table-events' "
"border='0' cellpadding='2' width='100%%' "
"cellspacing='0' id='statsTable'>");
cgi_printf("<thead><tr>"
"<th>Week</th>"
"<th>Events</th>"
"<th width='90%%'><!-- relative commits graph --></th>"
"</tr></thead>"
"<tbody>");
db_prepare(&stWeek, "%s", blob_sql_text(&sql));
blob_reset(&sql);
while( SQLITE_ROW == db_step(&stWeek) ){
const int nCount = db_column_int(&stWeek, 1);
if(nCount>nMaxEvents){
nMaxEvents = nCount;
}
++iterations;
}
db_reset(&stWeek);
while( SQLITE_ROW == db_step(&stWeek) ){
const char *zWeek = db_column_text(&stWeek,0);
const int nCount = db_column_int(&stWeek,1);
int nSize = nCount
? (int)(100 * nCount / nMaxEvents)
: 0;
if(!nSize) nSize = 1;
total += nCount;
cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
cgi_printf("<td><a href='%R/timeline?yw=%t-%s&n=%d&y=%s",
zYear, zWeek, nCount,
statsReportTimelineYFlag);
if(zUserName && *zUserName){
cgi_printf("&u=%t",zUserName);
}
cgi_printf("'>%s</a></td>",zWeek);
cgi_printf("<td>%d</td>",nCount);
cgi_printf("<td>");
if(nCount){
cgi_printf("<div class='statistics-report-graph-line'"
"style='width:%d%%;'> </div>",
nSize);
}
cgi_printf("</td></tr>");
}
db_finalize(&stWeek);
free(zDefaultYear);
cgi_printf("</tbody></table>");
if(total){
int nAvg = iterations ? (total/iterations) : 0;
cgi_printf("<br><div>Total events: %d<br>"
"Average per active week: %d</div>",
total, nAvg);
}
output_table_sorting_javascript("statsTable","tnx",-1);
}
}
/*
** WEBPAGE: reports
**
** Shows activity reports for the repository.
**
** Query Parameters:
**
** view=REPORT_NAME Valid values: bymonth, byyear, byuser
** user=NAME Restricts statistics to the given user
** type=TYPE Restricts the report to a specific event type:
** ci (checkin), w (wiki), t (ticket), g (tag)
** Defaulting to all event types.
**
** The view-specific query parameters include:
**
** view=byweek:
**
** y=YYYY The year to report (default is the server's
** current year).
*/
void stats_report_page(){
HQuery url; /* URL for various branch links */
const char *zView = P("view"); /* Which view/report to show. */
const char *zUserName = P("user");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if(!zUserName) zUserName = P("u");
url_initialize(&url, "reports");
if(zUserName && *zUserName){
url_add_parameter(&url,"user", zUserName);
statrep_submenu(&url, "(Remove User Flag)", "view", zView, "user");
}
statrep_submenu(&url, "By Year", "view", "byyear", 0);
statrep_submenu(&url, "By Month", "view", "bymonth", 0);
statrep_submenu(&url, "By Week", "view", "byweek", 0);
statrep_submenu(&url, "By Weekday", "view", "byweekday", 0);
statrep_submenu(&url, "By User", "view", "byuser", "user");
statrep_submenu(&url, "By File", "view", "byfile", "file");
style_submenu_element("Stats", "Stats", "%R/stat");
url_reset(&url);
style_header("Activity Reports");
if(0==fossil_strcmp(zView,"byyear")){
stats_report_by_month_year(0, 0, zUserName);
}else if(0==fossil_strcmp(zView,"bymonth")){
stats_report_by_month_year(1, 0, zUserName);
}else if(0==fossil_strcmp(zView,"byweek")){
stats_report_year_weeks(zUserName);
}else if(0==fossil_strcmp(zView,"byuser")){
stats_report_by_user();
}else if(0==fossil_strcmp(zView,"byweekday")){
stats_report_day_of_week();
}else if(0==fossil_strcmp(zView,"byfile")){
stats_report_by_file();
}else{
@ <h1>Activity Reports:</h1>
@ <ul>
@ <li>%z(href("?view=byyear"))Events by year</a></li>
@ <li>%z(href("?view=bymonth"))Events by month</a></li>
@ <li>%z(href("?view=byweek"))Events by calendar week</a></li>
@ <li>%z(href("?view=byweekday"))Events by day of the week</a></li>
@ <li>%z(href("?view=byuser"))Events by user</a></li>
@ <li>%z(href("?view=byfile"))Events by file</a></li>
@ </ul>
}
style_footer();
}
|
Changes to src/style.c.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | #include "VERSION.h" #include "config.h" #include "style.h" /* ** Elements of the submenu are collected into the following | | > > | > > > > | > > | | | > > > > > > > > > > > > > > > > > > | 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 |
#include "VERSION.h"
#include "config.h"
#include "style.h"
/*
** Elements of the submenu are collected into the following
** structure and displayed below the main menu.
**
** Populate these structure with calls to
**
** style_submenu_element()
** style_submenu_entry()
** style_submenu_checkbox()
** style_submenu_multichoice()
**
** prior to calling style_footer(). The style_footer() routine
** will generate the appropriate HTML text just below the main
** menu.
*/
static struct Submenu {
const char *zLabel; /* Button label */
const char *zTitle;
const char *zLink; /* Jump to this link when button is pressed */
} aSubmenu[30];
static int nSubmenu = 0; /* Number of buttons */
static struct SubmenuCtrl {
const char *zName; /* Form query parameter */
const char *zLabel; /* Label. Might be NULL for FF_MULTI */
unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_BINARY */
unsigned char isDisabled; /* True if this control is grayed out */
short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
const char **azChoice; /* value/display pairs for FF_MULTI */
const char *zFalse; /* FF_BINARY label when false */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
#define FF_ENTRY 1
#define FF_MULTI 2
#define FF_BINARY 3
/*
** Remember that the header has been generated. The footer is omitted
** if an error occurs before the header.
*/
static int headerHasBeenGenerated = 0;
/*
** remember, if a sidebox was used
*/
static int sideboxUsed = 0;
/*
** Ad-unit styles.
*/
static unsigned adUnitFlags = 0;
/*
** List of hyperlinks and forms that need to be resolved by javascript in
** the footer.
*/
char **aHref = 0;
int nHref = 0;
|
| ︙ | ︙ | |||
209 210 211 212 213 214 215 |
const char *zTitle,
const char *zLink,
...
){
va_list ap;
assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) );
aSubmenu[nSubmenu].zLabel = zLabel;
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
const char *zTitle,
const char *zLink,
...
){
va_list ap;
assert( nSubmenu < sizeof(aSubmenu)/sizeof(aSubmenu[0]) );
aSubmenu[nSubmenu].zLabel = zLabel;
aSubmenu[nSubmenu].zTitle = zTitle ? zTitle : zLabel;
va_start(ap, zLink);
aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
va_end(ap);
nSubmenu++;
}
void style_submenu_entry(
const char *zName, /* Query parameter name */
const char *zLabel, /* Label before the entry box */
int iSize, /* Size of the entry box */
int isDisabled /* True if disabled */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
nSubmenuCtrl++;
}
void style_submenu_binary(
const char *zName, /* Query parameter name */
const char *zTrue, /* Label to show when parameter is true */
const char *zFalse, /* Label to show when the parameter is false */
int isDisabled /* True if this control is disabled */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
nSubmenuCtrl++;
}
void style_submenu_multichoice(
const char *zName, /* Query parameter name */
int nChoice, /* Number of options */
const char **azChoice, /* value/display pairs. 2*nChoice entries */
int isDisabled /* True if this control is disabled */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
nSubmenuCtrl++;
}
/*
** Compare two submenu items for sorting purposes
*/
static int submenuCompare(const void *a, const void *b){
const struct Submenu *A = (const struct Submenu*)a;
const struct Submenu *B = (const struct Submenu*)b;
|
| ︙ | ︙ | |||
282 283 284 285 286 287 288 |
/*
** Draw the header.
*/
void style_header(const char *zTitleFormat, ...){
va_list ap;
char *zTitle;
| | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
/*
** Draw the header.
*/
void style_header(const char *zTitleFormat, ...){
va_list ap;
char *zTitle;
const char *zHeader = skin_get("header");
login_check_credentials();
va_start(ap, zTitleFormat);
zTitle = vmprintf(zTitleFormat, ap);
va_end(ap);
cgi_destination(CGI_HEADER);
|
| ︙ | ︙ | |||
341 342 343 344 345 346 347 348 349 |
@ function gebi(x){
@ if(/^#/.test(x)) x = x.substr(1);
@ var e = document.getElementById(x);
@ if(!e) throw new Error("Expecting element with ID "+x);
@ else return e;}
@ </script>
}
/*
| > > > > > > > | | > > > > > > > > > > > | > > | | > > > > > > | | > > > > | > > > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > | > | | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
@ function gebi(x){
@ if(/^#/.test(x)) x = x.substr(1);
@ var e = document.getElementById(x);
@ if(!e) throw new Error("Expecting element with ID "+x);
@ else return e;}
@ </script>
}
#if INTERFACE
/* Allowed parameters for style_adunit() */
#define ADUNIT_OFF 0x0001 /* Do not allow ads on this page */
#define ADUNIT_RIGHT_OK 0x0002 /* Right-side vertical ads ok here */
#endif
/*
** Various page implementations can invoke this interface to let the
** style manager know what kinds of ads are appropriate for this page.
*/
void style_adunit_config(unsigned int mFlags){
adUnitFlags = mFlags;
}
/*
** Return the text of an ad-unit, if one should be rendered. Return
** NULL if no ad-unit is desired.
**
** The *pAdFlag value might be set to ADUNIT_RIGHT_OK if this is
** a right-hand vertical ad.
*/
static const char *style_adunit_text(unsigned int *pAdFlag){
const char *zAd = 0;
*pAdFlag = 0;
if( adUnitFlags & ADUNIT_OFF ) return 0; /* Disallow ads on this page */
if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){
return 0;
}
if( !login_is_nobody()
&& fossil_strcmp(g.zLogin,"anonymous")!=0
&& db_get_boolean("adunit-omit-if-user",0)
){
return 0;
}
if( (adUnitFlags & ADUNIT_RIGHT_OK)!=0
&& !fossil_all_whitespace(zAd = db_get("adunit-right", 0))
&& !cgi_body_contains("<table")
){
*pAdFlag = ADUNIT_RIGHT_OK;
return zAd;
}else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){
return zAd;
}
return 0;
}
/*
** Draw the footer at the bottom of the page.
*/
void style_footer(void){
const char *zFooter;
const char *zAd = 0;
unsigned int mAdFlags = 0;
if( !headerHasBeenGenerated ) return;
/* Go back and put the submenu at the top of the page. We delay the
** creation of the submenu until the end so that we can add elements
** to the submenu while generating page text.
*/
cgi_destination(CGI_HEADER);
if( nSubmenu+nSubmenuCtrl>0 ){
int i;
if( nSubmenuCtrl ){
cgi_printf("<form id='f01' method='GET' action='%R/%s'>", g.zPath);
}
@ <div class="submenu">
if( nSubmenu>0 ){
qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
for(i=0; i<nSubmenu; i++){
struct Submenu *p = &aSubmenu[i];
if( p->zLink==0 ){
@ <span class="label">%h(p->zLabel)</span>
}else{
@ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
}
}
}
if( nSubmenuCtrl>0 ){
for(i=0; i<nSubmenuCtrl; i++){
const char *zQPN = aSubmenuCtrl[i].zName;
const char *zDisabled = " disabled";
if( !aSubmenuCtrl[i].isDisabled ){
zDisabled = "";
cgi_tag_query_parameter(zQPN);
}
switch( aSubmenuCtrl[i].eType ){
case FF_ENTRY: {
cgi_printf(
"<span class='submenuctrl'>"
" %h<input type='text' name='%s' size='%d' maxlength='%d'"
"value='%h'%s></span>\n",
aSubmenuCtrl[i].zLabel,
zQPN,
aSubmenuCtrl[i].iSize, aSubmenuCtrl[i].iSize,
PD(zQPN,""),
zDisabled
);
break;
}
case FF_MULTI: {
int j;
const char *zVal = P(zQPN);
cgi_printf(
"<select class='submenuctrl' size='1' name='%s'%s "
"onchange='gebi(\"f01\").submit();'>\n",
zQPN, zDisabled
);
for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
const char *zQPV = aSubmenuCtrl[i].azChoice[j];
cgi_printf(
"<option value='%h'%s>%h</option>\n",
zQPV,
fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
aSubmenuCtrl[i].azChoice[j+1]
);
}
@ </select>
break;
}
case FF_BINARY: {
int isTrue = PB(zQPN);
cgi_printf(
"<select class='submenuctrl' size='1' name='%s'%s "
"onchange='gebi(\"f01\").submit();'>\n",
zQPN, zDisabled
);
cgi_printf(
"<option value='1'%s>%h</option>\n",
isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
);
cgi_printf(
"<option value='0'%s>%h</option>\n",
(!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
);
@ </select>
break;
}
}
}
}
@ </div>
if( nSubmenuCtrl ){
cgi_query_parameters_to_hidden();
cgi_tag_query_parameter(0);
@ </form>
}
}
zAd = style_adunit_text(&mAdFlags);
if( (mAdFlags & ADUNIT_RIGHT_OK)!=0 ){
@ <div class="content adunit_right_container">
@ <div class="adunit_right">
cgi_append_content(zAd, -1);
@ </div>
}else{
if( zAd ){
@ <div class="adunit_banner">
cgi_append_content(zAd, -1);
@ </div>
}
@ <div class="content">
}
cgi_destination(CGI_BODY);
if( sideboxUsed ){
/* Put the footer at the bottom of the page.
** the additional clear/both is needed to extend the content
** part to the end of an optional sidebox.
*/
@ <div class="endContent"></div>
}
@ </div>
/* Set the href= field on hyperlinks. Do this before the footer since
** the footer will be generating </html> */
style_resolve_href();
zFooter = skin_get("footer");
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
Th_Render(zFooter);
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
/* Render trace log if TH1 tracing is enabled. */
if( g.thTrace ){
cgi_append_content("<span class=\"thTrace\"><hr />\n", -1);
|
| ︙ | ︙ | |||
434 435 436 437 438 439 440 |
/* End the side-box
*/
void style_sidebox_end(void){
@ </div>
}
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
/* End the side-box
*/
void style_sidebox_end(void){
@ </div>
}
/* The following table contains bits of default CSS that must
** be included if they are not found in the application-defined
** CSS.
*/
const struct strctCssDefaults {
const char *elementClass; /* Name of element needed */
const char *comment; /* Comment text */
const char *value; /* CSS text */
} cssDefaultList[] = {
{ "div.sidebox",
"The nomenclature sidebox for branches,..",
@ float: right;
@ background-color: white;
@ border-width: medium;
@ border-style: double;
@ margin: 10px;
|
| ︙ | ︙ | |||
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
"The suppressed duplicates lines in timeline, ..",
@ font-style: italic;
@ font-size: small;
},
{ "table.timelineTable",
"the format for the timeline data table",
@ border: 0;
},
{ "td.timelineTableCell",
"the format for the timeline data cells",
@ vertical-align: top;
@ text-align: left;
},
{ "tr.timelineCurrent td.timelineTableCell",
"the format for the timeline data cell of the current checkout",
@ padding: .1em .2em;
@ border: 1px dashed #446979;
},
{ "span.timelineLeaf",
"the format for the timeline leaf marks",
@ font-weight: bold;
},
{ "a.timelineHistLink",
"the format for the timeline version links",
| > > > > > > > > > > > > | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 |
"The suppressed duplicates lines in timeline, ..",
@ font-style: italic;
@ font-size: small;
},
{ "table.timelineTable",
"the format for the timeline data table",
@ border: 0;
@ border-collapse: collapse;
},
{ "td.timelineTableCell",
"the format for the timeline data cells",
@ vertical-align: top;
@ text-align: left;
},
{ "tr.timelineCurrent td.timelineTableCell",
"the format for the timeline data cell of the current checkout",
@ padding: .1em .2em;
@ border: 1px dashed #446979;
},
{ "tr.timelineSelected",
"The row in the timeline table that contains the entry of interest",
@ padding: .1em .2em;
@ border: 2px solid lightgray;
@ background-color: #ffc;
@ box-shadow: 4px 4px 2px #888;
},
{ "tr.timelineSpacer",
"An extra row inserted to give vertical space between two rows",
@ height: 1ex;
},
{ "span.timelineLeaf",
"the format for the timeline leaf marks",
@ font-weight: bold;
},
{ "a.timelineHistLink",
"the format for the timeline version links",
|
| ︙ | ︙ | |||
770 771 772 773 774 775 776 |
@ border: 0;
},
{ "td.browser",
"format for cells in the file browser",
@ width: 24%;
@ vertical-align: top;
},
| < < < < < < | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
@ border: 0;
},
{ "td.browser",
"format for cells in the file browser",
@ width: 24%;
@ vertical-align: top;
},
{ ".filetree",
"tree-view file browser",
@ margin: 1em 0;
@ line-height: 1.5;
},
{
".filetree > ul",
|
| ︙ | ︙ | |||
833 834 835 836 837 838 839 |
},
{ ".filetree li.last > ul:before",
"hide lines for last-child directories",
@ display: none;
},
{ ".filetree a",
"tree-view links",
| | | | | | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 |
},
{ ".filetree li.last > ul:before",
"hide lines for last-child directories",
@ display: none;
},
{ ".filetree a",
"tree-view links",
" position: relative;\n"
" z-index: 1;\n"
" display: table-cell;\n"
" min-height: 16px;\n"
" padding-left: 21px;\n"
" background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
"\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmg"
"OUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
" background-position: center left;\n"
" background-repeat: no-repeat;\n"
},
{ "ul.browser",
"list of files in the 'flat-view' file browser",
@ list-style-type: none;
@ padding: 10px;
@ margin: 0px;
@ white-space: nowrap;
},
{ "ul.browser li.file",
"List element in the 'flat-view' file browser for a file",
" background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP"
"\\/\\/\\/yEhIf\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfm"
"gOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);\n"
" background-repeat: no-repeat;\n"
" background-position: 0px center;\n"
" padding-left: 20px;\n"
" padding-top: 2px;\n"
},
{ "ul.browser li.dir",
"List element in the 'flat-view file browser for a directory",
" background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
"Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaX"
"po+jUs6b5Z/K4siDu5RPUFADs=);\n"
" background-repeat: no-repeat;\n"
" background-position: 0px center;\n"
" padding-left: 20px;\n"
" padding-top: 2px;\n"
},
{ "div.filetreeline",
"line of a file tree",
@ display: table;
@ width: 100%;
@ white-space: nowrap;
},
{ ".filetree .dir > div.filetreeline > a",
"tree-view directory links",
" background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIi"
"Iv\\/\\/\\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXp"
"o+jUs6b5Z/K4siDu5RPUFADs=);\n"
},
{ "div.filetreeage",
"Last change floating display on the right",
@ display: table-cell;
@ padding-left: 3em;
@ text-align: right;
},
|
| ︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 |
{ ".fileage td:nth-child(2)",
"fileage second column (the filename)",
@ padding-left: 1em;
@ padding-right: 1em;
},
{ ".fileage td:nth-child(3)",
"fileage third column (the check-in comment)",
| < > > > > > > > > > > > > > > > > > > | > > > > > > > > | | > | > > > > > > > | > | | 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 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 |
{ ".fileage td:nth-child(2)",
"fileage second column (the filename)",
@ padding-left: 1em;
@ padding-right: 1em;
},
{ ".fileage td:nth-child(3)",
"fileage third column (the check-in comment)",
@ word-wrap: break-word;
@ max-width: 50%;
},
{ ".brlist table", "The list of branches",
@ border-spacing: 0;
},
{ ".brlist table th", "Branch list table headers",
@ text-align: left;
@ padding: 0px 1em 0.5ex 0px;
},
{ ".brlist table td", "Branch list table headers",
@ padding: 0px 2em 0px 0px;
@ white-space: nowrap;
},
{ "th.sort:after",
"General styles for sortable column marker",
@ margin-left: .4em;
@ cursor: pointer;
@ text-shadow: 0 0 0 #000; /* Makes arrow darker */
},
{ "th.sort.none:after",
"None sort column marker",
@ content: '\2666';
},
{ "th.sort.asc:after",
"Ascending sort column marker",
@ content: '\2193';
},
{ "th.sort.desc:after",
"Descending sort column marker",
@ content: '\2191';
},
{ "span.snippet>mark",
"Search markup",
@ background-color: inherit;
@ font-weight: bold;
},
{ "div.searchForm",
"Container for the search terms entry box",
@ text-align: center;
},
{ "p.searchEmpty",
"Message explaining that there are no search results",
@ font-style: italic;
},
{ 0,
0,
0
}
};
/*
** Append all of the default CSS to the CGI output.
*/
void cgi_append_default_css(void) {
int i;
cgi_printf("%s", builtin_text("skins/default/css.txt"));
for( i=0; cssDefaultList[i].elementClass; i++ ){
if( cssDefaultList[i].elementClass[0] ){
cgi_printf("/* %s */\n%s {\n%s\n}\n\n",
cssDefaultList[i].comment,
cssDefaultList[i].elementClass,
cssDefaultList[i].value
);
}
}
}
/*
** Search string zHaystack for zNeedle. zNeedle must be an isolated
** word with space or punctuation on either size.
**
** Return true if found. Return false if not found
*/
static int containsString(const char *zHaystack, const char *zNeedle){
char *z;
int n;
while( zHaystack[0] ){
z = strstr(zHaystack, zNeedle);
if( z==0 ) return 0;
n = (int)strlen(zNeedle);
if( (z==zHaystack || !fossil_isalnum(z[-1])) && !fossil_isalnum(z[n]) ){
return 1;
}
zHaystack = z + n;
}
return 0;
}
/*
** WEBPAGE: style.css
*/
void page_style_css(void){
Blob css;
int i;
cgi_set_content_type("text/css");
blob_init(&css,skin_get("css"),-1);
/* add special missing definitions */
for(i=1; cssDefaultList[i].elementClass; i++){
char *z = blob_str(&css);
if( !containsString(z, cssDefaultList[i].elementClass) ){
blob_appendf(&css, "/* %s */\n%s {\n%s}\n",
cssDefaultList[i].comment,
cssDefaultList[i].elementClass,
cssDefaultList[i].value);
}
}
|
| ︙ | ︙ | |||
1376 1377 1378 1379 1380 1381 1382 |
"HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED",
"QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD",
"REQUEST_URI", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_PROTOCOL",
};
login_check_credentials();
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
| | | < | < > | > > > > > > > > | 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 |
"HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED",
"QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REQUEST_METHOD",
"REQUEST_URI", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_PROTOCOL",
};
login_check_credentials();
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
login_needed(0);
return;
}
for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
style_header("Environment Test");
showAll = atoi(PD("showall","0"));
if( !showAll ){
style_submenu_element("Show Cookies", 0, "%R/test_env?showall=1");
}else{
style_submenu_element("Hide Cookies", 0, "%R/test_env");
}
#if !defined(_WIN32)
@ uid=%d(getuid()), gid=%d(getgid())<br />
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br />
@ g.zHttpsURL = %h(g.zHttpsURL)<br />
@ g.zTop = %h(g.zTop)<br />
@ g.zPath = %h(g.zPath)<br />
for(i=0, c='a'; c<='z'; c++){
if( login_has_capability(&c, 1, 0) ) zCap[i++] = c;
}
zCap[i] = 0;
@ g.userUid = %d(g.userUid)<br />
@ g.zLogin = %h(g.zLogin)<br />
@ g.isHuman = %d(g.isHuman)<br />
@ capabilities = %s(zCap)<br />
for(i=0, c='a'; c<='z'; c++){
if( login_has_capability(&c, 1, LOGIN_ANON)
&& !login_has_capability(&c, 1, 0) ) zCap[i++] = c;
}
zCap[i] = 0;
if( i>0 ){
@ anonymous-adds = %s(zCap)<br />
}
@ g.zRepositoryName = %h(g.zRepositoryName)<br />
@ load_average() = %f(load_average())<br />
@ <hr>
P("HTTP_USER_AGENT");
cgi_print_all(showAll);
if( showAll && blob_size(&g.httpHeader)>0 ){
@ <hr>
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
267 268 269 270 271 272 273 |
if( rid==0 ){
fossil_fatal("no such object: %s", g.argv[3]);
}
g.markPrivate = content_is_private(rid);
zValue = g.argc==5 ? g.argv[4] : 0;
db_begin_transaction();
tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
| | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
if( rid==0 ){
fossil_fatal("no such object: %s", g.argv[3]);
}
g.markPrivate = content_is_private(rid);
zValue = g.argc==5 ? g.argv[4] : 0;
db_begin_transaction();
tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
db_end_transaction(0);
}
/*
** Add a control record to the repository that either creates
** or cancels a tag.
*/
void tag_add_artifact(
|
| ︙ | ︙ | |||
533 534 535 536 537 538 539 |
return;
tag_cmd_usage:
usage("add|cancel|find|list ...");
}
/*
| | | > | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
return;
tag_cmd_usage:
usage("add|cancel|find|list ...");
}
/*
** WEBPAGE: taglist
*/
void taglist_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){
login_needed(g.anon.Read);
}
login_anonymous_available();
style_header("Tags");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_element("Timeline", "Timeline", "tagtimeline");
@ <h2>Non-propagating tags:</h2>
db_prepare(&q,
"SELECT substr(tagname,5)"
" FROM tag"
" WHERE EXISTS(SELECT 1 FROM tagxref"
" WHERE tagid=tag.tagid"
|
| ︙ | ︙ | |||
577 578 579 580 581 582 583 |
/*
** WEBPAGE: /tagtimeline
*/
void tagtimeline_page(void){
Stmt q;
login_check_credentials();
| | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
/*
** WEBPAGE: /tagtimeline
*/
void tagtimeline_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Tagged Check-ins");
style_submenu_element("List", "List", "taglist");
login_anonymous_available();
@ <h2>Check-ins with non-propagating tags:</h2>
db_prepare(&q,
"%s AND blob.rid IN (SELECT rid FROM tagxref"
" WHERE tagtype=1 AND srcid>0"
" AND tagid IN (SELECT tagid FROM tag "
" WHERE tagname GLOB 'sym-*'))"
" ORDER BY event.mtime DESC",
timeline_query_for_www()
);
www_print_timeline(&q, 0, 0, 0, 0, 0);
db_finalize(&q);
@ <br />
style_footer();
}
|
Changes to src/tar.c.
| ︙ | ︙ | |||
283 284 285 286 287 288 289 | */ static void tar_add_header( const char *zName, /* Name of the object */ int nName, /* Number of characters in zName */ int iMode, /* Mode. 0644 or 0755 */ unsigned int mTime, /* File modification time */ int iSize, /* Size of the object in bytes */ | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
*/
static void tar_add_header(
const char *zName, /* Name of the object */
int nName, /* Number of characters in zName */
int iMode, /* Mode. 0644 or 0755 */
unsigned int mTime, /* File modification time */
int iSize, /* Size of the object in bytes */
char cType /* Type of object:
'0'==file. '2'==symlink. '5'==directory */
){
/* set mode and modification time */
sqlite3_snprintf(8, (char*)&tball.aHdr[100], "%07o", iMode);
sqlite3_snprintf(12, (char*)&tball.aHdr[136], "%011o", mTime);
/* see if we need to output a Pax Interchange Header */
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 |
const char *zName, /* Name of directory including final "/" */
int nName, /* Characters in zName */
unsigned int mTime /* Modification time */
){
int i;
for(i=nName-1; i>0 && zName[i]!='/'; i--){}
if( i<=0 ) return;
| | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
const char *zName, /* Name of directory including final "/" */
int nName, /* Characters in zName */
unsigned int mTime /* Modification time */
){
int i;
for(i=nName-1; i>0 && zName[i]!='/'; i--){}
if( i<=0 ) return;
if( i<tball.nPrevDirAlloc
&& strncmp(tball.zPrevDir, zName, i)==0
&& tball.zPrevDir[i]==0 ) return;
db_multi_exec("INSERT OR IGNORE INTO dir VALUES('%#q')", i, zName);
if( sqlite3_changes(g.db)==0 ) return;
tar_add_directory_of(zName, i-1, mTime);
tar_add_header(zName, i, 0755, mTime, 0, '5');
if( i >= tball.nPrevDirAlloc ){
|
| ︙ | ︙ | |||
375 376 377 378 379 380 381 | int n = blob_size(pContent); int lastPage; char cType = '0'; /* length check moved to tar_split_path */ tar_add_directory_of(zName, nName, mTime); | | | | 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 |
int n = blob_size(pContent);
int lastPage;
char cType = '0';
/* length check moved to tar_split_path */
tar_add_directory_of(zName, nName, mTime);
/*
* If we have a symlink, write its destination path (which is stored in
* pContent) into header, and set content length to 0 to avoid storing path
* as file content in the next step. Since 'linkname' header is limited to
* 100 bytes (-1 byte for terminating zero), if path is greater than that,
* store symlink as a plain-text file. (Not sure how TAR handles long links.)
*/
if( mPerm == PERM_LNK && n <= 100 ){
sqlite3_snprintf(100, (char*)&tball.aHdr[157], "%s", blob_str(pContent));
cType = '2';
n = 0;
}
tar_add_header(zName, nName, ( mPerm==PERM_EXE ) ? 0755 : 0644,
mTime, n, cType);
if( n ){
gzip_step(blob_buffer(pContent), n);
lastPage = n % 512;
if( lastPage!=0 ){
gzip_step(tball.zSpaces, 512 - lastPage);
}
|
| ︙ | ︙ | |||
426 427 428 429 430 431 432 |
**
** Generate a GZIP-compressed tarball in the file given by the first argument
** that contains files given in the second and subsequent arguments.
*/
void test_tarball_cmd(void){
int i;
Blob zip;
| < > | < | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
**
** Generate a GZIP-compressed tarball in the file given by the first argument
** that contains files given in the second and subsequent arguments.
*/
void test_tarball_cmd(void){
int i;
Blob zip;
if( g.argc<3 ){
usage("ARCHIVE FILE....");
}
sqlite3_open(":memory:", &g.db);
tar_begin(-1);
for(i=3; i<g.argc; i++){
Blob file;
blob_zero(&file);
blob_read_from_file(&file, g.argv[i]);
tar_add_file(g.argv[i], &file, file_wd_perm(0), file_wd_mtime(0));
blob_reset(&file);
}
tar_finish(&zip);
blob_write_to_file(&zip, g.argv[2]);
}
/*
|
| ︙ | ︙ | |||
589 590 591 592 593 594 595 | ** Return that tarball as the HTTP reply content. ** ** Optional URL Parameters: ** ** - name=NAME[.tar.gz] is base name of the output file. Defaults to ** something project/version-specific. The prefix of the name, up to ** the last '.', are used as the top-most directory name in the tar | | | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
** Return that tarball as the HTTP reply content.
**
** Optional URL Parameters:
**
** - name=NAME[.tar.gz] is base name of the output file. Defaults to
** something project/version-specific. The prefix of the name, up to
** the last '.', are used as the top-most directory name in the tar
** output.
**
** - uuid=the version to tar (may be a tag/branch name).
** Defaults to "trunk".
**
*/
void tarball_page(void){
int rid;
char *zName, *zRid, *zKey;
int nName, nRid;
Blob tarball;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
load_control();
zName = mprintf("%s", PD("name",""));
nName = strlen(zName);
zRid = mprintf("%s", PD("uuid","trunk"));
nRid = strlen(zRid);
if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
/* Special case: Remove the ".tar.gz" suffix. */
|
| ︙ | ︙ | |||
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
if( P("debug")!=0 ){
style_header("Tarball Generator Debug Screen");
@ zName = "%h(zName)"<br>
@ rid = %d(rid)<br>
@ zKey = "%h(zKey)"
style_footer();
return;
}
blob_zero(&tarball);
if( cache_read(&tarball, zKey)==0 ){
tarball_of_checkin(rid, &tarball, zName);
cache_write(&tarball, zKey);
}
free( zName );
free( zRid );
free( zKey );
cgi_set_content(&tarball);
cgi_set_content_type("application/x-compressed");
}
| > > > > > > > > > > > | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
if( P("debug")!=0 ){
style_header("Tarball Generator Debug Screen");
@ zName = "%h(zName)"<br>
@ rid = %d(rid)<br>
@ zKey = "%h(zKey)"
style_footer();
return;
}
if( referred_from_login() ){
style_header("Tarball Download");
@ <form action='%R/tarball'>
cgi_query_parameters_to_hidden();
@ <p>Tarball named <b>%h(zName).tar.gz</b> holding the content
@ of check-in <b>%h(zRid)</b>:
@ <input type="submit" value="Download" />
@ </form>
style_footer();
return;
}
blob_zero(&tarball);
if( cache_read(&tarball, zKey)==0 ){
tarball_of_checkin(rid, &tarball, zName);
cache_write(&tarball, zKey);
}
free( zName );
free( zRid );
free( zKey );
cgi_set_content(&tarball);
cgi_set_content_type("application/x-compressed");
}
|
Changes to src/th.h.
1 2 | /* This header file defines the external interface to the custom Scripting | | | 1 2 3 4 5 6 7 8 9 10 | /* This header file defines the external interface to the custom Scripting ** Language (TH) interpreter. TH is very similar to Tcl but is not an ** exact clone. */ /* ** Before creating an interpreter, the application must allocate and ** populate an instance of the following structure. It must remain valid ** for the lifetime of the interpreter. |
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
sendText("<hr><p class=\"thmainError\">", -1, 0);
}
sendText("ERROR: ", -1, 0);
sendText((char*)z, n, 1);
sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
enableOutput = savedEnable;
}
/*
** TH1 command: puts STRING
** TH1 command: html STRING
**
** Output STRING escaped for HTML (html) or unchanged (puts).
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
sendText("<hr><p class=\"thmainError\">", -1, 0);
}
sendText("ERROR: ", -1, 0);
sendText((char*)z, n, 1);
sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
enableOutput = savedEnable;
}
/*
** Convert name to an rid. This function was copied from name_to_typed_rid()
** in name.c; however, it has been modified to report TH1 script errors instead
** of "fatal errors".
*/
int th1_name_to_typed_rid(
Th_Interp *interp,
const char *zName,
const char *zType
){
int rid;
if( zName==0 || zName[0]==0 ) return 0;
rid = symbolic_name_to_rid(zName, zType);
if( rid<0 ){
Th_SetResult(interp, "ambiguous name", -1);
}else if( rid==0 ){
Th_SetResult(interp, "name not found", -1);
}
return rid;
}
/*
** Attempt to lookup the specified checkin and file name into an rid.
** This function was copied from artifact_from_ci_and_filename() in
** info.c; however, it has been modified to report TH1 script errors
** instead of "fatal errors".
*/
int th1_artifact_from_ci_and_filename(
Th_Interp *interp,
const char *zCI,
const char *zFilename
){
int cirid;
Blob err;
Manifest *pManifest;
ManifestFile *pFile;
if( zCI==0 ){
Th_SetResult(interp, "invalid check-in", -1);
return 0;
}
if( zFilename==0 ){
Th_SetResult(interp, "invalid file name", -1);
return 0;
}
cirid = th1_name_to_typed_rid(interp, zCI, "*");
blob_zero(&err);
pManifest = manifest_get(cirid, CFTYPE_MANIFEST, &err);
if( pManifest==0 ){
if( blob_size(&err)>0 ){
Th_SetResult(interp, blob_str(&err), blob_size(&err));
}else{
Th_SetResult(interp, "manifest not found", -1);
}
blob_reset(&err);
return 0;
}
blob_reset(&err);
manifest_file_rewind(pManifest);
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
if( fossil_strcmp(zFilename, pFile->zName)==0 ){
int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
manifest_destroy(pManifest);
return rid;
}
}
Th_SetResult(interp, "file name not found in manifest", -1);
return 0;
}
/*
** TH1 command: puts STRING
** TH1 command: html STRING
**
** Output STRING escaped for HTML (html) or unchanged (puts).
*/
|
| ︙ | ︙ | |||
340 341 342 343 344 345 346 347 | Th_SetResult(interp, zOut, -1); free(zOut); return TH_OK; } /* ** TH1 command: hascap STRING... ** | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
Th_SetResult(interp, zOut, -1);
free(zOut);
return TH_OK;
}
/*
** TH1 command: hascap STRING...
** TH1 command: anoncap STRING...
**
** Return true if the current user (hascap) or if the anonymous user
** (anoncap) has all of the capabilities listed in STRING.
*/
static int hascapCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0, i;
if( argc<2 ){
return Th_WrongNumArgs(interp, "hascap STRING ...");
}
for(i=1; i<argc && rc==0; i++){
rc = login_has_capability((char*)argv[i],argl[i],*(int*)p);
}
if( g.thTrace ){
Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
}
Th_SetResultInt(interp, rc);
return TH_OK;
}
/*
** TH1 command: searchable STRING...
**
** Return true if searching in any of the document classes identified
** by STRING is enabled for the repository and user has the necessary
** capabilities to perform the search.
**
** Document classes:
**
** c Check-in comments
** d Embedded documentation
** t Tickets
** w Wiki
**
** To be clear, only one of the document classes identified by each STRING
** needs to be searchable in order for that argument to be true. But
** all arguments must be true for this routine to return true. Hence, to
** see if ALL document classes are searchable:
**
** if {[searchable c d t w]} {...}
**
** But to see if ANY document class is searchable:
**
** if {[searchable cdtw]} {...}
**
** This command is useful for enabling or disabling a "Search" entry
** on the menu bar.
*/
static int searchableCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 1, i, j;
unsigned int searchCap = search_restrict(SRCH_ALL);
if( argc<2 ){
return Th_WrongNumArgs(interp, "hascap STRING ...");
}
for(i=1; i<argc && rc; i++){
int match = 0;
for(j=0; j<argl[i]; j++){
switch( argv[i][j] ){
case 'c': match |= searchCap & SRCH_CKIN; break;
case 'd': match |= searchCap & SRCH_DOC; break;
case 't': match |= searchCap & SRCH_TKT; break;
case 'w': match |= searchCap & SRCH_WIKI; break;
}
}
if( !match ) rc = 0;
}
if( g.thTrace ){
Th_Trace("[searchable %#h] => %d<br />\n", argl[1], argv[1], rc);
}
Th_SetResultInt(interp, rc);
return TH_OK;
}
/*
** TH1 command: hasfeature STRING
**
|
| ︙ | ︙ | |||
389 390 391 392 393 394 395 |
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0;
| | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0;
const char *zArg;
if( argc!=2 ){
return Th_WrongNumArgs(interp, "hasfeature STRING");
}
zArg = (const char *)argv[1];
if(NULL==zArg){
/* placeholder for following ifdefs... */
}
#if defined(FOSSIL_ENABLE_SSL)
else if( 0 == fossil_strnicmp( zArg, "ssl\0", 4 ) ){
rc = 1;
}
|
| ︙ | ︙ | |||
482 483 484 485 486 487 488 | return TH_OK; } /* ** TH1 command: anycap STRING ** | > | | | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
return TH_OK;
}
/*
** TH1 command: anycap STRING
**
** Return true if the current user user
** has any one of the capabilities listed in STRING.
*/
static int anycapCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
int rc = 0;
int i;
if( argc!=2 ){
return Th_WrongNumArgs(interp, "anycap STRING");
}
for(i=0; rc==0 && i<argl[1]; i++){
rc = login_has_capability((char*)&argv[1][i],1,0);
}
if( g.thTrace ){
Th_Trace("[hascap %#h] => %d<br />\n", argl[1], argv[1], rc);
}
Th_SetResultInt(interp, rc);
return TH_OK;
}
|
| ︙ | ︙ | |||
917 918 919 920 921 922 923 |
if( argc!=2 && argc!=3 ){
return Th_WrongNumArgs(interp, "artifact ID ?FILENAME?");
}
if( Th_IsRepositoryOpen() ){
int rid;
Blob content;
if( argc==3 ){
| | | < | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
if( argc!=2 && argc!=3 ){
return Th_WrongNumArgs(interp, "artifact ID ?FILENAME?");
}
if( Th_IsRepositoryOpen() ){
int rid;
Blob content;
if( argc==3 ){
rid = th1_artifact_from_ci_and_filename(interp, argv[1], argv[2]);
}else{
rid = th1_name_to_typed_rid(interp, argv[1], "*");
}
if( rid!=0 && content_get(rid, &content) ){
Th_SetResult(interp, blob_str(&content), blob_size(&content));
blob_reset(&content);
return TH_OK;
}else{
return TH_ERROR;
}
}else{
Th_SetResult(interp, "repository unavailable", -1);
return TH_ERROR;
}
}
|
| ︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 |
void Th_FossilInit(u32 flags){
int wasInit = 0;
int needConfig = flags & TH_INIT_NEED_CONFIG;
int forceReset = flags & TH_INIT_FORCE_RESET;
int forceTcl = flags & TH_INIT_FORCE_TCL;
int forceSetup = flags & TH_INIT_FORCE_SETUP;
static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
static struct _Command {
const char *zName;
Th_CommandProc xProc;
void *pContext;
} aCommand[] = {
{"anycap", anycapCmd, 0},
{"artifact", artifactCmd, 0},
{"checkout", checkoutCmd, 0},
{"combobox", comboboxCmd, 0},
{"date", dateCmd, 0},
{"decorate", wikiCmd, (void*)&aFlags[2]},
{"enable_output", enableOutputCmd, 0},
{"getParameter", getParameterCmd, 0},
{"globalState", globalStateCmd, 0},
{"httpize", httpizeCmd, 0},
| > > > | > | 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 |
void Th_FossilInit(u32 flags){
int wasInit = 0;
int needConfig = flags & TH_INIT_NEED_CONFIG;
int forceReset = flags & TH_INIT_FORCE_RESET;
int forceTcl = flags & TH_INIT_FORCE_TCL;
int forceSetup = flags & TH_INIT_FORCE_SETUP;
static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
static int anonFlag = LOGIN_ANON;
static int zeroInt = 0;
static struct _Command {
const char *zName;
Th_CommandProc xProc;
void *pContext;
} aCommand[] = {
{"anoncap", hascapCmd, (void*)&anonFlag},
{"anycap", anycapCmd, 0},
{"artifact", artifactCmd, 0},
{"checkout", checkoutCmd, 0},
{"combobox", comboboxCmd, 0},
{"date", dateCmd, 0},
{"decorate", wikiCmd, (void*)&aFlags[2]},
{"enable_output", enableOutputCmd, 0},
{"getParameter", getParameterCmd, 0},
{"globalState", globalStateCmd, 0},
{"httpize", httpizeCmd, 0},
{"hascap", hascapCmd, (void*)&zeroInt},
{"hasfeature", hasfeatureCmd, 0},
{"html", putsCmd, (void*)&aFlags[0]},
{"htmlize", htmlizeCmd, 0},
{"http", httpCmd, 0},
{"linecount", linecntCmd, 0},
{"puts", putsCmd, (void*)&aFlags[1]},
{"query", queryCmd, 0},
{"randhex", randhexCmd, 0},
{"regexp", regexpCmd, 0},
{"reinitialize", reinitializeCmd, 0},
{"render", renderCmd, 0},
{"repository", repositoryCmd, 0},
{"searchable", searchableCmd, 0},
{"setParameter", setParameterCmd, 0},
{"setting", settingCmd, 0},
{"styleHeader", styleHeaderCmd, 0},
{"styleFooter", styleFooterCmd, 0},
{"tclReady", tclReadyCmd, 0},
{"trace", traceCmd, 0},
{"stime", stimeCmd, 0},
|
| ︙ | ︙ | |||
1890 1891 1892 1893 1894 1895 1896 1897 1898 |
sendText(z, i, 0);
}
return rc;
}
/*
** COMMAND: test-th-render
*/
void test_th_render(void){
| > > > > > > > > > > > > | | | > | > > > > > > > > > > > > | | > | | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 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 2095 2096 2097 2098 |
sendText(z, i, 0);
}
return rc;
}
/*
** COMMAND: test-th-render
**
** Usage: %fossil test-th-render FILE
**
** Read the content of the file named "FILE" as if it were a header or
** footer or ticket rendering script, evaluate it, and show the results
** on standard output.
**
** Options:
**
** --cgi Include a CGI response header in the output
** --http Include an HTTP response header in the output
** --open-config Open the configuration database
*/
void test_th_render(void){
int forceCgi = 0, fullHttpReply = 0;
Blob in;
Th_InitTraceLog();
forceCgi = find_option("cgi", 0, 0)!=0;
fullHttpReply = find_option("http", 0, 0)!=0;
if( fullHttpReply ) forceCgi = 1;
if( forceCgi ) Th_ForceCgi(fullHttpReply);
if( find_option("open-config", 0, 0)!=0 ){
Th_OpenConfig(1);
}
verify_all_options();
if( g.argc<3 ){
usage("FILE");
}
blob_zero(&in);
blob_read_from_file(&in, g.argv[2]);
Th_Render(blob_str(&in));
Th_PrintTraceLog();
if( forceCgi ) cgi_reply();
}
/*
** COMMAND: test-th-eval
**
** Usage: %fossil test-th-eval SCRIPT
**
** Evaluate SCRIPT as if it were a header or footer or ticket rendering
** script, evaluate it, and show the results on standard output.
**
** Options:
**
** --cgi Include a CGI response header in the output
** --http Include an HTTP response header in the output
** --open-config Open the configuration database
*/
void test_th_eval(void){
int rc;
const char *zRc;
int forceCgi, fullHttpReply;
Th_InitTraceLog();
forceCgi = find_option("cgi", 0, 0)!=0;
fullHttpReply = find_option("http", 0, 0)!=0;
if( fullHttpReply ) forceCgi = 1;
if( forceCgi ) Th_ForceCgi(fullHttpReply);
if( find_option("open-config", 0, 0)!=0 ){
Th_OpenConfig(1);
}
if( g.argc!=3 ){
usage("script");
}
Th_FossilInit(TH_INIT_DEFAULT);
rc = Th_Eval(g.interp, 0, g.argv[2], -1);
|
| ︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 |
*/
void test_th_hook(void){
int rc = TH_OK;
int nResult = 0;
char *zResult;
int forceCgi, fullHttpReply;
Th_InitTraceLog();
| | | > | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 |
*/
void test_th_hook(void){
int rc = TH_OK;
int nResult = 0;
char *zResult;
int forceCgi, fullHttpReply;
Th_InitTraceLog();
forceCgi = find_option("cgi", 0, 0)!=0;
fullHttpReply = find_option("http", 0, 0)!=0;
if( fullHttpReply ) forceCgi = 1;
if( forceCgi ) Th_ForceCgi(fullHttpReply);
if( g.argc<5 ){
usage("TYPE NAME FLAGS");
}
if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){
rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4]));
}else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
**
*/
#include "config.h"
#include <string.h>
#include <time.h>
#include "timeline.h"
/*
** Add an appropriate tag to the output if "rid" is unpublished (private)
*/
#define UNPUB_TAG "<em>(unpublished)</em>"
void tag_private_status(int rid){
if( content_is_private(rid) ){
cgi_printf("%s", UNPUB_TAG);
}
}
/*
** Generate a hyperlink to a version.
*/
void hyperlink_to_uuid(const char *zUuid){
if( g.perm.Hyperlink ){
| > > > > > | | 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 |
**
*/
#include "config.h"
#include <string.h>
#include <time.h>
#include "timeline.h"
/*
** The value of one second in julianday notation
*/
#define ONE_SECOND (1.0/86400.0)
/*
** Add an appropriate tag to the output if "rid" is unpublished (private)
*/
#define UNPUB_TAG "<em>(unpublished)</em>"
void tag_private_status(int rid){
if( content_is_private(rid) ){
cgi_printf("%s", UNPUB_TAG);
}
}
/*
** Generate a hyperlink to a version.
*/
void hyperlink_to_uuid(const char *zUuid){
if( g.perm.Hyperlink ){
@ %z(xhref("class='timelineHistLink'","%R/info/%!S",zUuid))[%S(zUuid)]</a>
}else{
@ <span class="timelineHistDsp">[%S(zUuid)]</span>
}
}
/*
** Generate a hyperlink to a date & time.
|
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
** testing the hash_color() function.
*/
void test_hash_color_page(void){
const char *zBr;
char zNm[10];
int i, cnt;
login_check_credentials();
| | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
** testing the hash_color() function.
*/
void test_hash_color_page(void){
const char *zBr;
char zNm[10];
int i, cnt;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Hash Color Test");
for(i=cnt=0; i<10; i++){
sqlite3_snprintf(sizeof(zNm),zNm,"b%d",i);
zBr = P(zNm);
if( zBr && zBr[0] ){
@ <p style='border:1px solid;background-color:%s(hash_color(zBr));'>
|
| ︙ | ︙ | |||
207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
** 10. Short comment to user for repeated tickets and wiki
*/
void www_print_timeline(
Stmt *pQuery, /* Query to implement the timeline */
int tmFlags, /* Flags controlling display behavior */
const char *zThisUser, /* Suppress links to this user */
const char *zThisTag, /* Suppress links to this tag */
void (*xExtra)(int) /* Routine to call on each line of display */
){
int mxWikiLen;
Blob comment;
int prevTagid = 0;
int suppressCnt = 0;
char zPrevDate[20];
| > | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
** 10. Short comment to user for repeated tickets and wiki
*/
void www_print_timeline(
Stmt *pQuery, /* Query to implement the timeline */
int tmFlags, /* Flags controlling display behavior */
const char *zThisUser, /* Suppress links to this user */
const char *zThisTag, /* Suppress links to this tag */
int selectedRid, /* Highlight the line with this RID value */
void (*xExtra)(int) /* Routine to call on each line of display */
){
int mxWikiLen;
Blob comment;
int prevTagid = 0;
int suppressCnt = 0;
char zPrevDate[20];
|
| ︙ | ︙ | |||
287 288 289 290 291 292 293 294 295 296 297 |
if( suppressCnt ){
@ <span class="timelineDisabled">... %d(suppressCnt) similar
@ event%s(suppressCnt>1?"s":"") omitted.</span>
suppressCnt = 0;
}
if( pendingEndTr ){
@ </td></tr>
pendingEndTr = 0;
}
if( fossil_strcmp(zType,"div")==0 ){
if( !prevWasDivider ){
| > > > | | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
if( suppressCnt ){
@ <span class="timelineDisabled">... %d(suppressCnt) similar
@ event%s(suppressCnt>1?"s":"") omitted.</span>
suppressCnt = 0;
}
if( pendingEndTr ){
@ </td></tr>
if( pendingEndTr>1 ){
@ <tr class="timelineSpacer"></tr>
}
pendingEndTr = 0;
}
if( fossil_strcmp(zType,"div")==0 ){
if( !prevWasDivider ){
@ <tr><td colspan="3"><hr class="timelineMarker"/></td></tr>
}
prevWasDivider = 1;
continue;
}
prevWasDivider = 0;
/* Date format codes:
** (0) HH:MM
|
| ︙ | ︙ | |||
330 331 332 333 334 335 336 |
zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
zTime[pos++] = ':';
zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
zTime[pos++] = 0;
}else{
zTime[0] = 0;
}
| > > > > > | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
zTime[pos++] = ':';
zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
zTime[pos++] = 0;
}else{
zTime[0] = 0;
}
pendingEndTr = 1;
if( rid==selectedRid ){
@ <tr class="timelineSpacer"></tr>
@ <tr class="timelineSelected">
pendingEndTr = 2;
}else if( rid==vid ){
@ <tr class="timelineCurrent">
}else {
@ <tr>
}
@ <td class="timelineTime">%s(zTime)</td>
@ <td class="timelineGraph">
if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hash_color(zUser) : 0;
|
| ︙ | ︙ | |||
358 359 360 361 362 363 364 |
}else{
zBgClr = hash_color(zBr);
}
}
}
if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){
int nParent = 0;
| | | | | 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 |
}else{
zBgClr = hash_color(zBr);
}
}
}
if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){
int nParent = 0;
int aParent[GR_MAX_RAIL];
int gidx;
static Stmt qparent;
db_static_prepare(&qparent,
"SELECT pid FROM plink"
" WHERE cid=:rid AND pid NOT IN phantom"
" ORDER BY isprim DESC /*sort*/"
);
db_bind_int(&qparent, ":rid", rid);
while( db_step(&qparent)==SQLITE_ROW && nParent<ArraySize(aParent) ){
aParent[nParent++] = db_column_int(&qparent, 0);
}
db_reset(&qparent);
gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
zUuid, isLeaf);
db_reset(&qbranch);
@ <div id="m%d(gidx)"></div>
}
@</td>
if( zBgClr && zBgClr[0] && rid!=selectedRid ){
@ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
}else{
@ <td class="timelineTableCell">
}
if( pGraph && zType[0]!='c' ){
@ •
}
|
| ︙ | ︙ | |||
437 438 439 440 441 442 443 |
@ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051")
}else{
@ (user: %h(zDispUser)%s(zTagList?",":"\051")
}
/* Generate a "detail" link for tags. */
if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
| | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
@ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051")
}else{
@ (user: %h(zDispUser)%s(zTagList?",":"\051")
}
/* Generate a "detail" link for tags. */
if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
@ [%z(href("%R/info/%!S",zUuid))details</a>]
}
/* Generate the "tags: TAGLIST" at the end of the comment, together
** with hyperlinks to the tag list.
*/
if( zTagList ){
if( g.perm.Hyperlink ){
|
| ︙ | ︙ | |||
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
" (SELECT uuid FROM blob WHERE rid=fid),"
" (SELECT uuid FROM blob WHERE rid=pid),"
" (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm"
" FROM mlink"
" WHERE mid=:mid AND (pid!=fid OR pfnid>0)"
" AND (fid>0 OR"
" fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=:mid))"
" ORDER BY 3 /*sort*/"
);
fchngQueryInit = 1;
}
db_bind_int(&fchngQuery, ":mid", rid);
while( db_step(&fchngQuery)==SQLITE_ROW ){
const char *zFilename = db_column_text(&fchngQuery, 2);
int isNew = db_column_int(&fchngQuery, 0);
int fid = db_column_int(&fchngQuery, 1);
int isDel = fid==0;
const char *zOldName = db_column_text(&fchngQuery, 5);
const char *zOld = db_column_text(&fchngQuery, 4);
const char *zNew = db_column_text(&fchngQuery, 3);
| > | > > > > > > > | > | | | | | | | | | > < | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
" (SELECT uuid FROM blob WHERE rid=fid),"
" (SELECT uuid FROM blob WHERE rid=pid),"
" (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm"
" FROM mlink"
" WHERE mid=:mid AND (pid!=fid OR pfnid>0)"
" AND (fid>0 OR"
" fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=:mid))"
" AND NOT mlink.isaux"
" ORDER BY 3 /*sort*/"
);
fchngQueryInit = 1;
}
db_bind_int(&fchngQuery, ":mid", rid);
while( db_step(&fchngQuery)==SQLITE_ROW ){
const char *zFilename = db_column_text(&fchngQuery, 2);
int isNew = db_column_int(&fchngQuery, 0);
int fid = db_column_int(&fchngQuery, 1);
int isDel = fid==0;
const char *zOldName = db_column_text(&fchngQuery, 5);
const char *zOld = db_column_text(&fchngQuery, 4);
const char *zNew = db_column_text(&fchngQuery, 3);
const char *zUnpub = "";
char *zA;
char zId[20];
if( !inUl ){
@ <ul class="filelist">
inUl = 1;
}
if( tmFlags & TIMELINE_SHOWRID ){
sqlite3_snprintf(sizeof(zId), zId, " (%d) ", fid);
}else{
zId[0] = 0;
}
if( (tmFlags & TIMELINE_FRENAMES)!=0 ){
if( !isNew && !isDel && zOldName!=0 ){
@ <li> %h(zOldName) → %h(zFilename)%s(zId)
}
continue;
}
zA = href("%R/artifact/%!S",fid?zNew:zOld);
if( content_is_private(fid) ){
zUnpub = UNPUB_TAG;
}
if( isNew ){
@ <li> %s(zA)%h(zFilename)</a>%s(zId) %s(zUnpub) (new file)
@ %z(href("%R/artifact/%!S",zNew))[view]</a></li>
}else if( isDel ){
@ <li> %s(zA)%h(zFilename)</a> (deleted)</li>
}else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
@ <li> %h(zOldName) → %s(zA)%h(zFilename)</a>%s(zId)
@ %s(zUnpub) %z(href("%R/artifact/%!S",zNew))[view]</a></li>
}else{
if( zOldName!=0 ){
@ <li>%h(zOldName) → %s(zA)%h(zFilename)%s(zId)</a> %s(zUnpub)
}else{
@ <li>%s(zA)%h(zFilename)</a>%s(zId) %s(zUnpub)
}
@ %z(href("%R/fdiff?sbs=1&v1=%!S&v2=%!S",zOld,zNew))[diff]</a></li>
}
fossil_free(zA);
}
db_reset(&fchngQuery);
if( inUl ){
@ </ul>
}
}
}
if( suppressCnt ){
@ <span class="timelineDisabled">... %d(suppressCnt) similar
@ event%s(suppressCnt>1?"s":"") omitted.</span>
suppressCnt = 0;
}
if( pendingEndTr ){
|
| ︙ | ︙ | |||
664 665 666 667 668 669 670 |
}
}
if( cSep=='[' ) cgi_printf("[");
cgi_printf("],h:\"%s\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "];\n");
}
cgi_printf("var nrail = %d\n", pGraph->mxRail+1);
graph_free(pGraph);
| | | | | | | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
}
}
if( cSep=='[' ) cgi_printf("[");
cgi_printf("],h:\"%s\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "];\n");
}
cgi_printf("var nrail = %d\n", pGraph->mxRail+1);
graph_free(pGraph);
@ var cDiv = gebi("canvas");
@ var csty = window.getComputedStyle && window.getComputedStyle(cDiv,null);
@ var lineClr = (csty && csty.getPropertyValue('color')) || 'black';
@ var bgClr = (csty && csty.getPropertyValue('background-color')) ||'white';
@ if( bgClr=='transparent' ) bgClr = 'white';
@ var boxColor = lineClr;
@ function drawBox(color,x0,y0,x1,y1){
@ var n = document.createElement("div");
@ if( x0>x1 ){ var t=x0; x0=x1; x1=t; }
@ if( y0>y1 ){ var t=y0; y0=y1; y1=t; }
@ var w = x1-x0+1;
@ var h = y1-y0+1;
@ n.style.position = "absolute";
@ n.style.overflow = "hidden";
@ n.style.left = x0+"px";
@ n.style.top = y0+"px";
@ n.style.width = w+"px";
@ n.style.height = h+"px";
@ n.style.backgroundColor = color;
@ cDiv.appendChild(n);
@ return n;
@ }
@ function absoluteY(id){
@ var obj = gebi(id);
@ if( !obj ) return;
@ var top = 0;
@ if( obj.offsetParent ){
|
| ︙ | ︙ | |||
709 710 711 712 713 714 715 |
@ do{
@ left += obj.offsetLeft;
@ }while( obj = obj.offsetParent );
@ }
@ return left;
@ }
@ function drawUpArrow(x,y0,y1){
| | | | | | | | | | | | | | | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
@ do{
@ left += obj.offsetLeft;
@ }while( obj = obj.offsetParent );
@ }
@ return left;
@ }
@ function drawUpArrow(x,y0,y1){
@ drawBox(lineClr,x,y0,x+1,y1);
@ if( y0+10>=y1 ){
@ drawBox(lineClr,x-1,y0+1,x+2,y0+2);
@ drawBox(lineClr,x-2,y0+3,x+3,y0+4);
@ }else{
@ drawBox(lineClr,x-1,y0+2,x+2,y0+4);
@ drawBox(lineClr,x-2,y0+5,x+3,y0+7);
@ }
@ }
@ function drawThinArrow(y,xFrom,xTo){
@ if( xFrom<xTo ){
@ drawBox(lineClr,xFrom,y,xTo,y);
@ drawBox(lineClr,xTo-3,y-1,xTo-2,y+1);
@ drawBox(lineClr,xTo-4,y-2,xTo-4,y+2);
@ }else{
@ drawBox(lineClr,xTo,y,xFrom,y);
@ drawBox(lineClr,xTo+2,y-1,xTo+3,y+1);
@ drawBox(lineClr,xTo+4,y-2,xTo+4,y+2);
@ }
@ }
@ function drawThinLine(x0,y0,x1,y1){
@ drawBox(lineClr,x0,y0,x1,y1);
@ }
@ function drawNodeBox(color,x0,y0,x1,y1){
@ drawBox(color,x0,y0,x1,y1).style.cursor = "pointer";
@ }
@ function drawNode(p, left, btm){
@ drawNodeBox(boxColor,p.x-5,p.y-5,p.x+6,p.y+6);
@ drawNodeBox(p.bg||bgClr,p.x-4,p.y-4,p.x+5,p.y+5);
@ if( p.u>0 ) drawUpArrow(p.x, rowinfo[p.u-1].y+6, p.y-5);
@ if( p.f&1 ) drawNodeBox(boxColor,p.x-1,p.y-1,p.x+2,p.y+2);
if( !omitDescenders ){
@ if( p.u==0 ) drawUpArrow(p.x, 0, p.y-5);
@ if( p.d ) drawUpArrow(p.x, p.y+6, btm);
}
@ if( p.mo>0 ){
|
| ︙ | ︙ | |||
763 764 765 766 767 768 769 |
@ }
@ var n = p.au.length;
@ for(var i=0; i<n; i+=2){
@ var x1 = p.au[i]*railPitch + left;
@ var x0 = x1>p.x ? p.x+7 : p.x-6;
@ var u = rowinfo[p.au[i+1]-1];
@ if(u.id<p.id){
| | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
@ }
@ var n = p.au.length;
@ for(var i=0; i<n; i+=2){
@ var x1 = p.au[i]*railPitch + left;
@ var x0 = x1>p.x ? p.x+7 : p.x-6;
@ var u = rowinfo[p.au[i+1]-1];
@ if(u.id<p.id){
@ drawBox(lineClr,x0,p.y,x1,p.y+1);
@ drawUpArrow(x1, u.y+6, p.y);
@ }else{
@ drawBox("#600000",x0,p.y,x1,p.y+1);
@ drawBox("#600000",x1-1,p.y,x1,u.y+1);
@ drawBox("#600000",x1,u.y,u.x-6,u.y+1);
@ drawBox("#600000",u.x-9,u.y-1,u.x-8,u.y+2);
@ drawBox("#600000",u.x-11,u.y-2,u.x-10,u.y+3);
|
| ︙ | ︙ | |||
950 951 952 953 954 955 956 |
double mtime;
int rid;
if( z==0 ) return -1.0;
if( fossil_isdate(z) ){
mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z);
if( mtime>0.0 ) return mtime;
}
| | | | > | > > > > > > | > | < < < < | < < | < < < < | | < < > | < | | | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 |
double mtime;
int rid;
if( z==0 ) return -1.0;
if( fossil_isdate(z) ){
mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z);
if( mtime>0.0 ) return mtime;
}
rid = symbolic_name_to_rid(z, "*");
if( rid ){
mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
}else{
mtime = db_double(-1.0,
"SELECT max(event.mtime) FROM event, tag, tagxref"
" WHERE tag.tagname GLOB 'event-%q*'"
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype"
" AND event.objid=tagxref.rid",
z
);
}
return mtime;
}
/*
** zDate is a localtime date. Insert records into the
** "timeline" table to cause <hr> to be inserted on zDate.
*/
static int timeline_add_divider(double rDate){
int rid = db_int(-1,
"SELECT rid FROM timeline ORDER BY abs(sortby-%.16g) LIMIT 1", rDate
);
if( rid>0 ) return rid;
db_multi_exec(
"INSERT INTO timeline(rid,sortby,etype) VALUES(-1,%.16g,'div')",
rDate
);
return -1;
}
/*
** Return all possible names for file zUuid.
*/
char *names_of_file(const char *zUuid){
Stmt q;
|
| ︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 |
href("%R/finfo?name=%t", zFN), zFN);
zSep = " or ";
}
db_finalize(&q);
return blob_str(&out);
}
/*
** WEBPAGE: timeline
**
** Query parameters:
**
** a=TIMEORTAG after this event
** b=TIMEORTAG before this event
** c=TIMEORTAG "circa" this event
** n=COUNT max number of events in output
** p=UUID artifact and up to COUNT parents and ancestors
** d=UUID artifact and up to COUNT descendants
** dp=UUID The same as d=UUID&p=UUID
** t=TAGID show only check-ins with the given tagid
** r=TAGID show check-ins related to tagid
** u=USER only if belonging to this user
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 |
href("%R/finfo?name=%t", zFN), zFN);
zSep = " or ";
}
db_finalize(&q);
return blob_str(&out);
}
/*
** Add the select/option box to the timeline submenu that is used to
** set the y= parameter that determines which elements to display
** on the timeline.
*/
static void timeline_y_submenu(int isDisabled){
static int i = 0;
static const char *az[12];
if( i==0 ){
az[0] = "all";
az[1] = "Any Type";
i = 2;
if( g.perm.Read ){
az[i++] = "ci";
az[i++] = "Check-ins";
az[i++] = "g";
az[i++] = "Tags";
}
if( g.perm.RdWiki ){
az[i++] = "e";
az[i++] = "Tech Notes";
}
if( g.perm.RdTkt ){
az[i++] = "t";
az[i++] = "Tickets";
}
if( g.perm.RdWiki ){
az[i++] = "w";
az[i++] = "Wiki";
}
assert( i<=ArraySize(az) );
}
if( i>2 ){
style_submenu_multichoice("y", i/2, az, isDisabled);
}
}
/*
** WEBPAGE: timeline
**
** Query parameters:
**
** a=TIMEORTAG after this event
** b=TIMEORTAG before this event
** c=TIMEORTAG "circa" this event
** m=TIMEORTAG mark this event
** n=COUNT max number of events in output
** p=UUID artifact and up to COUNT parents and ancestors
** d=UUID artifact and up to COUNT descendants
** dp=UUID The same as d=UUID&p=UUID
** t=TAGID show only check-ins with the given tagid
** r=TAGID show check-ins related to tagid
** u=USER only if belonging to this user
|
| ︙ | ︙ | |||
1044 1045 1046 1047 1048 1049 1050 | ** namechng Show only checkins that filename changes ** ym=YYYY-MM Shown only events for the given year/month. ** datefmt=N Override the date format ** ** p= and d= can appear individually or together. If either p= or d= ** appear, then u=, y=, a=, and b= are ignored. ** | | < | > | > | > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | < > < | < | < | < | < < > > | < | < | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
** namechng Show only checkins that filename changes
** ym=YYYY-MM Shown only events for the given year/month.
** datefmt=N Override the date format
**
** p= and d= can appear individually or together. If either p= or d=
** appear, then u=, y=, a=, and b= are ignored.
**
** If both a= and b= appear then both upper and lower bounds are honored.
**
** If n= is missing, the default count is 50 for most queries but
** drops to 11 for c= queries.
*/
void page_timeline(void){
Stmt q; /* Query used to generate the timeline */
Blob sql; /* text of SQL used to generate timeline */
Blob desc; /* Description of the timeline */
int nEntry; /* Max number of entries on timeline */
int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */
int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */
int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */
const char *zUser = P("u"); /* All entries by this user if not NULL */
const char *zType = PD("y","all"); /* Type of events. All if NULL */
const char *zAfter = P("a"); /* Events after this time */
const char *zBefore = P("b"); /* Events before this time */
const char *zCirca = P("c"); /* Events near this time */
const char *zMark = P("m"); /* Mark this event or an event this time */
const char *zTagName = P("t"); /* Show events with this tag */
const char *zBrName = P("r"); /* Show events related to this tag */
const char *zSearch = P("s"); /* Search string */
const char *zUses = P("uf"); /* Only show checkins hold this file */
const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */
const char *zYearWeek = P("yw"); /* Checkins for YYYY-WW (week-of-year) */
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */
int tagid; /* Tag ID */
int tmFlags = 0; /* Timeline flags */
const char *zThisTag = 0; /* Suppress links to this tag */
const char *zThisUser = 0; /* Suppress links to this user */
HQuery url; /* URL for various branch links */
int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
int to_rid = name_to_typed_rid(P("to"),"ci"); /* to= for path timelines */
int noMerge = P("shortest")==0; /* Follow merge links if shorter */
int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
int pd_rid;
double rBefore, rAfter, rCirca; /* Boundary times */
const char *z;
char *zOlderButton = 0; /* URL for Older button at the bottom */
int selectedRid = -9999999; /* Show a highlight on this RID */
int disableY = 0; /* Disable type selector on submenu */
/* Set number of rows to display */
z = P("n");
if( z ){
if( fossil_strcmp(z,"all")==0 ){
nEntry = 0;
}else{
nEntry = atoi(z);
if( nEntry<=0 ){
cgi_replace_query_parameter("n","10");
nEntry = 10;
}
}
}else if( zCirca ){
cgi_replace_query_parameter("n","11");
nEntry = 11;
}else{
cgi_replace_query_parameter("n","50");
nEntry = 50;
}
/* To view the timeline, must have permission to read project data.
*/
pd_rid = name_to_typed_rid(P("dp"),"ci");
if( pd_rid ){
p_rid = d_rid = pd_rid;
}
login_check_credentials();
if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
return;
}
url_initialize(&url, "timeline");
cgi_query_parameters_to_url(&url);
if( zTagName && g.perm.Read ){
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
zThisTag = zTagName;
}else if( zBrName && g.perm.Read ){
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
zThisTag = zBrName;
}else{
tagid = 0;
}
if( zMark && zMark[0]==0 ){
if( zAfter ) zMark = zAfter;
if( zBefore ) zMark = zBefore;
if( zCirca ) zMark = zCirca;
}
if( tagid>0
&& db_int(0,"SELECT count(*) FROM tagxref WHERE tagid=%d",tagid)<=nEntry
){
nEntry = -1;
zCirca = 0;
}
if( zType[0]=='a' ){
tmFlags |= TIMELINE_BRIEF | TIMELINE_GRAPH;
}else{
tmFlags |= TIMELINE_GRAPH;
}
if( PB("ng") || zSearch!=0 ){
tmFlags &= ~TIMELINE_GRAPH;
}
if( PB("brbg") ){
tmFlags |= TIMELINE_BRCOLOR;
}
if( PB("unhide") ){
tmFlags |= TIMELINE_UNHIDE;
}
if( PB("ubg") ){
tmFlags |= TIMELINE_UCOLOR;
}
if( zUses!=0 ){
int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
if( ufid ){
zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
compute_uses_file("usesfile", ufid, 0);
zType = "ci";
disableY = 1;
}else{
zUses = 0;
}
}
if( renameOnly ){
db_multi_exec(
"CREATE TEMP TABLE rnfile(rid INTEGER PRIMARY KEY);"
"INSERT OR IGNORE INTO rnfile"
" SELECT mid FROM mlink WHERE pfnid>0 AND pfnid!=fnid;"
);
disableY = 1;
}
style_header("Timeline");
login_anonymous_available();
timeline_temp_table();
blob_zero(&sql);
blob_zero(&desc);
blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1);
blob_append(&sql, timeline_query_for_www(), -1);
if( PB("fc") || PB("v") || PB("detail") ){
tmFlags |= TIMELINE_FCHANGES;
}
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
blob_append_sql(&sql,
" AND NOT EXISTS(SELECT 1 FROM tagxref"
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
TAG_HIDDEN
);
}
if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
/* If from= and to= are present, display all nodes on a path connecting
** the two */
PathNode *p = 0;
const char *zFrom = 0;
const char *zTo = 0;
|
| ︙ | ︙ | |||
1224 1225 1226 1227 1228 1229 1230 |
blob_append_sql(&sql, " AND event.objid IN ok");
nd = 0;
if( d_rid ){
compute_descendants(d_rid, nEntry+1);
nd = db_int(0, "SELECT count(*)-1 FROM ok");
if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
| | | | < < < < < < < < < < < | < | < < | < > | | < < | < < < > | 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 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 |
blob_append_sql(&sql, " AND event.objid IN ok");
nd = 0;
if( d_rid ){
compute_descendants(d_rid, nEntry+1);
nd = db_int(0, "SELECT count(*)-1 FROM ok");
if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
if( useDividers ) selectedRid = d_rid;
db_multi_exec("DELETE FROM ok");
}
if( p_rid ){
compute_ancestors(p_rid, nEntry+1, 0);
np = db_int(0, "SELECT count(*)-1 FROM ok");
if( np>0 ){
if( nd>0 ) blob_appendf(&desc, " and ");
blob_appendf(&desc, "%d ancestors", np);
db_multi_exec("%s", blob_sql_text(&sql));
}
if( useDividers ) selectedRid = p_rid;
}
blob_appendf(&desc, " of %z[%S]</a>",
href("%R/info/%!S", zUuid), zUuid);
if( d_rid ){
if( p_rid ){
/* If both p= and d= are set, we don't have the uuid of d yet. */
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
}
}
style_submenu_entry("n","Max:",4,0);
timeline_y_submenu(1);
style_submenu_binary("v","With Files","Without Files",
zType[0]!='a' && zType[0]!='c');
}else if( f_rid && g.perm.Read ){
/* If f= is present, ignore all other parameters other than n= */
char *zUuid;
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
"INSERT INTO ok VALUES(%d);"
"INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
"INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
f_rid, f_rid, f_rid
);
blob_append_sql(&sql, " AND event.objid IN ok");
db_multi_exec("%s", blob_sql_text(&sql));
if( useDividers ) selectedRid = f_rid;
blob_appendf(&desc, "Parents and children of check-in ");
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
tmFlags |= TIMELINE_DISJOINT;
style_submenu_binary("v","With Files","Without Files",
zType[0]!='a' && zType[0]!='c');
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
timeline_submenu(&url, "Unhide", "unhide", "", 0);
}
}else{
/* Otherwise, a timeline based on a span of time */
int n;
const char *zEType = "timeline item";
|
| ︙ | ︙ | |||
1310 1311 1312 1313 1314 1315 1316 |
}
else if( zYearWeek ){
blob_append_sql(&sql, " AND %Q=strftime('%%Y-%%W',event.mtime) ",
zYearWeek);
}
if( tagid>0 ){
blob_append_sql(&sql,
| | | < | | | | | < < < < | 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 |
}
else if( zYearWeek ){
blob_append_sql(&sql, " AND %Q=strftime('%%Y-%%W',event.mtime) ",
zYearWeek);
}
if( tagid>0 ){
blob_append_sql(&sql,
" AND (EXISTS(SELECT 1 FROM tagxref"
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", tagid);
if( zBrName ){
/* The next two blob_appendf() calls add SQL that causes checkins that
** are not part of the branch which are parents or children of the
** branch to be included in the report. This related check-ins are
** useful in helping to visualize what has happened on a quiescent
** branch that is infrequently merged with a much more activate branch.
*/
blob_append_sql(&sql,
" OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=cid"
" WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)\n",
tagid
);
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
blob_append_sql(&sql,
" AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
" WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)\n",
TAG_HIDDEN
);
}
if( P("mionly")==0 ){
blob_append_sql(&sql,
" OR EXISTS(SELECT 1 FROM plink CROSS JOIN tagxref ON rid=pid"
" WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)\n",
tagid
);
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
blob_append_sql(&sql,
" AND NOT EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
" WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)\n",
TAG_HIDDEN
);
}
}
}
blob_append_sql(&sql, ")");
}
if( (zType[0]=='w' && !g.perm.RdWiki)
|| (zType[0]=='t' && !g.perm.RdTkt)
|| (zType[0]=='e' && !g.perm.RdWiki)
|| (zType[0]=='c' && !g.perm.Read)
|
| ︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 |
blob_append_sql(&sql, "%c't'", cSep);
cSep = ',';
}
blob_append_sql(&sql, ")");
}
}else{ /* zType!="all" */
blob_append_sql(&sql, " AND event.type=%Q", zType);
| < | < < < < < > > > | | > > | < > > > > < < | | | | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 |
blob_append_sql(&sql, "%c't'", cSep);
cSep = ',';
}
blob_append_sql(&sql, ")");
}
}else{ /* zType!="all" */
blob_append_sql(&sql, " AND event.type=%Q", zType);
if( zType[0]=='c' ){
zEType = "checkin";
}else if( zType[0]=='w' ){
zEType = "wiki edit";
}else if( zType[0]=='t' ){
zEType = "ticket change";
}else if( zType[0]=='e' ){
zEType = "technical note";
}else if( zType[0]=='g' ){
zEType = "tag";
}
}
if( zUser ){
int n = db_int(0,"SELECT count(*) FROM event"
" WHERE user=%Q OR euser=%Q", zUser, zUser);
if( n<=nEntry ){
zCirca = zBefore = zAfter = 0;
nEntry = -1;
}
blob_append_sql(&sql, " AND (event.user=%Q OR event.euser=%Q)",
zUser, zUser);
zThisUser = zUser;
}
if( zSearch ){
blob_append_sql(&sql,
" AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')",
zSearch, zSearch);
}
rBefore = symbolic_name_to_mtime(zBefore);
rAfter = symbolic_name_to_mtime(zAfter);
rCirca = symbolic_name_to_mtime(zCirca);
if( rAfter>0.0 ){
if( rBefore>0.0 ){
blob_append_sql(&sql,
" AND event.mtime>=%.17g AND event.mtime<=%.17g"
" ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND);
nEntry = -1;
}else{
blob_append_sql(&sql,
" AND event.mtime>=%.17g ORDER BY event.mtime ASC",
rAfter-ONE_SECOND);
}
zCirca = 0;
url_add_parameter(&url, "c", 0);
}else if( rBefore>0.0 ){
blob_append_sql(&sql,
" AND event.mtime<=%.17g ORDER BY event.mtime DESC",
rBefore+ONE_SECOND);
zCirca = 0;
url_add_parameter(&url, "c", 0);
}else if( rCirca>0.0 ){
Blob sql2;
blob_init(&sql2, blob_sql_text(&sql), -1);
blob_append_sql(&sql2,
" AND event.mtime<=%f ORDER BY event.mtime DESC", rCirca);
if( nEntry>0 ){
blob_append_sql(&sql2," LIMIT %d", (nEntry+1)/2);
nEntry -= (nEntry+1)/2;
}
if( PB("showsql") ){
@ <pre>%h(blob_sql_text(&sql2))</pre>
}
db_multi_exec("%s", blob_sql_text(&sql2));
blob_reset(&sql2);
blob_append_sql(&sql,
" AND event.mtime>=%f ORDER BY event.mtime ASC",
rCirca
);
if( zMark==0 ) zMark = zCirca;
}else{
blob_append_sql(&sql, " ORDER BY event.mtime DESC");
}
if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
db_multi_exec("%s", blob_sql_text(&sql));
n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
if( zYearMonth ){
blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
}else if( zYearWeek ){
blob_appendf(&desc, "%s events for year/week %h", zEType, zYearWeek);
}else if( zBefore==0 && zCirca==0 && n>=nEntry && nEntry>0 ){
blob_appendf(&desc, "%d most recent %ss", n, zEType);
}else{
blob_appendf(&desc, "%d %ss", n, zEType);
}
if( zUses ){
char *zFilenames = names_of_file(zUses);
blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames,
href("%R/artifact/%!S",zUses), zUses);
tmFlags |= TIMELINE_DISJOINT;
}
if( renameOnly ){
blob_appendf(&desc, " that contain filename changes");
tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES;
}
if( zUser ){
|
| ︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 |
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
if( zAfter || n==nEntry ){
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Older", "b", zDate, "a");
free(zDate);
}
if( zBefore || (zAfter && n==nEntry) ){
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Newer", "a", zDate, "b");
free(zDate);
| > < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > | | > > > | > > > > | > > > | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 |
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
if( zAfter || n==nEntry ){
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Older", "b", zDate, "a");
zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
free(zDate);
}
if( zBefore || (zAfter && n==nEntry) ){
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Newer", "a", zDate, "b");
free(zDate);
}
if( zType[0]=='a' || zType[0]=='c' ){
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
timeline_submenu(&url, "Unhide", "unhide", "", 0);
}
}
style_submenu_entry("n","Max:",4,0);
timeline_y_submenu(disableY);
style_submenu_binary("v","With Files","Without Files",
zType[0]!='a' && zType[0]!='c');
}
}
if( PB("showsql") ){
@ <pre>%h(blob_sql_text(&sql))</pre>
}
if( search_restrict(SRCH_CKIN)!=0 ){
style_submenu_element("Search", 0, "%R/search?y=c");
}
if( PB("showid") ) tmFlags |= TIMELINE_SHOWRID;
if( useDividers && zMark && zMark[0] ){
double r = symbolic_name_to_mtime(zMark);
if( r>0.0 ) selectedRid = timeline_add_divider(r);
}
blob_zero(&sql);
db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
@ <h2>%b(&desc)</h2>
blob_reset(&desc);
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0);
db_finalize(&q);
if( zOlderButton ){
@ %z(xhref("class='button'","%z",zOlderButton))Older</a>
}
style_footer();
}
/*
** The input query q selects various records. Print a human-readable
** summary of those records.
**
|
| ︙ | ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | ** of one of these keywords: ** ** before ** after ** descendants | children ** ancestors | parents ** | | | | | 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 | ** of one of these keywords: ** ** before ** after ** descendants | children ** ancestors | parents ** ** The CHECKIN can be any unique prefix of 4 characters or more. ** The DATETIME should be in the ISO8601 format. For ** examples: "2007-08-18 07:21:21". You can also say "current" ** for the current version or "now" for the current time. ** ** Options: ** -n|--limit N Output the first N entries (default 20 lines). ** N=0 means no limit. ** -p|--path PATH Output items affecting PATH only. ** PATH can be a file or a sub directory. ** --offset P skip P changes ** -t|--type TYPE Output items from the given types only, such as: ** ci = file commits only ** e = technical notes only ** t = tickets only ** w = wiki commits only ** -v|--verbose Output the list of files changed by each commit ** and the type of each change (edited, deleted, ** etc.) after the checkin comment. ** -W|--width <num> Width of lines (default is to auto-detect). Must be ** >20 or 0 (= no limit, resulting in a single line per |
| ︙ | ︙ | |||
1891 1892 1893 1894 1895 1896 1897 |
fossil_fatal("cannot compute descendants or ancestors of a date");
}
if( mode==0 ){
if( isIsoDate(zOrigin) ) zShift = ",'+1 day'";
}
zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift);
}
| | | | 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 |
fossil_fatal("cannot compute descendants or ancestors of a date");
}
if( mode==0 ){
if( isIsoDate(zOrigin) ) zShift = ",'+1 day'";
}
zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift);
}
if( zFilePattern ){
if( zType==0 ){
/* When zFilePattern is specified and type is not specified, only show
* file checkins */
zType="ci";
}
file_tree_name(zFilePattern, &treeName, 1);
if( fossil_strcmp(blob_str(&treeName), ".")==0 ){
/* When zTreeName refers to g.zLocalRoot, it's like not specifying
* zFilePattern. */
zFilePattern = 0;
}
}
if( mode==0 ) mode = 1;
blob_zero(&sql);
blob_append(&sql, timeline_query_for_tty(), -1);
blob_append_sql(&sql, "\n AND event.mtime %s %s",
(mode==1 || mode==4) ? "<=" : ">=",
zDate /*safe-for-%s*/
);
if( mode==3 || mode==4 ){
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
if( mode==3 ){
|
| ︙ | ︙ | |||
2027 2028 2029 2030 2031 2032 2033 |
/*
** WEBPAGE: test_timewarps
*/
void test_timewarp_page(void){
Stmt q;
login_check_credentials();
| | > > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 |
/*
** WEBPAGE: test_timewarps
*/
void test_timewarp_page(void){
Stmt q;
login_check_credentials();
if( !g.perm.Read || !g.perm.Hyperlink ){
login_needed(g.anon.Read && g.anon.Hyperlink);
return;
}
style_header("Instances of timewarp");
@ <ul>
db_prepare(&q,
"SELECT blob.uuid "
" FROM plink p, plink c, blob"
" WHERE p.cid=c.pid AND p.mtime>c.mtime"
" AND blob.rid=c.cid"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
@ <li>
@ <a href="%R/timeline?dp=%!S(zUuid)&unhide">%S(zUuid)</a>
}
db_finalize(&q);
style_footer();
}
|
Changes to src/tkt.c.
| ︙ | ︙ | |||
311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
int tktid;
int createFlag = 1;
fossil_free(zTag);
getAllTicketFields();
if( haveTicket==0 ) return;
tktid = db_int(0, "SELECT tkt_id FROM ticket WHERE tkt_uuid=%Q", zTktUuid);
if( haveTicketChng ){
db_multi_exec("DELETE FROM ticketchng WHERE tkt_id=%d;", tktid);
}
db_multi_exec("DELETE FROM ticket WHERE tkt_id=%d", tktid);
tktid = 0;
db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid);
while( db_step(&q)==SQLITE_ROW ){
| > | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
int tktid;
int createFlag = 1;
fossil_free(zTag);
getAllTicketFields();
if( haveTicket==0 ) return;
tktid = db_int(0, "SELECT tkt_id FROM ticket WHERE tkt_uuid=%Q", zTktUuid);
search_doc_touch('t', tktid, 0);
if( haveTicketChng ){
db_multi_exec("DELETE FROM ticketchng WHERE tkt_id=%d;", tktid);
}
db_multi_exec("DELETE FROM ticket WHERE tkt_id=%d", tktid);
tktid = 0;
db_prepare(&q, "SELECT rid FROM tagxref WHERE tagid=%d ORDER BY mtime",tagid);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
static void showAllFields(void){
int i;
@ <font color="blue">
@ <p>Database fields:</p><ul>
for(i=0; i<nField; i++){
@ <li>aField[%d(i)].zName = "%h(aField[i].zName)";
@ originally = "%h(aField[i].zValue)";
| | | | | | | 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 |
static void showAllFields(void){
int i;
@ <font color="blue">
@ <p>Database fields:</p><ul>
for(i=0; i<nField; i++){
@ <li>aField[%d(i)].zName = "%h(aField[i].zName)";
@ originally = "%h(aField[i].zValue)";
@ currently = "%h(PD(aField[i].zName,""))";
if( aField[i].zAppend ){
@ zAppend = "%h(aField[i].zAppend)";
}
@ mUsed = %d(aField[i].mUsed);
}
@ </ul></font>
}
/*
** WEBPAGE: tktview
** URL: tktview?name=UUID
**
** View a ticket.
*/
void tktview_page(void){
const char *zScript;
char *zFullName;
const char *zUuid = PD("name","");
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
if( g.anon.WrTkt || g.anon.ApndTkt ){
style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
g.zTop, PD("name",""));
}
if( g.perm.Hyperlink ){
style_submenu_element("History", "History Of This Ticket",
"%s/tkthistory/%T", g.zTop, zUuid);
style_submenu_element("Timeline", "Timeline Of This Ticket",
"%s/tkttimeline/%T", g.zTop, zUuid);
style_submenu_element("Check-ins", "Check-ins Of This Ticket",
"%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
}
if( g.anon.NewTkt ){
style_submenu_element("New Ticket", "Create a new ticket",
"%s/tktnew", g.zTop);
}
if( g.anon.ApndTkt && g.anon.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?tkt=%T&from=%s/tktview/%t",
g.zTop, zUuid, g.zTop, zUuid);
}
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/tktview/%s", zUuid);
}else{
|
| ︙ | ︙ | |||
684 685 686 687 688 689 690 |
** top of the screen.
*/
void tktnew_page(void){
const char *zScript;
char *zNewUuid = 0;
login_check_credentials();
| | > | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
** top of the screen.
*/
void tktnew_page(void){
const char *zScript;
char *zNewUuid = 0;
login_check_credentials();
if( !g.perm.NewTkt ){ login_needed(g.anon.NewTkt); return; }
if( P("cancel") ){
cgi_redirect("home");
}
style_header("New Ticket");
ticket_standard_submenu(T_ALL_BUT(T_NEW));
if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
ticket_init();
initializeVariablesFromCGI();
getAllTicketFields();
initializeVariablesFromDb();
if( g.zPath[0]=='d' ) showAllFields();
form_begin(0, "%R/%s", g.zPath);
|
| ︙ | ︙ | |||
734 735 736 737 738 739 740 |
void tktedit_page(void){
const char *zScript;
int nName;
const char *zName;
int nRec;
login_check_credentials();
| | > > > | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
void tktedit_page(void){
const char *zScript;
int nName;
const char *zName;
int nRec;
login_check_credentials();
if( !g.perm.ApndTkt && !g.perm.WrTkt ){
login_needed(g.anon.ApndTkt || g.anon.WrTkt);
return;
}
zName = P("name");
if( P("cancel") ){
cgi_redirectf("tktview?name=%T", zName);
}
style_header("Edit Ticket");
if( zName==0 || (nName = strlen(zName))<4 || nName>UUID_SIZE
|| !validate16(zName,nName) ){
|
| ︙ | ︙ | |||
835 836 837 838 839 840 841 | const char *zUuid; char *zFullUuid; int tagid; char zGlobPattern[50]; const char *zType; login_check_credentials(); | | > > > | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
const char *zUuid;
char *zFullUuid;
int tagid;
char zGlobPattern[50];
const char *zType;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){
login_needed(g.anon.Hyperlink && g.anon.RdTkt);
return;
}
zUuid = PD("name","");
zType = PD("y","a");
if( zType[0]!='c' ){
style_submenu_element("Check-ins", "Check-ins",
"%s/tkttimeline?name=%T&y=ci", g.zTop, zUuid);
}else{
style_submenu_element("Timeline", "Timeline",
|
| ︙ | ︙ | |||
889 890 891 892 893 894 895 |
" WHERE target=%Q) "
"ORDER BY mtime DESC",
timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
);
}
db_prepare(&q, "%z", zSQL/*safe-for-%s*/);
www_print_timeline(&q, TIMELINE_ARTID|TIMELINE_DISJOINT|TIMELINE_GRAPH,
| | | > > > | 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
" WHERE target=%Q) "
"ORDER BY mtime DESC",
timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
);
}
db_prepare(&q, "%z", zSQL/*safe-for-%s*/);
www_print_timeline(&q, TIMELINE_ARTID|TIMELINE_DISJOINT|TIMELINE_GRAPH,
0, 0, 0, 0);
db_finalize(&q);
style_footer();
}
/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket
*/
void tkthistory_page(void){
Stmt q;
char *zTitle;
const char *zUuid;
int tagid;
int nChng = 0;
login_check_credentials();
if( !g.perm.Hyperlink || !g.perm.RdTkt ){
login_needed(g.anon.Hyperlink && g.anon.RdTkt);
return;
}
zUuid = PD("name","");
zTitle = mprintf("History Of Ticket %h", zUuid);
style_submenu_element("Status", "Status",
"%s/info/%s", g.zTop, zUuid);
style_submenu_element("Check-ins", "Check-ins",
"%s/tkttimeline?name=%s&y=ci", g.zTop, zUuid);
style_submenu_element("Timeline", "Timeline",
|
| ︙ | ︙ | |||
964 965 966 967 968 969 970 |
const char *zUser = db_column_text(&q, 5);
if( zSrc==0 || zSrc[0]==0 ){
@
@ <li><p>Delete attachment "%h(zFile)"
}else{
@
@ <li><p>Add attachment
| | | | | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 |
const char *zUser = db_column_text(&q, 5);
if( zSrc==0 || zSrc[0]==0 ){
@
@ <li><p>Delete attachment "%h(zFile)"
}else{
@
@ <li><p>Add attachment
@ "%z(href("%R/artifact/%!S",zSrc))%s(zFile)</a>"
}
@ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(zUser,zDate," on");
hyperlink_to_date(zDate, ".</p>");
}else{
pTicket = manifest_get(rid, CFTYPE_TICKET, 0);
if( pTicket ){
@
@ <li><p>Ticket change
@ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
@ (rid %d(rid)) by
hyperlink_to_user(pTicket->zUser,zDate," on");
hyperlink_to_date(zDate, ":");
@ </p>
ticket_output_change_artifact(pTicket, "a");
}
manifest_destroy(pTicket);
|
| ︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 |
}else{
fossil_print("ticket %s succeeded for %s\n",
(eCmd==set?"set":"add"),zTktUuid);
}
}
}
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 |
}else{
fossil_print("ticket %s succeeded for %s\n",
(eCmd==set?"set":"add"),zTktUuid);
}
}
}
}
#if INTERFACE
/* Standard submenu items for wiki pages */
#define T_SRCH 0x00001
#define T_REPLIST 0x00002
#define T_NEW 0x00004
#define T_ALL 0x00007
#define T_ALL_BUT(x) (T_ALL&~(x))
#endif
/*
** Add some standard submenu elements for ticket screens.
*/
void ticket_standard_submenu(unsigned int ok){
if( (ok & T_SRCH)!=0 && search_restrict(SRCH_TKT)!=0 ){
style_submenu_element("Search","Search","%R/tktsrch");
}
if( (ok & T_REPLIST)!=0 ){
style_submenu_element("Reports","Reports","%R/reportlist");
}
if( (ok & T_NEW)!=0 && g.anon.NewTkt ){
style_submenu_element("New","New","%R/tktnew");
}
}
/*
** WEBPAGE: ticket
**
** This is intended to be the primary "Ticket" page. Render as
** either ticket-search (if search is enabled) or as the
** /reportlist page (if ticket search is disabled).
*/
void tkt_home_page(void){
login_check_credentials();
if( search_restrict(SRCH_TKT)!=0 ){
tkt_srchpage();
}else{
view_list();
}
}
/*
** WEBPAGE: tktsrch
** Usage: /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){
login_check_credentials();
style_header("Ticket Search");
ticket_standard_submenu(T_ALL_BUT(T_SRCH));
search_screen(SRCH_TKT, 0);
style_footer();
}
|
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
/*
** Main sub-menu for configuring the ticketing system.
** WEBPAGE: tktsetup
*/
void tktsetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
/*
** Main sub-menu for configuring the ticketing system.
** WEBPAGE: tktsetup
*/
void tktsetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Ticket Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Table", "tktsetup_tab",
"Specify the schema of the \"ticket\" table in the database.");
setup_menu_entry("Timeline", "tktsetup_timeline",
|
| ︙ | ︙ | |||
116 117 118 119 120 121 122 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
| | > | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( PB("setup") ){
cgi_redirect("tktsetup");
}
isSubmit = P("submit")!=0;
z = P("x");
if( z==0 ){
z = db_get(zDbField, (char*)zDfltValue);
}
|
| ︙ | ︙ | |||
711 712 713 714 715 716 717 | } /* ** The default report list page */ static const char zDefaultReportList[] = @ <th1> | | | | | | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 |
}
/*
** The default report list page
*/
static const char zDefaultReportList[] =
@ <th1>
@ if {[anoncap n]} {
@ html "<p>Enter a new ticket:</p>"
@ html "<ul><li><a href='tktnew'>New ticket</a></li></ul>"
@ }
@ </th1>
@
@ <p>Choose a report format from the following list:</p>
@ <ol>
@ <th1>html $report_items</th1>
@ </ol>
@
@ <th1>
@ if {[anoncap t q]} {
@ html "<p>Other options:</p>\n<ul>\n"
@ if {[anoncap t]} {
@ html "<li><a href='rptnew'>New report format</a></li>\n"
@ }
@ if {[anoncap q]} {
@ html "<li><a href='modreq'>Tend to pending moderation requests</a></li>\n"
@ }
@ }
@ </th1>
;
/*
|
| ︙ | ︙ | |||
856 857 858 859 860 861 862 |
/*
** WEBPAGE: tktsetup_timeline
*/
void tktsetup_timeline_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
/*
** WEBPAGE: tktsetup_timeline
*/
void tktsetup_timeline_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( P("setup") ){
cgi_redirect("tktsetup");
}
style_header("Ticket Display On Timelines");
db_begin_transaction();
|
| ︙ | ︙ |
Changes to src/translate.c.
| ︙ | ︙ | |||
40 41 42 43 44 45 46 | ** rather than text that is to be output via cgi_printf(). Render it ** as such. ** ** Enhancement #2: ** ** Comments of the form: "/* @-comment: CC" cause CC to become a ** comment character for the @-substitution. Typical values for CC are | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ** rather than text that is to be output via cgi_printf(). Render it ** as such. ** ** Enhancement #2: ** ** Comments of the form: "/* @-comment: CC" cause CC to become a ** comment character for the @-substitution. Typical values for CC are ** "--" (for SQL text) or "#" (for Tcl script) or "//" (for C++ code). ** Lines of subsequent @-blocks that begin with CC are omitted from the ** output. ** */ #include <stdio.h> #include <ctype.h> #include <stdlib.h> |
| ︙ | ︙ |
Changes to src/undo.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file implements the undo/redo functionality. */ #include "config.h" #include "undo.h" |
| ︙ | ︙ | |||
43 44 45 46 47 48 49 |
int new_exe;
int new_link;
int old_link;
Blob current;
Blob new;
zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname);
old_link = db_column_int(&q, 3);
| < > | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
int new_exe;
int new_link;
int old_link;
Blob current;
Blob new;
zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname);
old_link = db_column_int(&q, 3);
new_exists = file_wd_size(zFullname)>=0;
new_link = file_wd_islink(0);
if( new_exists ){
if( new_link ){
blob_read_link(¤t, zFullname);
}else{
blob_read_from_file(¤t, zFullname);
}
new_exe = file_wd_isexe(0);
}else{
blob_zero(¤t);
new_exe = 0;
}
blob_zero(&new);
old_exists = db_column_int(&q, 1);
old_exe = db_column_int(&q, 2);
|
| ︙ | ︙ | |||
84 85 86 87 88 89 90 |
}else{
fossil_print("DELETE %s\n", zPathname);
file_delete(zFullname);
}
blob_reset(&new);
free(zFullname);
db_finalize(&q);
| | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
}else{
fossil_print("DELETE %s\n", zPathname);
file_delete(zFullname);
}
blob_reset(&new);
free(zFullname);
db_finalize(&q);
db_prepare(&q,
"UPDATE undo SET content=:c, existsflag=%d, isExe=%d, isLink=%d,"
" redoflag=NOT redoflag"
" WHERE pathname=%Q",
new_exists, new_exe, new_link, zPathname
);
if( new_exists ){
db_bind_blob(&q, ":c", ¤t);
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
/*
** Begin capturing a snapshot that can be undone.
*/
void undo_begin(void){
int cid;
const char *zDb = db_name("localdb");
| | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
/*
** Begin capturing a snapshot that can be undone.
*/
void undo_begin(void){
int cid;
const char *zDb = db_name("localdb");
static const char zSql[] =
@ CREATE TABLE "%w".undo(
@ pathname TEXT UNIQUE, -- Name of the file
@ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable
@ existsflag BOOLEAN, -- True if the file exists
@ isExe BOOLEAN, -- True if the file is executable
@ isLink BOOLEAN, -- True if the file is symlink
@ content BLOB -- Saved content
|
| ︙ | ︙ | |||
238 239 240 241 242 243 244 |
db_lset_int("undo_checkout", cid);
db_lset_int("undo_available", 1);
db_lset("undo_cmdline", undoCmd);
undoActive = 1;
}
/*
| | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
db_lset_int("undo_checkout", cid);
db_lset_int("undo_available", 1);
db_lset("undo_cmdline", undoCmd);
undoActive = 1;
}
/*
** Permanently disable undo
*/
void undo_disable(void){
undoDisable = 1;
}
/*
** This flag is true if one or more files have changed and have been
|
| ︙ | ︙ | |||
277 278 279 280 281 282 283 |
"INSERT OR IGNORE INTO"
" undo(pathname,redoflag,existsflag,isExe,isLink,content)"
" VALUES(%Q,0,%d,%d,%d,:c)",
zPathname, existsFlag, file_wd_isexe(zFullname), isLink
);
if( existsFlag ){
if( isLink ){
| | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
"INSERT OR IGNORE INTO"
" undo(pathname,redoflag,existsflag,isExe,isLink,content)"
" VALUES(%Q,0,%d,%d,%d,:c)",
zPathname, existsFlag, file_wd_isexe(zFullname), isLink
);
if( existsFlag ){
if( isLink ){
blob_read_link(&content, zFullname);
}else{
blob_read_from_file(&content, zFullname);
}
db_bind_blob(&q, ":c", &content);
}
free(zFullname);
db_step(&q);
|
| ︙ | ︙ | |||
361 362 363 364 365 366 367 | ** ** (1) fossil update (5) fossil stash apply ** (2) fossil merge (6) fossil stash drop ** (3) fossil revert (7) fossil stash goto ** (4) fossil stash pop ** ** If FILENAME is specified then restore the content of the named | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | ** ** (1) fossil update (5) fossil stash apply ** (2) fossil merge (6) fossil stash drop ** (3) fossil revert (7) fossil stash goto ** (4) fossil stash pop ** ** If FILENAME is specified then restore the content of the named ** file(s) but otherwise leave the update or merge or revert in effect. ** The redo command undoes the effect of the most recent undo. ** ** If the -n|--dry-run option is present, no changes are made and instead ** the undo or redo command explains what actions the undo or redo would ** have done had the -n|--dry-run been omitted. ** ** A single level of undo/redo is supported. The undo/redo stack |
| ︙ | ︙ | |||
408 409 410 411 412 413 414 |
);
while( db_step(&q)==SQLITE_ROW ){
if( nChng==0 ){
fossil_print("The following file changes would occur if the "
"command above is %sne:\n\n", zCmd);
}
nChng++;
| | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
);
while( db_step(&q)==SQLITE_ROW ){
if( nChng==0 ){
fossil_print("The following file changes would occur if the "
"command above is %sne:\n\n", zCmd);
}
nChng++;
fossil_print("%s %s\n",
db_column_int(&q,0) ? "UPDATE" : "DELETE",
db_column_text(&q, 1)
);
}
db_finalize(&q);
if( nChng==0 ){
fossil_print("No file changes would occur with this undo/redo.\n");
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
807 808 809 810 811 812 813 |
" WHERE pathname=%Q AND origname!=pathname;"
"DELETE FROM vfile WHERE pathname=%Q",
zFile, zFile
);
}else{
sqlite3_int64 mtime;
undo_save(zFile);
| | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
" WHERE pathname=%Q AND origname!=pathname;"
"DELETE FROM vfile WHERE pathname=%Q",
zFile, zFile
);
}else{
sqlite3_int64 mtime;
undo_save(zFile);
if( file_wd_size(zFull)>=0 && (isLink || file_wd_islink(0)) ){
file_delete(zFull);
}
if( isLink ){
symlink_create(blob_str(&record), zFull);
}else{
blob_write_to_file(&record, zFull);
}
|
| ︙ | ︙ |
Changes to src/url.c.
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
urlFlags &= ~URL_ASK_REMEMBER_PW;
}
zLogin = mprintf("%t@", pUrlData->user);
for(j=i+1; (c=zUrl[j])!=0 && c!='/' && c!=':'; j++){}
pUrlData->name = mprintf("%.*s", j-i-1, &zUrl[i+1]);
i = j;
}else{
| > > | > > > > > > > > | 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 |
urlFlags &= ~URL_ASK_REMEMBER_PW;
}
zLogin = mprintf("%t@", pUrlData->user);
for(j=i+1; (c=zUrl[j])!=0 && c!='/' && c!=':'; j++){}
pUrlData->name = mprintf("%.*s", j-i-1, &zUrl[i+1]);
i = j;
}else{
int inSquare = 0;
int n;
for(i=iStart; (c=zUrl[i])!=0 && c!='/' && (inSquare || c!=':'); i++){
if( c=='[' ) inSquare = 1;
if( c==']' ) inSquare = 0;
}
pUrlData->name = mprintf("%.*s", i-iStart, &zUrl[iStart]);
n = strlen(pUrlData->name);
if( pUrlData->name[0]=='[' && n>2 && pUrlData->name[n-1]==']' ){
pUrlData->name++;
pUrlData->name[n-2] = 0;
}
zLogin = mprintf("");
}
url_tolower(pUrlData->name);
if( c==':' ){
pUrlData->port = 0;
i++;
while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
|
| ︙ | ︙ | |||
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
** This also happens to be a convenient function to use to look for
** the --nosync option that will temporarily disable the "autosync"
** feature.
*/
void url_proxy_options(void){
zProxyOpt = find_option("proxy", 0, 1);
if( find_option("nosync",0,0) ) g.fNoSync = 1;
}
/*
** If the "proxy" setting is defined, then change the URL settings
** (initialized by a prior call to url_parse()) so that the HTTP
** header will be appropriate for the proxy and so that the TCP/IP
** connection will be opened to the proxy rather than to the server.
**
** If zMsg is not NULL and a proxy is used, then print zMsg followed
** by the canonical name of the proxy (with userid and password suppressed).
*/
void url_enable_proxy(const char *zMsg){
const char *zProxy;
zProxy = zProxyOpt;
if( zProxy==0 ){
zProxy = db_get("proxy", 0);
| > | | 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 |
** This also happens to be a convenient function to use to look for
** the --nosync option that will temporarily disable the "autosync"
** feature.
*/
void url_proxy_options(void){
zProxyOpt = find_option("proxy", 0, 1);
if( find_option("nosync",0,0) ) g.fNoSync = 1;
if( find_option("ipv4",0,0) ) g.fIPv4 = 1;
}
/*
** If the "proxy" setting is defined, then change the URL settings
** (initialized by a prior call to url_parse()) so that the HTTP
** header will be appropriate for the proxy and so that the TCP/IP
** connection will be opened to the proxy rather than to the server.
**
** If zMsg is not NULL and a proxy is used, then print zMsg followed
** by the canonical name of the proxy (with userid and password suppressed).
*/
void url_enable_proxy(const char *zMsg){
const char *zProxy;
zProxy = zProxyOpt;
if( zProxy==0 ){
zProxy = db_get("proxy", 0);
if( zProxy==0 || zProxy[0]==0 || is_false(zProxy) ){
zProxy = fossil_getenv("http_proxy");
}
}
if( zProxy && zProxy[0] && !is_false(zProxy)
&& !g.url.isSsh && !g.url.isFile ){
char *zOriginalUrl = g.url.canonical;
char *zOriginalHost = g.url.hostname;
|
| ︙ | ︙ | |||
419 420 421 422 423 424 425 |
#if INTERFACE
/*
** An instance of this object is used to build a URL with query parameters.
*/
struct HQuery {
Blob url; /* The URL */
const char *zBase; /* The base URL */
| | > | | > < > > | > > > > | | | > | > > > > > > > > > > > > > > > > | 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 |
#if INTERFACE
/*
** An instance of this object is used to build a URL with query parameters.
*/
struct HQuery {
Blob url; /* The URL */
const char *zBase; /* The base URL */
int nParam; /* Number of parameters. */
int nAlloc; /* Number of allocated slots */
const char **azName; /* Parameter names */
const char **azValue; /* Parameter values */
};
#endif
/*
** Initialize the URL object.
*/
void url_initialize(HQuery *p, const char *zBase){
memset(p, 0, sizeof(*p));
blob_zero(&p->url);
p->zBase = zBase;
}
/*
** Resets the given URL object, deallocating any memory
** it uses.
*/
void url_reset(HQuery *p){
blob_reset(&p->url);
fossil_free(p->azName);
fossil_free(p->azValue);
url_initialize(p, p->zBase);
}
/*
** Add a fixed parameter to an HQuery. Or remove the parameters if zValue==0.
*/
void url_add_parameter(HQuery *p, const char *zName, const char *zValue){
int i;
for(i=0; i<p->nParam; i++){
if( fossil_strcmp(p->azName[i],zName)==0 ){
if( zValue==0 ){
p->nParam--;
p->azValue[i] = p->azValue[p->nParam];
p->azName[i] = p->azName[p->nParam];
}else{
p->azValue[i] = zValue;
}
return;
}
}
assert( i==p->nParam );
if( zValue==0 ) return;
if( i>=p->nAlloc ){
p->nAlloc = p->nAlloc*2 + 10;
p->azName = fossil_realloc(p->azName, sizeof(p->azName[0])*p->nAlloc);
p->azValue = fossil_realloc(p->azValue, sizeof(p->azValue[0])*p->nAlloc);
}
p->azName[i] = zName;
p->azValue[i] = zValue;
p->nParam++;
}
/*
** Render the URL with a parameter override.
**
** Returned memory is transient and is overwritten on the next call to this
** routine for the same HQuery, or until the HQuery object is destroyed.
*/
char *url_render(
HQuery *p, /* Base URL */
const char *zName1, /* First override */
const char *zValue1, /* First override value */
const char *zName2, /* Second override */
const char *zValue2 /* Second override value */
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
422 423 424 425 426 427 428 |
int skip = atoi(PD("o","0"));
Blob sql;
Stmt q;
int cnt = 0;
int rc;
login_check_credentials();
| | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
int skip = atoi(PD("o","0"));
Blob sql;
Stmt q;
int cnt = 0;
int rc;
login_check_credentials();
if( !g.perm.Admin ){ login_needed(0); return; }
create_accesslog_table();
if( P("delall") && P("delallbtn") ){
db_multi_exec("DELETE FROM accesslog");
cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
return;
}
|
| ︙ | ︙ | |||
465 466 467 468 469 470 471 |
blob_append_sql(&sql," ORDER BY rowid DESC LIMIT %d OFFSET %d", n+1, skip);
if( skip ){
style_submenu_element("Newer", "Newer entries",
"%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0,
n, y);
}
rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
| | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
blob_append_sql(&sql," ORDER BY rowid DESC LIMIT %d OFFSET %d", n+1, skip);
if( skip ){
style_submenu_element("Newer", "Newer entries",
"%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0,
n, y);
}
rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
@ <center><table border="1" cellpadding="5" id='logtable'>
@ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th>
@ <th width="33%%">IP Address</th></tr></thead><tbody>
while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zIP = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
int bSuccess = db_column_int(&q, 3);
cnt++;
if( cnt>n ){
|
| ︙ | ︙ | |||
490 491 492 493 494 495 496 |
}
@ <td>%s(zDate)</td><td>%h(zName)</td><td>%h(zIP)</td></tr>
}
if( skip>0 || cnt>n ){
style_submenu_element("All", "All entries",
"%s/access_log?n=10000000", g.zTop);
}
| | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
}
@ <td>%s(zDate)</td><td>%h(zName)</td><td>%h(zIP)</td></tr>
}
if( skip>0 || cnt>n ){
style_submenu_element("All", "All entries",
"%s/access_log?n=10000000", g.zTop);
}
@ </tbody></table></center>
db_finalize(&q);
@ <hr>
@ <form method="post" action="%s(g.zTop)/access_log">
@ <label><input type="checkbox" name="delold">
@ Delete all but the most recent 200 entries</input></label>
@ <input type="submit" name="deloldbtn" value="Delete"></input>
@ </form>
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 520 521 | @ <input type="submit" name="delfailbtn" value="Delete"></input> @ </form> @ <form method="post" action="%s(g.zTop)/access_log"> @ <label><input type="checkbox" name="delall"> @ Delete all entries</input></label> @ <input type="submit" name="delallbtn" value="Delete"></input> @ </form> style_footer(); } | > | 513 514 515 516 517 518 519 520 521 522 |
@ <input type="submit" name="delfailbtn" value="Delete"></input>
@ </form>
@ <form method="post" action="%s(g.zTop)/access_log">
@ <label><input type="checkbox" name="delall">
@ Delete all entries</input></label>
@ <input type="submit" name="delallbtn" value="Delete"></input>
@ </form>
output_table_sorting_javascript("logtable", "Ttt", 1);
style_footer();
}
|
Changes to src/util.c.
| ︙ | ︙ | |||
329 330 331 332 333 334 335 |
** only lower-case ASCII hexadecimal values.
*/
int fossil_is_uuid(const char *zSym){
return zSym
&& (UUID_SIZE==strlen(zSym))
&& validate16(zSym, UUID_SIZE);
}
| > > > > > > > > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
** only lower-case ASCII hexadecimal values.
*/
int fossil_is_uuid(const char *zSym){
return zSym
&& (UUID_SIZE==strlen(zSym))
&& validate16(zSym, UUID_SIZE);
}
/*
** Return true if the input string is NULL or all whitespace.
** Return false if the input string contains text.
*/
int fossil_all_whitespace(const char *z){
if( z==0 ) return 1;
while( fossil_isspace(z[0]) ){ z++; }
return z[0]==0;
}
|
Changes to src/vfile.c.
| ︙ | ︙ | |||
187 188 189 190 191 192 193 |
id = db_column_int(&q, 0);
zName = db_column_text(&q, 1);
rid = db_column_int(&q, 2);
isDeleted = db_column_int(&q, 3);
oldChnged = chnged = db_column_int(&q, 4);
oldMtime = db_column_int64(&q, 7);
| < > | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
id = db_column_int(&q, 0);
zName = db_column_text(&q, 1);
rid = db_column_int(&q, 2);
isDeleted = db_column_int(&q, 3);
oldChnged = chnged = db_column_int(&q, 4);
oldMtime = db_column_int64(&q, 7);
origSize = db_column_int64(&q, 6);
currentSize = file_wd_size(zName);
currentMtime = file_wd_mtime(0);
if( chnged==0 && (isDeleted || rid==0) ){
/* "fossil rm" or "fossil add" always change the file */
chnged = 1;
}else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
if( cksigFlags & CKSIG_ENOTFILE ){
fossil_warning("not an ordinary file: %s", zName);
|
| ︙ | ︙ | |||
318 319 320 321 322 323 324 |
}
}
if( verbose ) fossil_print("%s\n", &zName[nRepos]);
if( file_wd_isdir(zName) == 1 ){
/*TODO(dchest): remove directories? */
fossil_fatal("%s is directory, cannot overwrite\n", zName);
}
| | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
}
}
if( verbose ) fossil_print("%s\n", &zName[nRepos]);
if( file_wd_isdir(zName) == 1 ){
/*TODO(dchest): remove directories? */
fossil_fatal("%s is directory, cannot overwrite\n", zName);
}
if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(0)) ){
file_delete(zName);
}
if( isLink ){
symlink_create(blob_str(&content), zName);
}else{
blob_write_to_file(&content, zName);
}
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
){
return zMimetype;
}
return "text/x-fossil-wiki";
}
/*
| | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
){
return zMimetype;
}
return "text/x-fossil-wiki";
}
/*
** Render wiki text according to its mimetype.
**
** text/x-fossil-wiki Fossil wiki
** text/x-markdown Markdown
** anything else... Plain text
*/
void wiki_render_by_mimetype(Blob *pWiki, const char *zMimetype){
if( zMimetype==0 || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
wiki_convert(pWiki, 0, 0);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
Blob title = BLOB_INITIALIZER;
Blob tail = BLOB_INITIALIZER;
markdown_to_html(pWiki, &title, &tail);
#if 0
if( blob_size(&title)>0 ){
@ <h1>%s(blob_str(&title))</h1>
}
#endif
@ %s(blob_str(&tail))
blob_reset(&title);
blob_reset(&tail);
}else{
@ <pre>
@ %h(blob_str(pWiki))
@ </pre>
}
}
/*
** WEBPAGE: md_rules
**
** Show a summary of the Markdown wiki formatting rules.
*/
void markdown_rules_page(void){
Blob x;
int fTxt = P("txt")!=0;
style_header("Markdown Formatting Rules");
if( fTxt ){
style_submenu_element("Formatted", "Formatted", "%R/md_rules");
}else{
style_submenu_element("Plain-Text", "Plain-Text", "%R/md_rules?txt=1");
}
blob_init(&x, builtin_text("markdown.md"), -1);
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
blob_reset(&x);
style_footer();
}
/*
** Returns non-zero if moderation is required for wiki changes and wiki
** attachments.
*/
int wiki_need_moderation(
int localUser /* Are we being called for a local interactive user? */
|
| ︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
return 1;
}
if( localUser ){
return 0;
}
return g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1;
}
/*
** WEBPAGE: wiki
** URL: /wiki?name=PAGENAME
*/
void wiki_page(void){
char *zTag;
int rid = 0;
int isSandbox;
char *zUuid;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
const char *zMimetype = 0;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < | < < < < < < < < | < < < | < < < | < < < < < < < < > > > | | | | | | | > | | | > | 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 |
return 1;
}
if( localUser ){
return 0;
}
return g.perm.ModWiki==0 && db_get_boolean("modreq-wiki",0)==1;
}
/* Standard submenu items for wiki pages */
#define W_SRCH 0x00001
#define W_LIST 0x00002
#define W_HELP 0x00004
#define W_NEW 0x00008
#define W_BLOG 0x00010
#define W_SANDBOX 0x00020
#define W_ALL 0x0001f
#define W_ALL_BUT(x) (W_ALL&~(x))
/*
** Add some standard submenu elements for wiki screens.
*/
static void wiki_standard_submenu(unsigned int ok){
if( (ok & W_SRCH)!=0 && search_restrict(SRCH_WIKI)!=0 ){
style_submenu_element("Search","Search","%R/wikisrch");
}
if( (ok & W_LIST)!=0 ){
style_submenu_element("List","List","%R/wcontent");
}
if( (ok & W_HELP)!=0 ){
style_submenu_element("Help","Help","%R/wikihelp");
}
if( (ok & W_NEW)!=0 && g.anon.NewWiki ){
style_submenu_element("New","New","%R/wikinew");
}
#if 0
if( (ok & W_BLOG)!=0
#endif
if( (ok & W_SANDBOX)!=0 ){
style_submenu_element("Sandbox", "Sandbox", "%R/wiki?name=Sandbox");
}
}
/*
** WEBPAGE: wikihelp
** A generic landing page for wiki.
*/
void wiki_helppage(void){
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
style_header("Wiki Help");
wiki_standard_submenu(W_ALL_BUT(W_HELP));
@ <h2>Wiki Links</h2>
@ <ul>
{ char *zWikiHomePageName = db_get("index-page",0);
if( zWikiHomePageName ){
@ <li> %z(href("%R%s",zWikiHomePageName))
@ %h(zWikiHomePageName)</a> wiki home page.</li>
}
}
{ char *zHomePageName = db_get("project-name",0);
if( zHomePageName ){
@ <li> %z(href("%R/wiki?name=%t",zHomePageName))
@ %h(zHomePageName)</a> project home page.</li>
}
}
@ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li>
@ <li> Formatting rules for %z(href("%R/wiki_rules"))Fossil Wiki</a> and for
@ %z(href("%R/md_rules"))Markdown Wiki</a>.</li>
@ <li> Use the %z(href("%R/wiki?name=Sandbox"))Sandbox</a>
@ to experiment.</li>
if( g.anon.NewWiki ){
@ <li> Create a %z(href("%R/wikinew"))new wiki page</a>.</li>
if( g.anon.Write ){
@ <li> Create a %z(href("%R/technoteedit"))new tech-note</a>.</li>
}
}
@ <li> %z(href("%R/wcontent"))List of All Wiki Pages</a>
@ available on this server.</li>
if( g.anon.ModWiki ){
@ <li> %z(href("%R/modreq"))Tend to pending moderation requests</a></li>
}
if( search_restrict(SRCH_WIKI)!=0 ){
@ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key
@ words</li>
}
@ </ul>
style_footer();
return;
}
/*
** WEBPAGE: wikisrch
** Usage: /wikisrch?s=PATTERN
**
** Full-text search of all current wiki text
*/
void wiki_srchpage(void){
login_check_credentials();
style_header("Wiki Search");
wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
search_screen(SRCH_WIKI, 0);
style_footer();
}
/*
** WEBPAGE: wiki
** URL: /wiki?name=PAGENAME
*/
void wiki_page(void){
char *zTag;
int rid = 0;
int isSandbox;
char *zUuid;
unsigned submenuFlags = W_ALL;
Blob wiki;
Manifest *pWiki = 0;
const char *zPageName;
const char *zMimetype = 0;
char *zBody = mprintf("%s","<i>Empty Page</i>");
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
zPageName = P("name");
if( zPageName==0 ){
if( search_restrict(SRCH_WIKI)!=0 ){
wiki_srchpage();
}else{
wiki_helppage();
}
return;
}
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
submenuFlags &= ~W_SANDBOX;
zBody = db_get("sandbox",zBody);
zMimetype = db_get("sandbox-mimetype","text/x-fossil-wiki");
rid = 0;
}else{
const char *zUuid = P("id");
if( zUuid==0 || (rid = symbolic_name_to_rid(zUuid,"w"))==0 ){
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
}
pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
if( pWiki ){
zBody = pWiki->zWiki;
zMimetype = pWiki->zMimetype;
}
}
zMimetype = wiki_filter_mimetypes(zMimetype);
if( !g.isHome ){
if( rid ){
style_submenu_element("Diff", "Last change",
"%R/wdiff?name=%T&a=%d", zPageName, rid);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
style_submenu_element("Details", "Details",
"%R/info/%s", zUuid);
}
if( (rid && g.anon.WrWiki) || (!rid && g.anon.NewWiki) ){
if( db_get_boolean("wysiwyg-wiki", 0) ){
style_submenu_element("Edit", "Edit Wiki Page",
"%s/wikiedit?name=%T&wysiwyg=1",
g.zTop, zPageName);
}else{
style_submenu_element("Edit", "Edit Wiki Page",
"%s/wikiedit?name=%T",
g.zTop, zPageName);
}
}
if( rid && g.anon.ApndWiki && g.anon.Attach ){
style_submenu_element("Attach", "Add An Attachment",
"%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
g.zTop, zPageName, g.zTop, zPageName);
}
if( rid && g.anon.ApndWiki ){
style_submenu_element("Append", "Add A Comment",
"%s/wikiappend?name=%T&mimetype=%s",
g.zTop, zPageName, zMimetype);
}
if( g.perm.Hyperlink ){
style_submenu_element("History", "History", "%s/whistory?name=%T",
g.zTop, zPageName);
}
}
style_set_current_page("%T?name=%T", g.zPath, zPageName);
style_header("%s", zPageName);
wiki_standard_submenu(submenuFlags);
blob_init(&wiki, zBody, -1);
wiki_render_by_mimetype(&wiki, zMimetype);
blob_reset(&wiki);
attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>");
manifest_destroy(pWiki);
style_footer();
}
|
| ︙ | ︙ | |||
330 331 332 333 334 335 336 | "text/plain", "Plain Text" }; /* ** Output a selection box from which the user can select the ** wiki mimetype. */ | | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
"text/plain", "Plain Text"
};
/*
** Output a selection box from which the user can select the
** wiki mimetype.
*/
void mimetype_option_menu(const char *zMimetype){
unsigned i;
@ <select name="mimetype" size="1">
for(i=0; i<sizeof(azStyles)/sizeof(azStyles[0]); i+=2){
if( fossil_strcmp(zMimetype,azStyles[i])==0 ){
@ <option value="%s(azStyles[i])" selected>%s(azStyles[i+1])</option>
}else{
@ <option value="%s(azStyles[i])">%s(azStyles[i+1])</option>
}
}
|
| ︙ | ︙ | |||
392 393 394 395 396 397 398 |
}
login_check_credentials();
zPageName = PD("name","");
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
if( !g.perm.WrWiki ){
| | | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
}
login_check_credentials();
zPageName = PD("name","");
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
if( !g.perm.WrWiki ){
login_needed(g.anon.WrWiki);
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
zMimetype = db_get("sandbox-mimetype","text/x-fossil-wiki");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
login_needed(rid ? g.anon.WrWiki : g.anon.NewWiki);
return;
}
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
zBody = pWiki->zWiki;
zMimetype = pWiki->zMimetype;
}
}
|
| ︙ | ︙ | |||
480 481 482 483 484 485 486 |
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>30 ) n = 30;
if( !isWysiwyg ){
/* Traditional markup-only editing */
form_begin(0, "%R/wikiedit");
| | | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>30 ) n = 30;
if( !isWysiwyg ){
/* Traditional markup-only editing */
form_begin(0, "%R/wikiedit");
@ <div>Markup style:
mimetype_option_menu(zMimetype);
@ <br /><textarea name="w" class="wikiedit" cols="80"
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
@ <br />
if( db_get_boolean("wysiwyg-wiki", 0) ){
@ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor"
@ onclick='return confirm("Switching to WYSIWYG-mode\nwill erase your markup\nedits. Continue?")' />
|
| ︙ | ︙ | |||
532 533 534 535 536 537 538 |
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
const char *zMimetype;
login_check_credentials();
if( !g.perm.NewWiki ){
| | > > | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
** to the wikiedit screen for that new page.
*/
void wikinew_page(void){
const char *zName;
const char *zMimetype;
login_check_credentials();
if( !g.perm.NewWiki ){
login_needed(g.anon.NewWiki);
return;
}
zName = PD("name","");
zMimetype = wiki_filter_mimetypes(P("mimetype"));
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
if( fossil_strcmp(zMimetype,"text/x-fossil-wiki")==0
&& db_get_boolean("wysiwyg-wiki", 0)
){
cgi_redirectf("wikiedit?name=%T&wysiwyg=1", zName);
}else{
cgi_redirectf("wikiedit?name=%T&mimetype=%s", zName, zMimetype);
}
}
style_header("Create A New Wiki Page");
wiki_standard_submenu(W_ALL_BUT(W_NEW));
@ <p>Rules for wiki page names:</p>
well_formed_wiki_name_rules();
form_begin(0, "%R/wikinew");
@ <p>Name of new wiki page:
@ <input style="width: 35;" type="text" name="name" value="%h(zName)" /><br />
@ Markup style:
mimetype_option_menu("text/x-fossil-wiki");
@ <br /><input type="submit" value="Create" />
@ </p></form>
if( zName[0] ){
@ <p><span class="wikiError">
@ "%h(zName)" is not a valid wiki page name!</span></p>
}
|
| ︙ | ︙ | |||
633 634 635 636 637 638 639 |
free(zTag);
if( !rid ){
fossil_redirect_home();
return;
}
}
if( !g.perm.ApndWiki ){
| | | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 |
free(zTag);
if( !rid ){
fossil_redirect_home();
return;
}
}
if( !g.perm.ApndWiki ){
login_needed(g.anon.ApndWiki);
return;
}
if( P("submit")!=0 && P("r")!=0 && P("u")!=0
&& (goodCaptcha = captcha_is_correct())
){
char *zDate;
Blob cksum;
|
| ︙ | ︙ | |||
746 747 748 749 750 751 752 |
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){
Stmt q;
const char *zPageName;
login_check_credentials();
| | | | | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 |
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){
Stmt q;
const char *zPageName;
login_check_credentials();
if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
zPageName = PD("name","");
style_header("History Of %s", zPageName);
db_prepare(&q, "%s AND event.objid IN "
" (SELECT rid FROM tagxref WHERE tagid="
"(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
" UNION SELECT attachid FROM attachment"
" WHERE target=%Q)"
"ORDER BY mtime DESC",
timeline_query_for_www(), zPageName, zPageName);
zWikiPageName = zPageName;
www_print_timeline(&q, TIMELINE_ARTID, 0, 0, 0, wiki_history_extra);
db_finalize(&q);
style_footer();
}
/*
** WEBPAGE: wdiff
** URL: /whistory?name=PAGENAME&a=RID1&b=RID2
**
** Show the difference between two wiki pages.
*/
void wdiff_page(void){
int rid1, rid2;
const char *zPageName;
Manifest *pW1, *pW2 = 0;
Blob w1, w2, d;
u64 diffFlags;
login_check_credentials();
rid1 = atoi(PD("a","0"));
if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
if( rid1==0 ) fossil_redirect_home();
rid2 = atoi(PD("b","0"));
zPageName = PD("name","");
style_header("Changes To %s", zPageName);
if( rid2==0 ){
rid2 = db_int(0,
|
| ︙ | ︙ | |||
823 824 825 826 827 828 829 |
**
** Used by wcontent_page() and the JSON wiki code.
*/
void wiki_prepare_page_list( Stmt * pStmt ){
db_prepare(pStmt,
"SELECT"
" substr(tagname, 6) as name,"
| | > | > | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 |
**
** Used by wcontent_page() and the JSON wiki code.
*/
void wiki_prepare_page_list( Stmt * pStmt ){
db_prepare(pStmt,
"SELECT"
" substr(tagname, 6) as name,"
" (SELECT value FROM tagxref WHERE tagid=tag.tagid"
" ORDER BY mtime DESC) as tagXref"
" FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname) /*sort*/"
);
}
/*
** WEBPAGE: wcontent
**
** all=1 Show deleted pages
**
** List all available wiki pages with date created and last modified.
*/
void wcontent_page(void){
Stmt q;
int showAll = P("all")!=0;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
style_header("Available Wiki Pages");
if( showAll ){
style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
}else{
style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
}
wiki_standard_submenu(W_ALL_BUT(W_LIST));
@ <ul>
wiki_prepare_page_list(&q);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
int size = db_column_int(&q, 1);
if( size>0 ){
@ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
|
| ︙ | ︙ | |||
873 874 875 876 877 878 879 |
** URL: /wfind?title=TITLE
** List all wiki pages whose titles contain the search text
*/
void wfind_page(void){
Stmt q;
const char *zTitle;
login_check_credentials();
| | | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 |
** URL: /wfind?title=TITLE
** List all wiki pages whose titles contain the search text
*/
void wfind_page(void){
Stmt q;
const char *zTitle;
login_check_credentials();
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
zTitle = PD("title","*");
style_header("Wiki Pages Found");
@ <ul>
db_prepare(&q,
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
" ORDER BY lower(tagname) /*sort*/" ,
zTitle);
|
| ︙ | ︙ | |||
912 913 914 915 916 917 918 | @ <li>Most ordinary HTML works.</li> @ <li><verbatim> and <nowiki>.</li> @ </ol> @ <p>We call the first five rules above "wiki" formatting rules. The @ last two rules are the HTML formatting rule.</p> @ <h2>Formatting Rule Details</h2> @ <ol> | | > | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | @ <li>Most ordinary HTML works.</li> @ <li><verbatim> and <nowiki>.</li> @ </ol> @ <p>We call the first five rules above "wiki" formatting rules. The @ last two rules are the HTML formatting rule.</p> @ <h2>Formatting Rule Details</h2> @ <ol> @ <li> <p><span class="wikiruleHead">Paragraphs</span>. @ Any sequence of one or more blank lines forms @ a paragraph break. Centered or right-justified paragraphs are not @ supported by wiki markup, but you can do these things if you need them @ using HTML.</p></li> @ <li> <p><span class="wikiruleHead">Bullet Lists</span>. @ A bullet list item is a line that begins with a single "*" character @ surrounded on @ both sides by two or more spaces or by a tab. Only a single level |
| ︙ | ︙ | |||
937 938 939 940 941 942 943 |
@ HTML for deeper indentation.</p></li>
@ <li> <p><span class="wikiruleHead">Hyperlinks</span>.
@ Text within square brackets ("[...]") becomes a hyperlink. The
@ target can be a wiki page name, the artifact ID of a check-in or ticket,
@ the name of an image, or a URL. By default, the target is displayed
@ as the text of the hyperlink. But you can specify alternative text
@ after the target name separated by a "|" character.</p>
| | > | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 |
@ HTML for deeper indentation.</p></li>
@ <li> <p><span class="wikiruleHead">Hyperlinks</span>.
@ Text within square brackets ("[...]") becomes a hyperlink. The
@ target can be a wiki page name, the artifact ID of a check-in or ticket,
@ the name of an image, or a URL. By default, the target is displayed
@ as the text of the hyperlink. But you can specify alternative text
@ after the target name separated by a "|" character.</p>
@ <p>You can also link to internal anchor names using [#anchor-name],
@ providing
@ you have added the necessary "<a name='anchor-name'></a>"
@ tag to your wiki page.</p></li>
@ <li> <p><span class="wikiruleHead">HTML</span>.
@ The following standard HTML elements may be used:
show_allowed_wiki_markup();
@ . There are two non-standard elements available:
@ <verbatim> and <nowiki>.
|
| ︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 |
manifest_destroy(pWiki);
blob_reset(&content);
}else if( strncmp(g.argv[2],"delete",n)==0 ){
if( g.argc!=5 ){
usage("delete PAGENAME");
}
fossil_fatal("delete not yet implemented.");
| | > | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
manifest_destroy(pWiki);
blob_reset(&content);
}else if( strncmp(g.argv[2],"delete",n)==0 ){
if( g.argc!=5 ){
usage("delete PAGENAME");
}
fossil_fatal("delete not yet implemented.");
}else if(( strncmp(g.argv[2],"list",n)==0 )
|| ( strncmp(g.argv[2],"ls",n)==0 )){
Stmt q;
db_prepare(&q,
"SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname) /*sort*/"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
760 761 762 763 764 765 766 | /* ** z[] is an HTML markup element - something that begins with '<'. ** Parse this element into the p structure. ** ** The content of z[] might be modified by converting characters ** to lowercase and by inserting some "\000" characters. */ | | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
/*
** z[] is an HTML markup element - something that begins with '<'.
** Parse this element into the p structure.
**
** The content of z[] might be modified by converting characters
** to lowercase and by inserting some "\000" characters.
*/
static int parseMarkup(ParsedMarkup *p, char *z){
int i, j, c;
int iACode;
char *zValue;
int seen = 0;
char zTag[100];
if( z[1]=='/' ){
|
| ︙ | ︙ | |||
792 793 794 795 796 797 798 |
p->aAttr[0].iACode = iACode = ATTR_ID;
i++;
p->aAttr[0].zValue = &z[i];
while( fossil_isalnum(z[i]) ){ i++; }
p->aAttr[0].cTerm = c = z[i];
z[i++] = 0;
p->nAttr = 1;
| | | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 |
p->aAttr[0].iACode = iACode = ATTR_ID;
i++;
p->aAttr[0].zValue = &z[i];
while( fossil_isalnum(z[i]) ){ i++; }
p->aAttr[0].cTerm = c = z[i];
z[i++] = 0;
p->nAttr = 1;
if( c=='>' ) return 0;
}
while( fossil_isspace(z[i]) ){ i++; }
while( c!='>' && p->nAttr<8 && fossil_isalpha(z[i]) ){
int attrOk; /* True to preserve attribute. False to ignore it */
j = 0;
while( fossil_isalnum(z[i]) ){
if( j<sizeof(zTag)-1 ) zTag[j++] = fossil_tolower(z[i]);
|
| ︙ | ︙ | |||
839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
if( attrOk ){
seen |= aAttribute[iACode].iMask;
p->nAttr++;
}
while( fossil_isspace(z[i]) ){ i++; }
if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
}
}
/*
** Render markup on the given blob.
*/
static void renderMarkup(Blob *pOut, ParsedMarkup *p){
int i;
| > | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 |
if( attrOk ){
seen |= aAttribute[iACode].iMask;
p->nAttr++;
}
while( fossil_isspace(z[i]) ){ i++; }
if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
}
return seen;
}
/*
** Render markup on the given blob.
*/
static void renderMarkup(Blob *pOut, ParsedMarkup *p){
int i;
|
| ︙ | ︙ | |||
958 959 960 961 962 963 964 |
** output its end tag if it is not a </div> tag.
*/
static void popStack(Renderer *p){
if( p->nStack ){
int iCode;
p->nStack--;
iCode = p->aStack[p->nStack].iCode;
| | | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
** output its end tag if it is not a </div> tag.
*/
static void popStack(Renderer *p){
if( p->nStack ){
int iCode;
p->nStack--;
iCode = p->aStack[p->nStack].iCode;
if( (iCode!=MARKUP_DIV || p->aStack[p->nStack].zId==0) && p->pOut ){
blob_appendf(p->pOut, "</%s>", aMarkup[iCode].zName);
}
}
}
/*
** Push a new markup value onto the stack. Enlarge the stack
|
| ︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 |
if( strncmp(zTarget, "http:", 5)==0
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
}else if( zTarget[0]=='/' ){
| | | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 |
if( strncmp(zTarget, "http:", 5)==0
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
}else if( zTarget[0]=='/' ){
blob_appendf(p->pOut, "<a href=\"%R%h\">", zTarget);
}else if( zTarget[0]=='.'
&& (zTarget[1]=='/' || (zTarget[1]=='.' && zTarget[2]=='/'))
&& (p->state & WIKI_LINKSONLY)==0 ){
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
}else if( zTarget[0]=='#' ){
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
}else if( is_valid_uuid(zTarget) ){
|
| ︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 |
blob_append(p->pOut, z, n);
}
break;
}
case TOKEN_MARKUP: {
const char *zId;
int iDiv;
| | | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
blob_append(p->pOut, z, n);
}
break;
}
case TOKEN_MARKUP: {
const char *zId;
int iDiv;
int mAttr = parseMarkup(&markup, z);
/* Convert <title> to <h1 align='center'> */
if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
markup.iCode = MARKUP_H1;
markup.nAttr = 1;
markup.aAttr[0].iACode = AMSK_ALIGN;
markup.aAttr[0].zValue = "center";
|
| ︙ | ︙ | |||
1565 1566 1567 1568 1569 1570 1571 |
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(p, markup.iCode);
}else
/* Push <div> markup onto the stack together with the id=ID attribute.
*/
| | | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 |
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(p, markup.iCode);
}else
/* Push <div> markup onto the stack together with the id=ID attribute.
*/
if( markup.iCode==MARKUP_DIV && (mAttr & ATTR_ID)!=0 ){
pushStackWithId(p, markup.iCode, markupId(&markup),
(p->state & ALLOW_WIKI)!=0);
}else
/* Enter <verbatim> processing. With verbatim enabled, all other
** markup other than the corresponding end-tag with the same ID is
** ignored.
|
| ︙ | ︙ | |||
1963 1964 1965 1966 1967 1968 1969 |
** Get the next HTML token.
**
** z points to the start of a token. Return the number of
** characters in that token.
*/
static int nextHtmlToken(const char *z){
int n;
| > | | > > > > > | > > > | 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 |
** Get the next HTML token.
**
** z points to the start of a token. Return the number of
** characters in that token.
*/
static int nextHtmlToken(const char *z){
int n;
char c;
if( (c=z[0])=='<' ){
n = markupLength(z);
if( n<=0 ) n = 1;
}else if( fossil_isspace(c) ){
for(n=1; z[n] && fossil_isspace(z[n]); n++){}
}else if( c=='&' ){
n = z[1]=='#' ? 2 : 1;
while( fossil_isalnum(z[n]) ) n++;
if( z[n]==';' ) n++;
}else{
n = 1;
for(n=1; 1; n++){
if( (c = z[n]) > '<' ) continue;
if( c=='<' || c=='&' || fossil_isspace(c) || c==0 ) break;
}
}
return n;
}
/*
** Attempt to reformat messy HTML to be easily readable by humans.
**
|
| ︙ | ︙ | |||
2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 |
int i;
for(i=2; i<g.argc; i++){
blob_read_from_file(&in, g.argv[i]);
blob_zero(&out);
htmlTidy(blob_str(&in), &out);
blob_reset(&in);
fossil_puts(blob_str(&out), 0);
blob_reset(&out);
}
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 |
int i;
for(i=2; i<g.argc; i++){
blob_read_from_file(&in, g.argv[i]);
blob_zero(&out);
htmlTidy(blob_str(&in), &out);
blob_reset(&in);
fossil_puts(blob_str(&out), 0);
blob_reset(&out);
}
}
/*
** Remove all HTML markup from the input text. The output written into
** pOut is pure text.
**
** Put the title on the first line, if there is any <title> markup.
** If there is no <title>, then create a blank first line.
*/
void html_to_plaintext(const char *zIn, Blob *pOut){
int n;
int i, j;
int inTitle = 0; /* True between <title>...</title> */
int seenText = 0; /* True after first non-whitespace seen */
int nNL = 0; /* Number of \n characters at the end of pOut */
int nWS = 0; /* True if pOut ends with whitespace */
while( fossil_isspace(zIn[0]) ) zIn++;
while( zIn[0] ){
n = nextHtmlToken(zIn);
if( zIn[0]=='<' && n>1 ){
int isCloseTag;
int eTag;
int eType;
char zTag[32];
isCloseTag = zIn[1]=='/';
for(i=0, j=1+isCloseTag; i<30 && fossil_isalnum(zIn[j]); i++, j++){
zTag[i] = fossil_tolower(zIn[j]);
}
zTag[i] = 0;
eTag = findTag(zTag);
eType = aMarkup[eTag].iType;
if( eTag==MARKUP_INVALID && fossil_strnicmp(zIn,"<style",6)==0 ){
zIn += n;
while( zIn[0] ){
n = nextHtmlToken(zIn);
if( fossil_strnicmp(zIn, "</style",7)==0 ) break;
zIn += n;
}
if( zIn[0]=='<' ) zIn += n;
continue;
}
if( eTag==MARKUP_TITLE ){
inTitle = !isCloseTag;
}
if( !isCloseTag && seenText && (eType & (MUTYPE_BLOCK|MUTYPE_TABLE))!=0 ){
if( nNL==0 ){
blob_append(pOut, "\n", 1);
nNL++;
}
nWS = 1;
}
}else if( fossil_isspace(zIn[0]) ){
if( seenText ){
nNL = 0;
if( !inTitle ){ /* '\n' -> ' ' within <title> */
for(i=0; i<n; i++) if( zIn[i]=='\n' ) nNL++;
}
if( !nWS ){
blob_append(pOut, nNL ? "\n" : " ", 1);
nWS = 1;
}
}
}else if( zIn[0]=='&' ){
char c = '?';
if( zIn[1]=='#' ){
int x = atoi(&zIn[1]);
if( x>0 && x<=127 ) c = x;
}else{
static const struct { int n; char c; char *z; } aEntity[] = {
{ 5, '&', "&" },
{ 4, '<', "<" },
{ 4, '>', ">" },
{ 6, ' ', " " },
};
int jj;
for(jj=0; jj<ArraySize(aEntity); jj++){
if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){
c = aEntity[jj].c;
break;
}
}
}
if( fossil_isspace(c) ){
if( nWS==0 && seenText ) blob_append(pOut, &c, 1);
nWS = 1;
nNL = c=='\n';
}else{
if( !seenText && !inTitle ) blob_append(pOut, "\n", 1);
seenText = 1;
nNL = nWS = 0;
blob_append(pOut, &c, 1);
}
}else{
if( !seenText && !inTitle ) blob_append(pOut, "\n", 1);
seenText = 1;
nNL = nWS = 0;
blob_append(pOut, zIn, n);
}
zIn += n;
}
if( nNL==0 ) blob_append(pOut, "\n", 1);
}
/*
** COMMAND: test-html-to-text
*/
void test_html_to_text(void){
Blob in, out;
int i;
for(i=2; i<g.argc; i++){
blob_read_from_file(&in, g.argv[i]);
blob_zero(&out);
html_to_plaintext(blob_str(&in), &out);
blob_reset(&in);
fossil_puts(blob_str(&out), 0);
blob_reset(&out);
}
}
|
Changes to src/winhttp.c.
| ︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
}
if( zFileGlob ){
blob_appendf(&options, " --files-urlenc %T", zFileGlob);
}
if( g.useLocalauth ){
blob_appendf(&options, " --localauth");
}
if( WSAStartup(MAKEWORD(1,1), &wd) ){
fossil_fatal("unable to initialize winsock");
}
while( iPort<=mxPort ){
s = socket(AF_INET, SOCK_STREAM, 0);
if( s==INVALID_SOCKET ){
fossil_fatal("unable to create a socket");
| > > > | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
}
if( zFileGlob ){
blob_appendf(&options, " --files-urlenc %T", zFileGlob);
}
if( g.useLocalauth ){
blob_appendf(&options, " --localauth");
}
if( flags & HTTP_SERVER_REPOLIST ){
blob_appendf(&options, " --repolist");
}
if( WSAStartup(MAKEWORD(1,1), &wd) ){
fossil_fatal("unable to initialize winsock");
}
while( iPort<=mxPort ){
s = socket(AF_INET, SOCK_STREAM, 0);
if( s==INVALID_SOCKET ){
fossil_fatal("unable to create a socket");
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1964 1965 1966 1967 1968 1969 1970 |
fossil_warning("*** time skew *** server is slow by %s",
db_timespan_name(-rSkew));
g.clockSkewSeen = 1;
}
fossil_force_newline();
fossil_print(
| | | | 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 |
fossil_warning("*** time skew *** server is slow by %s",
db_timespan_name(-rSkew));
g.clockSkewSeen = 1;
}
fossil_force_newline();
fossil_print(
"%s done, sent: %lld received: %lld ip: %s\n",
zOpType, nSent, nRcvd, g.zIpAddr);
transport_close(&g.url);
transport_global_shutdown(&g.url);
if( nErr && go==2 ){
db_multi_exec("DROP TABLE onremote");
manifest_crosslink_end(MC_PERMIT_HOOKS);
content_enable_dephantomize(1);
db_end_transaction(0);
|
| ︙ | ︙ |
Changes to src/xfersetup.c.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 |
/*
** Main sub-menu for configuring the transfer system.
** WEBPAGE: xfersetup
*/
void xfersetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
| | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
/*
** Main sub-menu for configuring the transfer system.
** WEBPAGE: xfersetup
*/
void xfersetup_page(void){
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Transfer Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Common", "xfersetup_com",
"Common TH1 code run before all transfer request processing.");
|
| ︙ | ︙ | |||
102 103 104 105 106 107 108 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
| | > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
int height /* Height of the edit box */
){
const char *z;
int isSubmit;
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
if( P("setup") ){
cgi_redirect("xfersetup");
}
isSubmit = P("submit")!=0;
z = P("x");
if( z==0 ){
|
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
446 447 448 449 450 451 452 | int rid; char *zName, *zRid; int nName, nRid; Blob zip; char *zKey; login_check_credentials(); | | | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
int rid;
char *zName, *zRid;
int nName, nRid;
Blob zip;
char *zKey;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
load_control();
zName = mprintf("%s", PD("name",""));
nName = strlen(zName);
zRid = mprintf("%s", PD("uuid","trunk"));
nRid = strlen(zRid);
if( nName>4 && fossil_strcmp(&zName[nName-4], ".zip")==0 ){
/* Special case: Remove the ".zip" suffix. */
|
| ︙ | ︙ | |||
470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
}
}
}
rid = name_to_typed_rid(nRid?zRid:zName,"ci");
if( rid==0 ){
@ Not found
return;
}
if( nRid==0 && nName>10 ) zName[10] = 0;
zKey = db_text(0, "SELECT '/zip/'||uuid||'/%q' FROM blob WHERE rid=%d",zName,rid);
blob_zero(&zip);
if( cache_read(&zip, zKey)==0 ){
zip_of_baseline(rid, &zip, zName);
cache_write(&zip, zKey);
| > > > > > > > > > > > | 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 |
}
}
}
rid = name_to_typed_rid(nRid?zRid:zName,"ci");
if( rid==0 ){
@ Not found
return;
}
if( referred_from_login() ){
style_header("ZIP Archive Download");
@ <form action='%R/zip'>
cgi_query_parameters_to_hidden();
@ <p>ZIP Archive named <b>%h(zName).zip</b> holding the content
@ of check-in <b>%h(zRid)</b>:
@ <input type="submit" value="Download" />
@ </form>
style_footer();
return;
}
if( nRid==0 && nName>10 ) zName[10] = 0;
zKey = db_text(0, "SELECT '/zip/'||uuid||'/%q' FROM blob WHERE rid=%d",zName,rid);
blob_zero(&zip);
if( cache_read(&zip, zKey)==0 ){
zip_of_baseline(rid, &zip, zName);
cache_write(&zip, zKey);
|
| ︙ | ︙ |
Added test/fileage-test-1.wiki.
> > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
This page contains URLs for file-age computations that have given
trouble in the past. Shif-click on on the links, one-by-one, to verify
that the current implementation works correctly:
* [/fileage?name=c9df0dcdaa402] - Verify that the many
execute permission changes that occurred about 24 hours before
check-in c9df0dcdaa402 do not appear as file changes.
* [/tree?ci=c9df0dcdaa40&mtime=0&type=tree] - Verify that all
three skin files (css.txt, footer.txt, and header.txt) appear
in all of the skin/*/ folders.
* On both of the above, check for excessive computation time.
|
Changes to test/graph-test-1.wiki.
| ︙ | ︙ | |||
67 68 69 70 71 72 73 |
target="testwindow">
This timeline has a hidden commit.</a> Click Unhide to reveal.
External:
* <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd"
target="testwindow">Timewarp due to a mis-configured system clock.</a>
| > > > | 67 68 69 70 71 72 73 74 75 76 |
target="testwindow">
This timeline has a hidden commit.</a> Click Unhide to reveal.
External:
* <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd"
target="testwindow">Timewarp due to a mis-configured system clock.</a>
* <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test"
target="testwindow">Show all three separate deletions of "id.test".
(Scroll down for the third deletion.)
|
Changes to test/release-checklist.wiki.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | [./graph-test-1.wiki] document and verify that all graphs are rendered correctly. <li><p> Click on each of the links in in the [./diff-test-1.wiki] document and verify that all diffs are rendered correctly. <li><p> Click on the following link to verify that it works: [./test-page%2b%2b.wiki | ./test-page++.wiki] (NB: Many web servers automatically block or rewrite URLs that contain "+" characters, even when those "+" characters are encoded as "%2B". On such web servers, the URL above will not work. This test is only guaranteed to work when running "fossil ui".) <li><p> Verify correct name-change tracking behavior (no net changes) for: <blockquote><b> fossil test-name-changes --debug b120bc8b262ac 374920b20944b </b></blockquote> <li><p> | > > > > > | 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 | [./graph-test-1.wiki] document and verify that all graphs are rendered correctly. <li><p> Click on each of the links in in the [./diff-test-1.wiki] document and verify that all diffs are rendered correctly. <li><p> Click on the following link to verify that it works: [./test-page%2b%2b.wiki | ./test-page++.wiki] (NB: Many web servers automatically block or rewrite URLs that contain "+" characters, even when those "+" characters are encoded as "%2B". On such web servers, the URL above will not work. This test is only guaranteed to work when running "fossil ui".) <li><p> Shift-click on each of the links in [./fileage-test-1.wiki] and verify correct operation of the file-age computation. <li><p> Verify correct name-change tracking behavior (no net changes) for: <blockquote><b> fossil test-name-changes --debug b120bc8b262ac 374920b20944b </b></blockquote> <li><p> |
| ︙ | ︙ |
Changes to test/th1-tcl.test.
| ︙ | ︙ | |||
30 31 32 33 34 35 36 | ############################################################################### set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. ############################################################################### | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
###############################################################################
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl1.txt]]
test th1-tcl-1 {[regexp -- {^tclReady\(before\) = 0
tclReady\(after\) = 1
\d+
\d+
\d+
|
| ︙ | ︙ | |||
57 58 59 60 61 62 63 | \d+ one_word three words now $} [string map [list \r\n \n] $RESULT]]} ############################################################################### | | | | | | | | | | | 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 |
\d+
one_word
three words now
$} [string map [list \r\n \n] $RESULT]]}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl2.txt]]
test th1-tcl-2 {[regexp -- {^\d+
$} [string map [list \r\n \n] $RESULT]]}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl3.txt]]
test th1-tcl-3 {$RESULT eq {<hr><p class="thmainError">ERROR:\
invalid command name "bad_command"</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl4.txt]]
test th1-tcl-4 {$RESULT eq {<hr><p class="thmainError">ERROR:\
divide by zero</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl5.txt]]
test th1-tcl-5 {$RESULT eq {<hr><p class="thmainError">ERROR:\
Tcl command not found: bad_command</p>} || $RESULT eq {<hr><p\
class="thmainError">ERROR: invalid command name "bad_command"</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl6.txt]]
test th1-tcl-6 {$RESULT eq {<hr><p class="thmainError">ERROR:\
no such command: bad_command</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl7.txt]]
test th1-tcl-7 {$RESULT eq {<hr><p class="thmainError">ERROR:\
syntax error in expression: "2**0"</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl8.txt]]
test th1-tcl-8 {$RESULT eq {<hr><p class="thmainError">ERROR:\
cannot invoke Tcl command: tailcall</p>} || $RESULT eq {<hr><p\
class="thmainError">ERROR: tailcall can only be called from a proc or\
lambda</p>} || $RESULT eq {<hr><p class="thmainError">ERROR: This test\
requires Tcl 8.6 or higher.</p>}}
###############################################################################
fossil test-th-render --open-config \
[file nativename [file join $dir th1-tcl9.txt]]
test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 3 \
[list test-th-render --open-config [file nativename [file join $dir \
th1-tcl9.txt]]]]}
|
Changes to test/th1.test.
| ︙ | ︙ | |||
14 15 16 17 18 19 20 | # http://www.hwaci.com/drh/ # ############################################################################ # # TH1 Commands # | | | | | | | | | | | | | 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 |
# http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Commands
#
fossil test-th-eval --open-config "setting th1-hooks"
set th1Hooks [expr {$RESULT eq "1"}]
###############################################################################
fossil test-th-eval --open-config "setting abc"
test th1-setting-1 {$RESULT eq ""}
###############################################################################
fossil test-th-eval --open-config "setting -- abc"
test th1-setting-2 {$RESULT eq ""}
###############################################################################
fossil test-th-eval --open-config "setting -strict abc"
test th1-setting-3 {$RESULT eq {TH_ERROR: no value for setting "abc"}}
###############################################################################
fossil test-th-eval --open-config "setting -strict -- abc"
test th1-setting-4 {$RESULT eq {TH_ERROR: no value for setting "abc"}}
###############################################################################
fossil test-th-eval --open-config "setting autosync"
test th1-setting-5 {$RESULT eq 0 || $RESULT eq 1}
###############################################################################
fossil test-th-eval --open-config "setting -strict autosync"
test th1-setting-6 {$RESULT eq 0 || $RESULT eq 1}
###############################################################################
fossil test-th-eval --open-config "setting --"
test th1-setting-7 {$RESULT eq \
{TH_ERROR: wrong # args: should be "setting ?-strict? ?--? name"}}
###############################################################################
fossil test-th-eval --open-config "setting -strict --"
test th1-setting-8 {$RESULT eq \
{TH_ERROR: wrong # args: should be "setting ?-strict? ?--? name"}}
###############################################################################
fossil test-th-eval --open-config "setting -- --"
test th1-setting-9 {$RESULT eq {}}
###############################################################################
fossil test-th-eval --open-config "setting -strict -- --"
test th1-setting-10 {$RESULT eq {TH_ERROR: no value for setting "--"}}
###############################################################################
fossil test-th-eval "expr 42/0"
test th1-divide-by-zero-1 {$RESULT eq {TH_ERROR: Divide by 0: 42}}
|
| ︙ | ︙ | |||
593 594 595 596 597 598 599 |
###############################################################################
fossil test-th-eval "styleHeader {Page Title Here}"
test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
| | | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
###############################################################################
fossil test-th-eval "styleHeader {Page Title Here}"
test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "styleHeader {Page Title Here}"
test th1-header-2 {[regexp -- {<title>Fossil: Page Title Here</title>} $RESULT]}
###############################################################################
fossil test-th-eval "styleFooter"
test th1-footer-1 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "styleFooter"
test th1-footer-2 {$RESULT eq {}}
###############################################################################
fossil test-th-eval --open-config --cgi "styleHeader {}; styleFooter"
test th1-footer-3 {[regexp -- {</body></html>} $RESULT]}
###############################################################################
fossil test-th-eval "getParameter"
test th1-get-parameter-1 {$RESULT eq \
{TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}}
|
| ︙ | ︙ | |||
676 677 678 679 680 681 682 |
###############################################################################
fossil test-th-eval "artifact tip"
test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
| | | | | | | | | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
###############################################################################
fossil test-th-eval "artifact tip"
test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "artifact tip"
test th1-artifact-3 {[regexp -- {F test/th1\.test [0-9a-f]{40}} $RESULT]}
###############################################################################
fossil test-th-eval "artifact 0000000000"
test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "artifact 0000000000"
test th1-artifact-5 {$RESULT eq {TH_ERROR: name not found}}
###############################################################################
fossil test-th-eval "artifact tip test/th1.test"
test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "artifact tip test/th1.test"
test th1-artifact-7 {[regexp -- {th1-artifact-7} $RESULT]}
###############################################################################
fossil test-th-eval "artifact 0000000000 test/th1.test"
test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}}
###############################################################################
fossil test-th-eval --open-config "artifact 0000000000 test/th1.test"
test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}}
###############################################################################
fossil test-th-eval "globalState checkout"
test th1-globalState-1 {[string length $RESULT] > 0}
###############################################################################
fossil test-th-eval "globalState checkout"
test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]}
###############################################################################
fossil test-th-eval "globalState configuration"
test th1-globalState-3 {[string length $RESULT] == 0}
###############################################################################
fossil test-th-eval --open-config "globalState configuration"
test th1-globalState-4 {[string length $RESULT] > 0}
###############################################################################
fossil test-th-eval "globalState executable"
test th1-globalState-5 {[file rootname [file tail $RESULT]] eq "fossil"}
|
| ︙ | ︙ |
Changes to win/Makefile.PellesCGMake.
| ︙ | ︙ | |||
81 82 83 84 85 86 87 | UTILS_OBJ=$(UTILS:.exe=.obj) UTILS_SRC=$(foreach uf,$(UTILS),$(SRCDIR)$(uf:.exe=.c)) # define the SQLite files, which need special flags on compile SQLITESRC=sqlite3.c ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf)) SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | UTILS_OBJ=$(UTILS:.exe=.obj) UTILS_SRC=$(foreach uf,$(UTILS),$(SRCDIR)$(uf:.exe=.c)) # define the SQLite files, which need special flags on compile SQLITESRC=sqlite3.c ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf)) SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_WIN32_NO_ANSI # define the SQLite shell files, which need special flags on compile SQLITESHELLSRC=shell.c ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf)) SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj)) SQLITESHELLDEFINES=-Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen |
| ︙ | ︙ | |||
139 140 141 142 143 144 145 | translate.exe $< >$@ # generate the index source, containing all web references,.. page_index.h: $(TRANSLATEDSRC) mkindex.exe mkindex.exe $(TRANSLATEDSRC) >$@ builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | translate.exe $< >$@ # generate the index source, containing all web references,.. page_index.h: $(TRANSLATEDSRC) mkindex.exe mkindex.exe $(TRANSLATEDSRC) >$@ builtin_data.h: $(EXTRA_FILES) mkbuiltin.exe mkbuiltin.exe --prefix $(SRCDIR)/ $(EXTRA_FILES) >$@ # extracting version info from manifest VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION version.exe ..\manifest.uuid ..\manifest ..\VERSION >$@ # generate the simplified headers headers: makeheaders.exe page_index.h builtin_data.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h |
| ︙ | ︙ |
Changes to win/Makefile.dmc.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 | SSL = CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 | | | | | | 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 | SSL = CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fusefs_.c glob_.c graph_.c gzip_.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 pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$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)\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)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$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)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$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)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$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 allrepo attach bag bisect blob branch browse builtin bundle cache captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode event export file finfo foci fusefs glob graph gzip 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 pivot popen pqueue printf publish purge rebuild regexp report rss schema search setup sha1 shun sitemap skins sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode update url user utf8 util verify vfile 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 |
| ︙ | ︙ | |||
94 95 96 97 98 99 100 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION +$** > $@ page_index.h: mkindex$E $(SRC) +$** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION +$** > $@ page_index.h: mkindex$E $(SRC) +$** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) mkbuiltin$E --prefix $(SRCDIR)/ $(EXTRA_FILES) > $@ clean: -del $(OBJDIR)\*.obj -del *.obj *_.c *.h *.map realclean: -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E codecheck1$E mkbuiltin$E |
| ︙ | ︙ | |||
672 673 674 675 676 677 678 679 680 681 682 683 684 685 | +translate$E $** > $@ $(OBJDIR)\stat$O : stat_.c stat.h $(TCC) -o$@ -c stat_.c stat_.c : $(SRCDIR)\stat.c +translate$E $** > $@ $(OBJDIR)\style$O : style_.c style.h $(TCC) -o$@ -c style_.c style_.c : $(SRCDIR)\style.c +translate$E $** > $@ | > > > > > > | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | +translate$E $** > $@ $(OBJDIR)\stat$O : stat_.c stat.h $(TCC) -o$@ -c stat_.c stat_.c : $(SRCDIR)\stat.c +translate$E $** > $@ $(OBJDIR)\statrep$O : statrep_.c statrep.h $(TCC) -o$@ -c statrep_.c statrep_.c : $(SRCDIR)\statrep.c +translate$E $** > $@ $(OBJDIR)\style$O : style_.c style.h $(TCC) -o$@ -c style_.c style_.c : $(SRCDIR)\style.c +translate$E $** > $@ |
| ︙ | ︙ | |||
824 825 826 827 828 829 830 | $(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 | | | 830 831 832 833 834 835 836 837 838 | $(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 allrepo_.c:allrepo.h attach_.c:attach.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 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 db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h fusefs_.c:fusefs.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.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 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 report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.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 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 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 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.
| ︙ | ︙ | |||
144 145 146 147 148 149 150 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | > | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2 OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If # this points to the Tcl source code directory, this directory must # have "generic" and "win" sub-directories. The recommended usage |
| ︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ | > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/statrep.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ |
| ︙ | ︙ | |||
481 482 483 484 485 486 487 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ | > > > > > > > > > > > > > > > > > > > > > > > > | > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ $(SRCDIR)/../skins/black_and_white/css.txt \ $(SRCDIR)/../skins/black_and_white/footer.txt \ $(SRCDIR)/../skins/black_and_white/header.txt \ $(SRCDIR)/../skins/default/css.txt \ $(SRCDIR)/../skins/default/footer.txt \ $(SRCDIR)/../skins/default/header.txt \ $(SRCDIR)/../skins/eagle/css.txt \ $(SRCDIR)/../skins/eagle/footer.txt \ $(SRCDIR)/../skins/eagle/header.txt \ $(SRCDIR)/../skins/enhanced1/css.txt \ $(SRCDIR)/../skins/enhanced1/footer.txt \ $(SRCDIR)/../skins/enhanced1/header.txt \ $(SRCDIR)/../skins/etienne1/css.txt \ $(SRCDIR)/../skins/etienne1/footer.txt \ $(SRCDIR)/../skins/etienne1/header.txt \ $(SRCDIR)/../skins/khaki/css.txt \ $(SRCDIR)/../skins/khaki/footer.txt \ $(SRCDIR)/../skins/khaki/header.txt \ $(SRCDIR)/../skins/plain_gray/css.txt \ $(SRCDIR)/../skins/plain_gray/footer.txt \ $(SRCDIR)/../skins/plain_gray/header.txt \ $(SRCDIR)/../skins/rounded1/css.txt \ $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/markdown.md TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/allrepo_.c \ $(OBJDIR)/attach_.c \ $(OBJDIR)/bag_.c \ $(OBJDIR)/bisect_.c \ |
| ︙ | ︙ | |||
576 577 578 579 580 581 582 583 584 585 586 587 588 589 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ | > | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/statrep_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ |
| ︙ | ︙ | |||
695 696 697 698 699 700 701 702 703 704 705 706 707 708 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.o \ $(OBJDIR)/sqlcmd.o \ $(OBJDIR)/stash.o \ $(OBJDIR)/stat.o \ $(OBJDIR)/style.o \ $(OBJDIR)/sync.o \ $(OBJDIR)/tag.o \ $(OBJDIR)/tar.o \ $(OBJDIR)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ | > | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.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)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ |
| ︙ | ︙ | |||
912 913 914 915 916 917 918 | innosetup: $(OBJDIR) $(APPNAME) $(INNOSETUP) ./setup/fossil.iss -DAppVersion=$(shell $(CAT) ./VERSION) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(MKINDEX) $(MKINDEX) $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(MKBUILTIN) $(EXTRA_FILES) | | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | innosetup: $(OBJDIR) $(APPNAME) $(INNOSETUP) ./setup/fossil.iss -DAppVersion=$(shell $(CAT) ./VERSION) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(MKINDEX) $(MKINDEX) $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(MKBUILTIN) $(EXTRA_FILES) $(MKBUILTIN) --prefix $(SRCDIR)/ $(EXTRA_FILES) >$@ $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/builtin_data.h $(MAKEHEADERS) $(OBJDIR)/VERSION.h $(MAKEHEADERS) $(OBJDIR)/add_.c:$(OBJDIR)/add.h \ $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h \ $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h \ $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h \ $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \ |
| ︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ | > | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/statrep_.c:$(OBJDIR)/statrep.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ |
| ︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c | > > > > > > > > | 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/statrep_.c: $(SRCDIR)/statrep.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/statrep.c >$@ $(OBJDIR)/statrep.o: $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/statrep.o -c $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c |
| ︙ | ︙ | |||
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 |
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_WIN32_NO_ANSI \
-D_HAVE__MINGW_H \
-DSQLITE_USE_MALLOC_H \
-DSQLITE_USE_MSIZE
SHELL_OPTIONS = -Dmain=sqlite3_shell \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
| > > | 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 |
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_WIN32_NO_ANSI \
-D_HAVE__MINGW_H \
-DSQLITE_USE_MALLOC_H \
-DSQLITE_USE_MSIZE
SHELL_OPTIONS = -Dmain=sqlite3_shell \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
|
| ︙ | ︙ |
Changes to win/Makefile.mingw.mistachkin.
| ︙ | ︙ | |||
144 145 146 147 148 149 150 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | > | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2 OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If # this points to the Tcl source code directory, this directory must # have "generic" and "win" sub-directories. The recommended usage |
| ︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ | > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | $(SRCDIR)/sha1.c \ $(SRCDIR)/shun.c \ $(SRCDIR)/sitemap.c \ $(SRCDIR)/skins.c \ $(SRCDIR)/sqlcmd.c \ $(SRCDIR)/stash.c \ $(SRCDIR)/stat.c \ $(SRCDIR)/statrep.c \ $(SRCDIR)/style.c \ $(SRCDIR)/sync.c \ $(SRCDIR)/tag.c \ $(SRCDIR)/tar.c \ $(SRCDIR)/th_main.c \ $(SRCDIR)/timeline.c \ $(SRCDIR)/tkt.c \ |
| ︙ | ︙ | |||
481 482 483 484 485 486 487 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ | > > > > > > > > > > > > > > > > > > > > > > > > | > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | $(SRCDIR)/winhttp.c \ $(SRCDIR)/wysiwyg.c \ $(SRCDIR)/xfer.c \ $(SRCDIR)/xfersetup.c \ $(SRCDIR)/zip.c EXTRA_FILES = \ $(SRCDIR)/../skins/black_and_white/css.txt \ $(SRCDIR)/../skins/black_and_white/footer.txt \ $(SRCDIR)/../skins/black_and_white/header.txt \ $(SRCDIR)/../skins/default/css.txt \ $(SRCDIR)/../skins/default/footer.txt \ $(SRCDIR)/../skins/default/header.txt \ $(SRCDIR)/../skins/eagle/css.txt \ $(SRCDIR)/../skins/eagle/footer.txt \ $(SRCDIR)/../skins/eagle/header.txt \ $(SRCDIR)/../skins/enhanced1/css.txt \ $(SRCDIR)/../skins/enhanced1/footer.txt \ $(SRCDIR)/../skins/enhanced1/header.txt \ $(SRCDIR)/../skins/etienne1/css.txt \ $(SRCDIR)/../skins/etienne1/footer.txt \ $(SRCDIR)/../skins/etienne1/header.txt \ $(SRCDIR)/../skins/khaki/css.txt \ $(SRCDIR)/../skins/khaki/footer.txt \ $(SRCDIR)/../skins/khaki/header.txt \ $(SRCDIR)/../skins/plain_gray/css.txt \ $(SRCDIR)/../skins/plain_gray/footer.txt \ $(SRCDIR)/../skins/plain_gray/header.txt \ $(SRCDIR)/../skins/rounded1/css.txt \ $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/markdown.md TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/allrepo_.c \ $(OBJDIR)/attach_.c \ $(OBJDIR)/bag_.c \ $(OBJDIR)/bisect_.c \ |
| ︙ | ︙ | |||
576 577 578 579 580 581 582 583 584 585 586 587 588 589 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ | > | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | $(OBJDIR)/sha1_.c \ $(OBJDIR)/shun_.c \ $(OBJDIR)/sitemap_.c \ $(OBJDIR)/skins_.c \ $(OBJDIR)/sqlcmd_.c \ $(OBJDIR)/stash_.c \ $(OBJDIR)/stat_.c \ $(OBJDIR)/statrep_.c \ $(OBJDIR)/style_.c \ $(OBJDIR)/sync_.c \ $(OBJDIR)/tag_.c \ $(OBJDIR)/tar_.c \ $(OBJDIR)/th_main_.c \ $(OBJDIR)/timeline_.c \ $(OBJDIR)/tkt_.c \ |
| ︙ | ︙ | |||
695 696 697 698 699 700 701 702 703 704 705 706 707 708 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.o \ $(OBJDIR)/sqlcmd.o \ $(OBJDIR)/stash.o \ $(OBJDIR)/stat.o \ $(OBJDIR)/style.o \ $(OBJDIR)/sync.o \ $(OBJDIR)/tag.o \ $(OBJDIR)/tar.o \ $(OBJDIR)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ | > | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | $(OBJDIR)/sha1.o \ $(OBJDIR)/shun.o \ $(OBJDIR)/sitemap.o \ $(OBJDIR)/skins.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)/th_main.o \ $(OBJDIR)/timeline.o \ $(OBJDIR)/tkt.o \ |
| ︙ | ︙ | |||
912 913 914 915 916 917 918 | innosetup: $(OBJDIR) $(APPNAME) $(INNOSETUP) ./setup/fossil.iss -DAppVersion=$(shell $(CAT) ./VERSION) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(MKINDEX) $(MKINDEX) $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(MKBUILTIN) $(EXTRA_FILES) | | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | innosetup: $(OBJDIR) $(APPNAME) $(INNOSETUP) ./setup/fossil.iss -DAppVersion=$(shell $(CAT) ./VERSION) $(OBJDIR)/page_index.h: $(TRANS_SRC) $(MKINDEX) $(MKINDEX) $(TRANS_SRC) >$@ $(OBJDIR)/builtin_data.h: $(MKBUILTIN) $(EXTRA_FILES) $(MKBUILTIN) --prefix $(SRCDIR)/ $(EXTRA_FILES) >$@ $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/builtin_data.h $(MAKEHEADERS) $(OBJDIR)/VERSION.h $(MAKEHEADERS) $(OBJDIR)/add_.c:$(OBJDIR)/add.h \ $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h \ $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h \ $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h \ $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h \ |
| ︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ | > | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h \ $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h \ $(OBJDIR)/sitemap_.c:$(OBJDIR)/sitemap.h \ $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h \ $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h \ $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h \ $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h \ $(OBJDIR)/statrep_.c:$(OBJDIR)/statrep.h \ $(OBJDIR)/style_.c:$(OBJDIR)/style.h \ $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h \ $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h \ $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h \ $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h \ $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h \ $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h \ |
| ︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c | > > > > > > > > | 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | $(OBJDIR)/stat_.c: $(SRCDIR)/stat.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/stat.c >$@ $(OBJDIR)/stat.o: $(OBJDIR)/stat_.c $(OBJDIR)/stat.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/stat.o -c $(OBJDIR)/stat_.c $(OBJDIR)/stat.h: $(OBJDIR)/headers $(OBJDIR)/statrep_.c: $(SRCDIR)/statrep.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/statrep.c >$@ $(OBJDIR)/statrep.o: $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/statrep.o -c $(OBJDIR)/statrep_.c $(OBJDIR)/statrep.h: $(OBJDIR)/headers $(OBJDIR)/style_.c: $(SRCDIR)/style.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/style.c >$@ $(OBJDIR)/style.o: $(OBJDIR)/style_.c $(OBJDIR)/style.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/style.o -c $(OBJDIR)/style_.c |
| ︙ | ︙ | |||
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 |
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_WIN32_NO_ANSI \
-D_HAVE__MINGW_H \
-DSQLITE_USE_MALLOC_H \
-DSQLITE_USE_MSIZE
SHELL_OPTIONS = -Dmain=sqlite3_shell \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
| > > | 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 |
SQLITE_OPTIONS = -DNDEBUG=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_WIN32_NO_ANSI \
-D_HAVE__MINGW_H \
-DSQLITE_USE_MALLOC_H \
-DSQLITE_USE_MSIZE
SHELL_OPTIONS = -Dmain=sqlite3_shell \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
|
| ︙ | ︙ |
Changes to win/Makefile.msc.
| ︙ | ︙ | |||
53 54 55 56 57 58 59 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # Uncomment to enable TH1 hooks # FOSSIL_ENABLE_TH1_HOOKS = 1 # Uncomment to enable Tcl support # FOSSIL_ENABLE_TCL = 1 !ifdef FOSSIL_ENABLE_SSL SSLDIR = $(B)\compat\openssl-1.0.2 SSLINCDIR = $(SSLDIR)\inc32 SSLLIBDIR = $(SSLDIR)\out32 SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... # BUGBUG (OpenSSL): Apparently, using "no-ssl*" here breaks the build. |
| ︙ | ︙ | |||
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
SQLITE_OPTIONS = /DNDEBUG=1 \
/DSQLITE_OMIT_LOAD_EXTENSION=1 \
/DSQLITE_ENABLE_LOCKING_STYLE=0 \
/DSQLITE_THREADSAFE=0 \
/DSQLITE_DEFAULT_FILE_FORMAT=4 \
/DSQLITE_OMIT_DEPRECATED \
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
/DSQLITE_WIN32_NO_ANSI
SHELL_OPTIONS = /Dmain=sqlite3_shell \
/DSQLITE_OMIT_LOAD_EXTENSION=1 \
/DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
/DSQLITE_SHELL_DBNAME_PROC=fossil_open \
/Daccess=file_access \
| > > | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
SQLITE_OPTIONS = /DNDEBUG=1 \
/DSQLITE_OMIT_LOAD_EXTENSION=1 \
/DSQLITE_ENABLE_LOCKING_STYLE=0 \
/DSQLITE_THREADSAFE=0 \
/DSQLITE_DEFAULT_FILE_FORMAT=4 \
/DSQLITE_OMIT_DEPRECATED \
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
/DSQLITE_ENABLE_FTS4 \
/DSQLITE_ENABLE_FTS3_PARENTHESIS \
/DSQLITE_WIN32_NO_ANSI
SHELL_OPTIONS = /Dmain=sqlite3_shell \
/DSQLITE_OMIT_LOAD_EXTENSION=1 \
/DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
/DSQLITE_SHELL_DBNAME_PROC=fossil_open \
/Daccess=file_access \
|
| ︙ | ︙ | |||
294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
sha1_.c \
shun_.c \
sitemap_.c \
skins_.c \
sqlcmd_.c \
stash_.c \
stat_.c \
style_.c \
sync_.c \
tag_.c \
tar_.c \
th_main_.c \
timeline_.c \
tkt_.c \
| > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
sha1_.c \
shun_.c \
sitemap_.c \
skins_.c \
sqlcmd_.c \
stash_.c \
stat_.c \
statrep_.c \
style_.c \
sync_.c \
tag_.c \
tar_.c \
th_main_.c \
timeline_.c \
tkt_.c \
|
| ︙ | ︙ | |||
320 321 322 323 324 325 326 |
winfile_.c \
winhttp_.c \
wysiwyg_.c \
xfer_.c \
xfersetup_.c \
zip_.c
| | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
winfile_.c \
winhttp_.c \
wysiwyg_.c \
xfer_.c \
xfersetup_.c \
zip_.c
EXTRA_FILES = $(SRCDIR)\../skins/black_and_white/css.txt \
$(SRCDIR)\../skins/black_and_white/footer.txt \
$(SRCDIR)\../skins/black_and_white/header.txt \
$(SRCDIR)\../skins/default/css.txt \
$(SRCDIR)\../skins/default/footer.txt \
$(SRCDIR)\../skins/default/header.txt \
$(SRCDIR)\../skins/eagle/css.txt \
$(SRCDIR)\../skins/eagle/footer.txt \
$(SRCDIR)\../skins/eagle/header.txt \
$(SRCDIR)\../skins/enhanced1/css.txt \
$(SRCDIR)\../skins/enhanced1/footer.txt \
$(SRCDIR)\../skins/enhanced1/header.txt \
$(SRCDIR)\../skins/etienne1/css.txt \
$(SRCDIR)\../skins/etienne1/footer.txt \
$(SRCDIR)\../skins/etienne1/header.txt \
$(SRCDIR)\../skins/khaki/css.txt \
$(SRCDIR)\../skins/khaki/footer.txt \
$(SRCDIR)\../skins/khaki/header.txt \
$(SRCDIR)\../skins/plain_gray/css.txt \
$(SRCDIR)\../skins/plain_gray/footer.txt \
$(SRCDIR)\../skins/plain_gray/header.txt \
$(SRCDIR)\../skins/rounded1/css.txt \
$(SRCDIR)\../skins/rounded1/footer.txt \
$(SRCDIR)\../skins/rounded1/header.txt \
$(SRCDIR)\diff.tcl \
$(SRCDIR)\markdown.md
OBJ = $(OX)\add$O \
$(OX)\allrepo$O \
$(OX)\attach$O \
$(OX)\bag$O \
$(OX)\bisect$O \
$(OX)\blob$O \
|
| ︙ | ︙ | |||
417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
$(OX)\shun$O \
$(OX)\sitemap$O \
$(OX)\skins$O \
$(OX)\sqlcmd$O \
$(OX)\sqlite3$O \
$(OX)\stash$O \
$(OX)\stat$O \
$(OX)\style$O \
$(OX)\sync$O \
$(OX)\tag$O \
$(OX)\tar$O \
$(OX)\th$O \
$(OX)\th_lang$O \
$(OX)\th_main$O \
| > | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
$(OX)\shun$O \
$(OX)\sitemap$O \
$(OX)\skins$O \
$(OX)\sqlcmd$O \
$(OX)\sqlite3$O \
$(OX)\stash$O \
$(OX)\stat$O \
$(OX)\statrep$O \
$(OX)\style$O \
$(OX)\sync$O \
$(OX)\tag$O \
$(OX)\tar$O \
$(OX)\th$O \
$(OX)\th_lang$O \
$(OX)\th_main$O \
|
| ︙ | ︙ | |||
591 592 593 594 595 596 597 598 599 600 601 602 603 604 | echo $(OX)\shun.obj >> $@ echo $(OX)\sitemap.obj >> $@ echo $(OX)\skins.obj >> $@ echo $(OX)\sqlcmd.obj >> $@ echo $(OX)\sqlite3.obj >> $@ echo $(OX)\stash.obj >> $@ echo $(OX)\stat.obj >> $@ echo $(OX)\style.obj >> $@ echo $(OX)\sync.obj >> $@ echo $(OX)\tag.obj >> $@ echo $(OX)\tar.obj >> $@ echo $(OX)\th.obj >> $@ echo $(OX)\th_lang.obj >> $@ echo $(OX)\th_main.obj >> $@ | > | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | echo $(OX)\shun.obj >> $@ echo $(OX)\sitemap.obj >> $@ echo $(OX)\skins.obj >> $@ echo $(OX)\sqlcmd.obj >> $@ echo $(OX)\sqlite3.obj >> $@ echo $(OX)\stash.obj >> $@ echo $(OX)\stat.obj >> $@ echo $(OX)\statrep.obj >> $@ echo $(OX)\style.obj >> $@ echo $(OX)\sync.obj >> $@ echo $(OX)\tag.obj >> $@ echo $(OX)\tar.obj >> $@ echo $(OX)\th.obj >> $@ echo $(OX)\th_lang.obj >> $@ echo $(OX)\th_main.obj >> $@ |
| ︙ | ︙ | |||
672 673 674 675 676 677 678 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c $(TCC) /Fo$@ /c $** page_index.h: mkindex$E $(SRC) $** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) | | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c $(TCC) /Fo$@ /c $** page_index.h: mkindex$E $(SRC) $** > $@ builtin_data.h: mkbuiltin$E $(EXTRA_FILES) mkbuiltin$E --prefix $(SRCDIR)/ $(EXTRA_FILES) > $@ clean: -del $(OX)\*.obj -del *.obj -del *_.c -del *.h -del *.ilk |
| ︙ | ︙ | |||
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | translate$E $** > $@ $(OX)\stat$O : stat_.c stat.h $(TCC) /Fo$@ -c stat_.c stat_.c : $(SRCDIR)\stat.c translate$E $** > $@ $(OX)\style$O : style_.c style.h $(TCC) /Fo$@ -c style_.c style_.c : $(SRCDIR)\style.c translate$E $** > $@ | > > > > > > | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | translate$E $** > $@ $(OX)\stat$O : stat_.c stat.h $(TCC) /Fo$@ -c stat_.c stat_.c : $(SRCDIR)\stat.c translate$E $** > $@ $(OX)\statrep$O : statrep_.c statrep.h $(TCC) /Fo$@ -c statrep_.c statrep_.c : $(SRCDIR)\statrep.c translate$E $** > $@ $(OX)\style$O : style_.c style.h $(TCC) /Fo$@ -c style_.c style_.c : $(SRCDIR)\style.c translate$E $** > $@ |
| ︙ | ︙ | |||
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | sha1_.c:sha1.h \ shun_.c:shun.h \ sitemap_.c:sitemap.h \ skins_.c:skins.h \ sqlcmd_.c:sqlcmd.h \ stash_.c:stash.h \ stat_.c:stat.h \ style_.c:style.h \ sync_.c:sync.h \ tag_.c:tag.h \ tar_.c:tar.h \ th_main_.c:th_main.h \ timeline_.c:timeline.h \ tkt_.c:tkt.h \ | > | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | sha1_.c:sha1.h \ shun_.c:shun.h \ sitemap_.c:sitemap.h \ skins_.c:skins.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 \ th_main_.c:th_main.h \ timeline_.c:timeline.h \ tkt_.c:tkt.h \ |
| ︙ | ︙ |
Changes to win/include/unistd.h.
1 2 3 | #ifndef _UNISTD_H #define _UNISTD_H 1 | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #ifndef _UNISTD_H #define _UNISTD_H 1 /* This file intended to serve as a drop-in replacement for * unistd.h on Windows * Please add functionality as neeeded */ #include <stdlib.h> #include <io.h> #define srandom srand #define random rand #if defined(__DMC__) |
| ︙ | ︙ |
Changes to www/branching.wiki.
| ︙ | ︙ | |||
178 179 180 181 182 183 184 | are much the same thing, and henceforth we will use the word "tag" to mean either a tag or a property. A tag can be a one-time tag, a propagating tag or a cancellation tag. A one-time tag only applies to the check-in to which it is attached. A propagating tag applies to the check-in to which it is attached and also to all direct descendants of that check-in. A <i>direct descendant</i> | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | are much the same thing, and henceforth we will use the word "tag" to mean either a tag or a property. A tag can be a one-time tag, a propagating tag or a cancellation tag. A one-time tag only applies to the check-in to which it is attached. A propagating tag applies to the check-in to which it is attached and also to all direct descendants of that check-in. A <i>direct descendant</i> is a descendant through direct children. Tag propagation does not cross merges. Tag propagation also stops as soon as it encounters another check-in with the same tag. A cancellation tag is attached to a single check-in in order to either override a one-time tag that was previously placed on that same check-in, or to block tag propagation from an ancestor. The initial checkin of every repository has two propagating tags. In |
| ︙ | ︙ |
Changes to www/build.wiki.
| ︙ | ︙ | |||
120 121 122 123 124 125 126 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. "<b>compat/openssl-1.0.2</b>"), then make sure that some recent <a href="http://www.perl.org/">Perl</a> binaries are installed locally, and finally run one of the following commands: <blockquote><pre> nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin </pre></blockquote> <blockquote><pre> buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin |
| ︙ | ︙ |
Changes to www/changes.wiki.
1 2 3 4 5 6 7 8 9 |
<title>Change Log</title>
<h2>Changes For Version 1.30 (2015-01-19)</h2>
* Added the [/help?cmd=bundle|fossil bundle] command.
* Added the [/help?cmd=purge|fossil purge] command.
* Added the [/help?cmd=publish|fossil publish] command.
* Added the [/help?cmd=unpublished|fossil unpublished] command.
* Enhance the [/tree] webpage to show the age of each file with the option
to sort by age.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
<title>Change Log</title>
<h2>Changes For Version 1.31 (2015-02-23)</h2>
* Change the auxiliary schema by adding columns MLINK.ISAUX and MLINK.PMID
columns to the schema, to support better drawing of file change graphs.
A [/help?cmd=rebuild|fossil rebuild] is recommended but is not required.
so that the new graph drawing logic can work effectively.
* Added [/search|search] over Check-in comments, Documents, Tickets and
Wiki. Disabled by default. The search can be either a full-scan or it
can use an index that is kept up-to-date automatically. The new
/srchsetup web-page and the [/help?cmd=fts-config|fts-config] command
were added to help configure the search capability. Expect further
enhancements to the search capabilities in subsequent releases.
* Added form elements to some submenus (in particular the /timeline)
for easier operation.
* Added the --ifneeded option to [/help?cmd=rebuild|fossil rebuild].
* Added "override skins" using the "skin:" line of the CGI script or
using the --skin LABEL option on the
[/help?cmd=server|server],
[/help?cmd=ui|ui], or
[/help?cmd=http|http] commands.
* Embedded html documents that begin with
<doc class="fossil-doc"> are displayed with standard
headers and footers added.
* Allow <div style='...'> markup in [/wiki_rules|wiki].
* Renamed "Events" to "Technical Notes", while updating the technote
display and control pages. Add support for technotes as plain text
or as Markdown.
* Added the [/md_rules] pages containing summary instructions on the
Markdown format.
* Added the --repolist and --nojail options to the various server commands
(ex: [/help?cmd=server|fossil server]).
* Added the [/help?cmd=all|fossil all add] subcommand to "fossil all".
* Improvements to the /login page. Some hyperlinks to pages that require
"anonymous" privileges are displayed even if the current user is "nobody"
but automatically redirect to /login.
* The [/help?cmd=/doc|/doc] web-page will now try to deliver the file
"404.md" from the top-level directory (if such a file exists) in
place of its built-in 404 text.
* Download of Tarballs and ZIP Archives by user "nobody" is now enabled
by default in new repositories.
* Enhancements to the table sorting controls. More display tables
are now sortable.
* Add IPv6 support to [/help?cmd=sync|fossil sync] and
[/help?cmd=clone|fossil clone]
* Add more skins such as "San Francisco Modern" and "Eagle".
* During shutdown, check to see if the check-out database (".fslckout")
contains a lot of free space, and if it does, VACUUM it.
* Added the [/mimetype_list] page.
* Added the [/hash-collisions] page.
* Allow the user of Common Table Expressions in the SQL that defaults
ticket reports.
* Break out the components (css, footer, and header) for the
various built-in skins into separate files in the source tree.
<h2>Changes For Version 1.30 (2015-01-19)</h2>
* Added the [/help?cmd=bundle|fossil bundle] command.
* Added the [/help?cmd=purge|fossil purge] command.
* Added the [/help?cmd=publish|fossil publish] command.
* Added the [/help?cmd=unpublished|fossil unpublished] command.
* Enhance the [/tree] webpage to show the age of each file with the option
to sort by age.
|
| ︙ | ︙ |
Changes to www/concepts.wiki.
| ︙ | ︙ | |||
195 196 197 198 199 200 201 | fossil effectively. You will want to have some kind of text editor for entering check-in comments. Fossil will use whatever text editor is identified by your VISUAL environment variable. Fossil will also use GPG to clearsign your manifests if you happen to have it installed, but fossil will skip that step if GPG missing from your system. You can optionally set up fossil to use external "diff" programs, though fossil has an excellent built-in "diff" algorithm that works | | > > > > | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | fossil effectively. You will want to have some kind of text editor for entering check-in comments. Fossil will use whatever text editor is identified by your VISUAL environment variable. Fossil will also use GPG to clearsign your manifests if you happen to have it installed, but fossil will skip that step if GPG missing from your system. You can optionally set up fossil to use external "diff" programs, though fossil has an excellent built-in "diff" algorithm that works fine for most people. If you happen to have Tcl/Tk installed on your system, Fossil will use it to generate a graphical "diff" display when you use the --tk option to the "diff" command, but this too is entirely optional. To uninstall fossil, simply delete the executable. To upgrade an older version of fossil to a newer version, just replace the old executable with the new one. You might need to run "<b>fossil all rebuild</b>" to restructure your repositories after an upgrade. Running "all rebuild" never hurts, so when upgrading it |
| ︙ | ︙ | |||
389 390 391 392 393 394 395 | </ol> <h2>5.0 Setting Up A Fossil Server</h2> With other configuration management software, setting up a server is a lot of work and normally takes time, patience, and a lot of system knowledge. Fossil is designed to avoid this frustration. Setting up | | | | < < < < < < < < | < < < < < < < < < < | | < < < < | < < < < | < < | < | < | < < < | < | | < < < < < < < < < > | < | 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 |
</ol>
<h2>5.0 Setting Up A Fossil Server</h2>
With other configuration management software, setting up a server is
a lot of work and normally takes time, patience, and a lot of system
knowledge. Fossil is designed to avoid this frustration. Setting up
a server with fossil is ridiculously easy. You have four options:</p>
<ol>
<li><p><b>Stand-alone server.</b>
Simply run the [/help?cmd=server|fossil server] or
[/help?cmd=ui|fossil ui] command from the command-line.
<li><p><b>CGI.</b>
Install a 2-line CGI script on a CGI-enabled web-server like Apache.
<li><p><b>SCGI.</b>
Start an SCGI server using the
[/help?cmd=server| fossil server --scgi] command for handling
SCGI requests from web-servers like Nginx.
<li><p><b>Inetd or Stunnel.</b>
Configure programs like inetd, xinetd, or stunnel to hand off HTTP requests
directly to the [/help?cmd=http|fossil http] command.
</ol>
See the [./server.wiki | How To Configure A Fossil Server] document
for details.
<h2>6.0 Review Of Key Concepts</h2>
<ul>
<li>The <b>fossil</b> program is a self-contained stand-alone executable.
Just put it somewhere on your PATH to install it.</li>
<li>Use the <b>clone</b> or <b>new</b> commands to create a new repository.</li>
|
| ︙ | ︙ |
Added www/customskin.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 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 |
Theming
=======
Every HTML page generated by Fossil has the following basic structure:
<blockquote><table border=1 cellpadding=10><tbody>
<tr><td style='background-color:lightblue;text-align:center;'>Header</td></tr>
<tr><td style='background-color:lightgreen;text-align:center;'>
Fossil-Generated Content</td></tr>
<tr><td style='background-color:lightblue;text-align:center;'>Footer</td></tr>
</tbody></table></blockquote>
The header and footer control the "look" of Fossil pages. Those
two sections can be customized separately for each repository to
develop a new theme.
The header will normally look something like this:
<html>
<head> ... </head>
<body>
... top banner and menu bar ...
<div class='content'>
And the footer will look something like this:
</div>
... bottom material ...
</body>
</html>
The <head> element in the header will normally reference the
/style.css CSS file that Fossil stores internally. (The $stylesheet_url
TH1 variable, described below, is useful for accomplishing this.)
The middle "content" section comprised the bulk of most pages and
contains the actual Fossil-generated data
that the user is interested in seeing. The text of this content
section is not normally configurable. The content text can be styled
using CSS, but it otherwise fixed. Hence it is the header and footer
and the CSS that determine the look of a repository.
We call the bundle of built-in CSS, header, and footer a "skin".
Built-in Skins
--------------
Fossil comes with several built-in skins. The sources to these built-ins can
be found in the Fossil source tree under the skins/ folder. The skins/
folder contains a separate subfolder for each built-in skin, with each
subfolders holding three files, "css.txt", "footer.txt", and "header.txt",
that describe the CSS, footer, and header for that skin, respectively.
The skin of a repository can be changed to any of the built-in skins using
the web interface by going to the /setup_skin web page (requires Admin
privileges) and clicking the appropriate button. Or, the --skin command
line option can be used for the
[fossil ui](../../../help?cmd=ui) or
[fossil server](../../../help?cmd=server) commands to force that particular
instance of Fossil to use the specified built-in skin.
Sharing Skins
-------------
The skin of a repository is not part of the versioned state and does not
"push" or "pull" like checked-in files. The skin is local to the
repository. However, skins can be shared between repositories using
the [fossil config](../../../help?cmd=configuration) command.
The "fossil config push skin" command will send the local skin to a remote
repository and the "fossil config pull skin" command will import a skin
from a remote repository. The "fossil config export skin FILENAME"
will export the skin for a repository into a file FILENAME. This file
can then be imported into a different repository using the
"fossil config import FILENAME" command. Unlike "push" and "pull",
the "export" and "import" commands are able to move skins between
repositories for different projects. So, for example, if you have a
group of related repositories, you can develop a skin for one of them,
then get a consistent look across all the repositories by exporting
the skin from the first repository and importing into all the others.
The file generated by "fossil config export" could be checked into
one of your repositories and versioned, if desired. This will not
automatically change the skin when looking backwards in time, but it
will provide an historical record of what the skin used to be and
allow the historical look of the repositories to be recreated if
necessary.
When cloning a repository, the skin of new repository is initialized to
the skin of the repository from which it was cloned.
Header And Footer Processing
----------------------------
The header.txt and footer.txt files of a scan are merely the HTML text
of the header and footer. Except, before being prepended and appended to
the content, the header and footer text are run through a
[TH1 interpreter](./th1.md) that might adjust the text as follows:
* All text within <th1>...</th1> is elided from the
output and that text is instead run as a TH1 script. That TH1
script has the opportunity to insert new text in place of itself,
or to inhibit or enable the output of subsequent text.
* Text for the form "$NAME" or "$<NAME>" is replace with
the value of the TH1 variable NAME.
For example, the following is the first few lines of a typical
header file:
<html>
<head>
<base href="$baseurl/$current_page" />
<title>$<project_name>: $<title></title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="$home/timeline.rss" />
<link rel="stylesheet" href="$stylesheet_url" type="text/css"
media="screen" />
</head>
After variables are substituted by TH1, the final header text
delivered to the web browser might look something like this:
<html>
<head>
<base href="https://www.fossil-scm.org/skin2/timeline" />
<title>Fossil: Timeline</title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="/skin2/timeline.rss" />
<link rel="stylesheet" href="/skin2/style.css?default" type="text/css"
media="screen" />
</head>
The same TH1 interpreter is used for both the header and the footer
and for all scripts contained within them both. Hence, any global
TH1 variables that are set by the header are available to the footer.
TH1 Variables
-------------
Before expanding the TH1 within the header and footer, Fossil first
initializes a number of TH1 variables to values that depend on
respository settings and the specific page being generated.
* **project_name** - The project_name variable is filled with the
name of the project as configured under the Admin/Configuration
menu.
* **title** - The title variable holds the title of the page being
generated.
The title variable is special in that it is deleted after
the header script runs and before the footer script. This is
necessary to avoid a conflict with a variable by the same name used
in my ticket-screen scripts.
* **baseurl** - The root of the URL namespace for this server.
* **secureurl** - The same as $baseurl except that if the scheme is
"http:" it is changed to "https:"
* **home** - The $baseurl without the scheme and hostname. For example,
if the $baseurl is "http://projectX.com/cgi-bin/fossil" then the
$home will be just "/cgi-bin/fossil".
* **index_page** - The landing page URI as
specified by the Admin/Configuration setup page.
* **current_page** - The name of the page currently being processed,
without the leading "/" and without query parameters.
Examples: "timeline", "doc/trunk/README.txt", "wiki".
* **csrf_token** - A token used to prevent cross-site request forgery.
* **release_version** - The release version of Fossil. Ex: "1.31"
* **manifest_version** - A prefix on the SHA1 check-in hash of the
specific version of fossil that is running. Ex: "\[47bb6432a1\]"
* **manifest_date** - The date of the source-code check-in for the
version of fossil that is running.
* **compiler_name** - The name and version of the compiler used to
build the fossil executable.
* **login** - This variable only exists if the user has logged in.
The value is the username of the user.
* **stylesheet_url** - A URL for the internal style-sheet maintained
by Fossil.
* **log\_image\_url** - A URL for the logo image for this project, as
configured on the Admin/Logo page.
* **background\_image\_url** - A URL for a background image for this
project, as configured on the Admin/Logo page.
All of the above are variables in the sense that either the header or the
footer is free to change or erase them. But they should probably be treated
as constants. New predefined values are likely to be added in future
releases of Fossil.
Suggested Skin Customization Procedure
--------------------------------------
Developers are free, of course, to develop new skins using any method they
want, but the following is a technique that has worked well in the past and
can serve as a starting point for future work:
1. Select a built-in skin that is closest to the desired look. Make
copies of the css, footer, and header into files name "css.txt",
"footer.txt", and "header.txt" in some temporary directory.
If the Fossil source code is available, then these three files can
be copied directly out of one of the subdirectories under skins. If
sources are not easily at hand, then a copy/paste out of the
CSS, footer, and header editing screens under the Admin menu will
work just as well. The important point is that the three files
be named exactly "css.txt", "footer.txt", and "header.txt" and that
they all be in the same directory.
2. Run the [fossil ui](../../../help?cmd=ui) command with an extra
option "--skin SKINDIR" where SKINDIR is the name of the directory
in which the three txt files were stored in step 1. This will bring
up the Fossil website using the tree files in SKINDIR.
3. Edit the three txt files in SKINDIR. After making each small change,
press Reload on the web browser to see the effect of that change.
Iterate until the desired look is achieved.
4. Copy/paste the resulting css.txt, header.txt, and footer.txt files
into the CSS, header, and footer configuration screens under the
Admin menu.
|
Changes to www/embeddeddoc.wiki.
|
| | | | 1 2 3 4 5 6 7 8 9 | <title>Project Documentation</title> <h1 align="center">Project Documentation</h1> Fossil provides a built-in <a href="wikitheory.wiki">wiki</a> that can be used to store the documentation for a project. This is sufficient for many projects. If your project is well-served by wiki documentation, then you need read no further. |
| ︙ | ︙ | |||
61 62 63 64 65 66 67 | editing looks like before you check it in. Finally, the <i><filename></i> element of the URL is the pathname of the documentation file relative to the root of the source tree. The mimetype (and thus the rendering) of documentation files is | | > | | | < | > > > > > > > > > > > > > > | 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 |
editing looks like before you check it in.
Finally, the <i><filename></i> element of the URL is the
pathname of the documentation file relative to the root of the source
tree.
The mimetype (and thus the rendering) of documentation files is
determined by the file suffix. Fossil currently understands
[/mimetype_list|many different file suffixes],
including all the popular ones such as ".css", ".gif", ".htm",
".html", ".jpg", ".jpeg", ".png", and ".txt".
Documentation files whose names end in ".wiki" use the
[/wiki_rules | same markup as wiki pages] -
a safe subset of HTML together with some wiki rules for paragraph
breaks, lists, and hyperlinks.
Documentation files ending in ".md" or ".markdown" use the
[/md_rules | Markdown markup langauge].
Documentation files ending in ".txt" are plain text.
Wiki, markdown, and plain text documentation files
are rendered with the standard fossil header and footer added.
Most other mimetypes are delivered directly to the requesting
web browser without interpretation, additions, or changes.
Files with the mimetype "text/html" (the .html or .htm suffix) are
usually rendered directly to the browser without interpretation.
However, if the file begins with a <div> element like this:
<b><div class='fossil-doc' data-title='<i>Title Text</i>'></b>
Then the standard Fossil header and footer are added to the document
prior to being displayed. The "class='fossil-doc'" attribute is
required for this to occur. The "data-title='...'" attribute is
optional, but if it is present the text will become the title displayed
in the Fossil header. An example of this can be seen in the text
of the [/artifact/84b4b3d041d93a?txt=1 | Index Of Fossil Documentation]
document.
<h2>Examples</h2>
This file that you are currently reading is an example of
embedded documentation. The name of this file in the fossil
source tree is "<b>www/embeddeddoc.wiki</b>".
You are perhaps looking at this
|
| ︙ | ︙ |
Changes to www/event.wiki.
|
| | | > | | > | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<title>Technical Notes</title>
<h2>What Is A "Technote"?</h2>
In Fossil, a "technical note" or "technote" (formerly called an "event")
is a special kind of [./wikitheory.wiki | wiki page]
that is associated with a point in time rather than having a page name.
Each technote causes a single entry to appear on the
[/timeline?y=e | Timeline Page].
Clicking on the timeline link will display the text of the technote.
The wiki content, the timeline entry text, the
time of the event, and the timeline background color can all be edited.
As with check-ins, wiki, and tickets, all technotes automatically synchronize
to other repositories. Hence, technotes can be viewed, created, and edited
off-line. And the complete edit history for technotes is maintained
for auditing purposes.
Possible uses for events include:
* <b>Milestones</b>. Project milestones, such as releases or beta-test
cycles, can be recorded as events. The timeline entry for the event
can be something simple like "Version 1.2.3" perhaps with a bright
|
| ︙ | ︙ | |||
39 40 41 42 43 44 45 |
server hardware is obtained. Such happenings are appropriate for
reporting as news.
* <b>Announcements</b>. Changes to the composition of the development
team or acquisition of new project sponsors can be communicated as
announcements which can be implemented as events.
| | | | | | | | | | | | | | | | < < | 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 |
server hardware is obtained. Such happenings are appropriate for
reporting as news.
* <b>Announcements</b>. Changes to the composition of the development
team or acquisition of new project sponsors can be communicated as
announcements which can be implemented as events.
No project is required to use technotes. But technotes can help many projects
stay better organized and provide a better historical record of the
development progress.
<h2>Viewing Technotes</h2>
Because technotes are considered a special kind of wiki,
users must have permission to read wiki in order read events.
Enable the "j" permission under the /Setup/Users menu in order
to give specific users or user classes the ability to view wiki
and technotes.
Technotes show up on the timeline. Click on the hyperlink beside the
technote title to see the complete text.
<h2>Creating And Editing Technotes</h2>
There is a hyperlink under the /wikihelp menu that can be used to create
new technotes. And there is a submenu hyperlink on technote displays for
editing existing technotes.
Users must have check-in privileges (permission "i") in order to
create or edit technotes. In addition, users must have create-wiki
privilege (permission "f") to create new technotes and edit-wiki
privilege (permission "k") in order to edit existing technotes.
Technote content may be formatted as [/wiki_rules | Fossil wiki],
[/md_rules | Markdown], or a plain text.
|
Changes to www/fileformat.wiki.
| ︙ | ︙ | |||
41 42 43 44 45 46 47 | <ul> <li> [#manifest | Manifests] </li> <li> [#cluster | Clusters] </li> <li> [#ctrl | Control Artifacts] </li> <li> [#wikichng | Wiki Pages] </li> <li> [#tktchng | Ticket Changes] </li> <li> [#attachment | Attachments] </li> | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | <ul> <li> [#manifest | Manifests] </li> <li> [#cluster | Clusters] </li> <li> [#ctrl | Control Artifacts] </li> <li> [#wikichng | Wiki Pages] </li> <li> [#tktchng | Ticket Changes] </li> <li> [#attachment | Attachments] </li> <li> [#event | TechNotes] </li> </ul> These seven artifact types are described in the following sections. In the current implementation (as of 2009-01-25) the artifacts that make up a fossil repository are stored as delta- and zlib-compressed blobs in an <a href="http://www.sqlite.org/">SQLite</a> database. This |
| ︙ | ︙ | |||
421 422 423 424 425 426 427 | An example ticket-change artifact can be seen [/artifact/91f1ec6af053 | here]. <a name="attachment"></a> <h2>6.0 Attachments</h2> An attachment artifact associates some other artifact that is the | | > | | | 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 | An example ticket-change artifact can be seen [/artifact/91f1ec6af053 | here]. <a name="attachment"></a> <h2>6.0 Attachments</h2> An attachment artifact associates some other artifact that is the attachment (the source artifact) with a ticket or wiki page or technical note to which the attachment is connected (the target artifact). The following cards are allowed on an attachment artifact: <blockquote> <b>A</b> <i>filename target</i> ?<i>source</i>?<br /> <b>C</b> <i>comment</i><br /> <b>D</b> <i>time-and-date-stamp</i><br /> <b>N</b> <i>mimetype</i><br /> <b>U</b> <i>user-name</i><br /> <b>Z</b> <i>checksum</i> </blockquote> The A card specifies a filename for the attachment in its first argument. The second argument to the A card is the name of the wiki page or ticket or technical note to which the attachment is connected. The third argument is either missing or else it is the 40-character artifact ID of the attachment itself. A missing third argument means that the attachment should be deleted. The C card is an optional comment describing what the attachment is about. The C card is optional, but there can only be one. |
| ︙ | ︙ | |||
459 460 461 462 463 464 465 | If an attachment is added anonymously, then the U card may be omitted. The Z card is the usual checksum over the rest of the attachment artifact. The Z card is required. <a name="event"></a> | | > | | | | | | | | | | | | | | | | | | | | | | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | If an attachment is added anonymously, then the U card may be omitted. The Z card is the usual checksum over the rest of the attachment artifact. The Z card is required. <a name="event"></a> <h2>7.0 Technical Notes</h2> A technical note or "technote" artifact (formerly known as an "event" artifact) associates a timeline comment and a page of text (similar to a wiki page) with a point in time. Technotes can be used to record project milestones, release notes, blog entries, process checkpoints, or news articles. The following cards are allowed on an technote artifact: <blockquote> <b>C</b> <i>comment</i><br> <b>D</b> <i>time-and-date-stamp</i><br /> <b>E</b> <i>technote-time</i> <i>technote-id</i><br /> <b>N</b> <i>mimetype</i><br /> <b>P</b> <i>parent-artifact-id</i>+<br /> <b>T</b> <b>+</b><i>tag-name</i> <b>*</b> ?<i>value</i>?<br /> <b>U</b> <i>user-name</i><br /> <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> <b>Z</b> <i>checksum</i> </blockquote> The C card contains text that is displayed on the timeline for the technote. The C card is optional, but there can only be one. A single D card is required to give the date and time when the technote artifact was created. This is different from the time at which the technote appears on the timeline. A single E card gives the time of the technote (the point on the timeline where the technote is displayed) and a unique identifier for the technote. When there are multiple artifacts with the same technote-id, the one with the most recent D card is the only one used. The technote-id must be a 40-character lower-case hexadecimal string. The optional N card specifies the mimetype of the text of the technote that is contained in the W card. If the N card is omitted, then the W card text mimetype is assumed to be text/x-fossil, which is the Fossil wiki format. The optional P card specifies a prior technote with the same technote-id from which the current technote is an edit. The P card is a hint to the system that it might be space efficient to store one technote as a delta of the other. A technote might contain one or more T-cards used to set [./branching.wiki#tags | tags or properties] on the technote. The format of the T-card is the same as described in [#ctrl | Control Artifacts] section above, except that the second argument is the single character "<b>*</b>" instead of an artifact ID and the name is always prefaced by "<b>+</b>". The <b>*</b> in place of the artifact ID indicates that the tag or property applies to the current artifact. It is not possible to encode the current artifact ID as part of an artifact, since the act of inserting the artifact ID would change the artifact ID, hence a <b>*</b> is used to represent "self". The "<b>+</b>" on the name means that tags can only be add and they can only be non-propagating tags. In a technote, T cards are normally used to set the background display color for timelines. The optional U card gives name of the user who entered the technote. A single W card provides wiki text for the document associated with the technote. The format of the W card is exactly the same as for a [#wikichng | wiki artifact]. The Z card is the required checksum over the rest of the artifact. <a name="summary"></a> <h2>8.0 Card Summary</h2> |
| ︙ | ︙ | |||
548 549 550 551 552 553 554 | <tr> <th>Manifest</th> <th>Cluster</th> <th>Control</th> <th>Wiki</th> <th>Ticket</th> <th>Attachment</th> | | | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | <tr> <th>Manifest</th> <th>Cluster</th> <th>Control</th> <th>Wiki</th> <th>Ticket</th> <th>Attachment</th> <th>Technote</th> </tr> <tr> <td><b>A</b> <i>filename</i> <i>target</i> ?<i>source</i>?</td> <td> </td> <td> </td> <td> </td> <td> </td> |
| ︙ | ︙ | |||
592 593 594 595 596 597 598 | <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> </tr> <tr> | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> <td align=center><b>1</b></td> </tr> <tr> <td><b>E</b> <i>technote-time technote-id</i></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align=center><b>1</b></td> |
| ︙ | ︙ |
Changes to www/fossil-v-git.wiki.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 | used both Fossil and Git for other opinions. <h2>2.0 Executive Summary:</h2> <blockquote><center><table border=1 cellpadding=5> <tr><th width="50%">GIT</th><th width="50%">FOSSIL</th></tr> <tr><td>File versioning only</td> | | | > > > | | 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 |
used both Fossil and Git for other opinions.
<h2>2.0 Executive Summary:</h2>
<blockquote><center><table border=1 cellpadding=5>
<tr><th width="50%">GIT</th><th width="50%">FOSSIL</th></tr>
<tr><td>File versioning only</td>
<td>Versioning, Tickets, Wiki, and Technotes</td></tr>
<tr><td>Sharding</td><td>Replicating</td></tr>
<tr><td>Developer branches</td><td>Feature branches</td></tr>
<tr><td>Complex</td><td>Intuitive</td></tr>
<tr><td>Separate web tools</td><td>Integrated Web interface</td></tr>
<tr><td>Lots of little tools</td><td>Single executable</td></tr>
<tr><td>Pile-of-files repository</td>
<td>Single-file relational database</td></tr>
<tr><td>One check-out per repository</td>
<td>Many check-outs per repository</td></tr>
<tr><td>Uses "<tt>rebase</tt>"</td><td>Immutable</td></tr>
<tr><td>GPL</td><td>BSD</td></tr>
</table></center></blockquote>
<h2>3.0 Discussion</h2>
<h3>3.1 Feature Set</h3>
Git provides file versioning services only, whereas Fossil adds an
integrated [./wikitheory.wiki | wiki],
[./bugtheory.wiki | ticketing & bug tracking],
[./embeddeddoc.wiki | embedded documentation], and
[./event.wiki | Technical notes].
These additional capabilities are available for Git as 3rd-party
user-installed add-ons, but with Fossil they are integrated into
the design. One way to describe Fossil is that it is
"[https://github.com/ | github]-in-a-box".
<h3>3.2 Sharding versus Replicating</h3>
|
| ︙ | ︙ | |||
146 147 148 149 150 151 152 153 154 155 156 157 158 159 | more time thinking about what you are doing with Git. Fossil strives for simplicity. Fossil wants to be easy to learn and to require little thinking about how to operating it. [./quotes.wiki | Reports from the field] indicate that Fossil is mostly successful at this effort. <h3>3.5 Web Interface</h3> Git has a web interface, but it requires a fair amount of setup and an external web server. Fossil comes with a fully functional [./webui.wiki | built-in web-server] and a really simple mechanism (the "[/help/ui|fossil ui]" command) to automatically start the web server and bring up a web browser to navigate | > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | more time thinking about what you are doing with Git. Fossil strives for simplicity. Fossil wants to be easy to learn and to require little thinking about how to operating it. [./quotes.wiki | Reports from the field] indicate that Fossil is mostly successful at this effort. Fossil will <u>never</u> get you into anything like the "disconnected head state" which has frustrated so many Git users. <h3>3.5 Web Interface</h3> Git has a web interface, but it requires a fair amount of setup and an external web server. Fossil comes with a fully functional [./webui.wiki | built-in web-server] and a really simple mechanism (the "[/help/ui|fossil ui]" command) to automatically start the web server and bring up a web browser to navigate |
| ︙ | ︙ | |||
187 188 189 190 191 192 193 | A Fossil repository consists of a single disk file. A single Fossil repository can serve multiple simultaneous working checkouts. A Fossil repository is an SQLite database, so it is highly resistant to damage from a power-loss or system crash - incomplete transactions are simply rolled back after the system reboots. | > > > > > > > > > > > > > > > > | | | | | > > > > | > > > > > > > > > | | > > > > > > > > > > | 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 | A Fossil repository consists of a single disk file. A single Fossil repository can serve multiple simultaneous working checkouts. A Fossil repository is an SQLite database, so it is highly resistant to damage from a power-loss or system crash - incomplete transactions are simply rolled back after the system reboots. <h3>3.8 Check-outs Per Repository</h3> In Git, a check-out and a repository are joined in a fundamental way so that only a single version of the project history, or a single branch, can be open at once. If you have a project with multiple branches and you want to have two or more branches open at the same time (perhaps to do performance comparisons, or maybe to run simultaneous builds using different compile-time options) then in Git you actually have to create a new clone of the repository for each open checkout. In Fossil, the repository and the check-out are distinct entities and so a single repository can support multiple simultaneous checkouts. This feature is <em>extensively</em> used by the Fossil developers themselves. Perhaps we are biased, but we not understand how anyone can work efficiently with just one check-out per repository. <h3>3.9 Audit Trail</h3> Git features the "rebase" command which can be used to change the sequence of check-ins in the repository. Rebase can be used to "clean up" a complex sequence of check-ins to make their intent easier for others to understand. This is important if you view the history of a project as part of the documentation for the project. Fossil takes an opposing view. Fossil views history as sacrosanct and stubornly refuses to change it. Fossil allows mistakes to be corrected (for example, check-in comments can be revised, and check-ins can be moved onto new branches even after the check-in has occurred) but the correction is an addition to the repository and the original actions are preserved and displayed alongside the corrections, thus preserving an historically accurate audit trail. This is analogous to an accounting practice of marking through an incorrect entry in a ledger and writing a correction beside it. To put it another way, Git remembers what you should have done whereas Fossil remembers what you actually did. The lack of a "rebase" command and the inability to rewrite history is considered a feature of Fossil, not an omission or bug. <h3>3.10 License</h3> Both Git and Fossil are open-source. Git is under [http://www.gnu.org/licenses/gpl.html | GPL] whereas Fossil is under the [http://en.wikipedia.org/wiki/BSD_licenses | two-clause BSD license]. The different licenses parallel, to some extent, the different philosophies of Git and Fossil. There are exceptions on both sides, but to a first approximation, Git works better for GPL projects and Fossil works better for BSD projects. The GPL is designed to provide a very contributor-friendly environment. No legal paperwork is needed to contribute to a GPL project because the GPL is cleverly designed so that the act of contributing to the project (or even reading the code for the project) constitutes an acceptance of the licensing terms. GPL encourages a bazaar-style development model, with lots of anonymous programmers contributing drive-by patches. The theory is that with many eyeballs, all bugs are shallow. Surprisingly, this has actually been demonstrated to work in many well-known projects. The BSD-style licenses are more user-friendly. BSD-style licenses place fewer restrictions on the users of the software at the expense of making it more difficult to contribute changes or enhancements. To protect against IP claims, every contributor to a BSD-style project must sign legal documents in which they agree to release their contributions under the same license. (Some BSD-licensed projects omit this formality, but do so at their peril.) A BSD-style license encourages a more cathedral-style approach to development. There is a small team of developers. Drive-by patches and anonymous contributors are discouraged and/or prohibited. Contributors are expected to be experts and be available to support their changes for the long-term. |
Changes to www/hacker-howto.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <title>Fossil Hackers How-To</title> The following links are of interest to programmers who want to modify or enhance Fossil. Ordinary users can safely ignore this information. * [./build.wiki | How To Compile And Install Fossil] * [./makefile.wiki | The Fossil Build Process] * [./tech_overview.wiki | A Technical Overview of Fossil] * [./adding_code.wiki | Adding Features To Fossil] * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project] * [./style.wiki | Coding Style Guidelines] * [./checkin.wiki | Pre-checkin Checklist] * [../test/release-checklist.wiki | Release Checklist] | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <title>Fossil Hackers How-To</title> The following links are of interest to programmers who want to modify or enhance Fossil. Ordinary users can safely ignore this information. * [./build.wiki | How To Compile And Install Fossil] * [./customskin.md | Theming Fossil] * [./makefile.wiki | The Fossil Build Process] * [./tech_overview.wiki | A Technical Overview of Fossil] * [./adding_code.wiki | Adding Features To Fossil] * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project] * [./style.wiki | Coding Style Guidelines] * [./checkin.wiki | Pre-checkin Checklist] * [../test/release-checklist.wiki | Release Checklist] |
Changes to www/index.wiki.
|
| | | < < < < < | < < < < < < < < < > | | < < < | < < | > | | | < < | | > | < < < < | < > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < < < < < < < < < | | | > > | 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 |
<title>Home</title>
<h3>What Is Fossil?</h3>
<div style='width:200px;float:right;border:2px solid #446979;padding:10px;margin:0px 10px;'>
<ul>
<li> [http://www.fossil-scm.org/download.html | Download]
<li> [./quickstart.wiki | Quick Start]
<li> [./build.wiki | Install]
<li> [../COPYRIGHT-BSD2.txt | License]
<li> [./faq.wiki | FAQ]
<li> [./changes.wiki | Change Log]
<li> [./hacker-howto.wiki | Hacker How-To]
<li> [./hints.wiki | Tip & Hints]
<li> [./permutedindex.html | Documentation Index]
<li> [http://www.fossil-scm.org/schimpf-book/home | Jim Schimpf's book]
<li> Mailing list
<ul>
<li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
<li> [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org | archives]
</ul>
</ul>
<center><img src="fossil3.gif"></center>
</div>
<p>Fossil is a simple, high-reliability, distributed software configuration
management with these advanced features:
1. <b>Integrated Bug Tracking, Wiki, and Technotes</b> -
In addition to doing [./concepts.wiki | distributed version control]
like Git and Mercurial,
Fossil also supports [./bugtheory.wiki | bug tracking],
[./wikitheory.wiki | wiki], and [./event.wiki | technotes].
2. <b>Built-in Web Interface</b> -
Fossil has a built-in and intuitive [./webui.wiki | web interface]
with a rich assortment of information pages
([./webpage-ex.md|examples]) designed to promote situational awareness.
This entire website¹
is just a running instance of Fossil. The pages you see here
are all [./wikitheory.wiki | wiki] or
[./embeddeddoc.wiki | embedded documentation].
When you clone Fossil from one of its
[./selfhost.wiki | self-hosting repositories],
you get more than just source code - you get this entire website.
<span style='font-size:75%;'>(¹except the
[http://www.fossil-scm.org/download.html | download] page)</span>
3. <b>Self-Contained</b> -
Fossil is a single self-contained stand-alone executable.
To install, simply download a
<a href="http://www.fossil-scm.org/download.html">precompiled binary</a>
for Linux, Mac, OpenBSD, or Windows and put it on your $PATH.
[./build.wiki | Easy-to-compile source code] is also available.
4. <b>Simple Networking</b> -
No custom protocols or TCP ports.
Fossil uses ordinary HTTP (or HTTPS or SSH)
for network communications, so it works fine from behind
restrictive firewalls, including [./quickstart.wiki#proxy|proxies].
The protocol is
[./stats.wiki | bandwidth efficient] to the point that Fossil can be
used comfortably over dial-up.
5. <b>CGI/SCGI Enabled</b> - No server is required, but if you want to
set one up, Fossil supports four easy
[./server.wiki | server configurations].
6. <b>Autosync</b> -
Fossil supports [./concepts.wiki#workflow | "autosync" mode]
which helps to keep projects moving
forward by reducing the amount of needless
[./branching.wiki | forking and merging] often
associated with distributed projects.
7. <b>Robust & Reliable</b> -
Fossil stores content using an [./fileformat.wiki | enduring file format]
in an SQLite database so that transactions are
atomic even if interrupted by a power loss or system crash.
Automatic [./selfcheck.wiki | self-checks] verify that all aspects of
the repository are consistent prior to each commit. In over seven years
of operation, no work has ever been lost after having been committed to
a Fossil repository.
8. <b>Free and Open-Source</b> - Uses the [../COPYRIGHT-BSD2.txt|2-clause BSD license].
<hr>
<h3>Links For Fossil Users:</h3>
* "Fuel" is cross-platform GUI front-end for Fossil
written in Qt. [http://fuelscm.org/].
Fuel is an independent project run by a different group of
|
| ︙ | ︙ | |||
157 158 159 160 161 162 163 |
* Methods to [./checkin_names.wiki | identify a specific check-in].
* [./inout.wiki | Import and export] from and to Git.
* [./fossil-v-git.wiki | Fossil versus Git].
* [./fiveminutes.wiki | Up and running in 5 minutes as a single user]
(contributed by Gilles Ganault on 2013-01-08).
* [./antibot.wiki | How Fossil defends against abuse by spiders and bots].
| | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
* Methods to [./checkin_names.wiki | identify a specific check-in].
* [./inout.wiki | Import and export] from and to Git.
* [./fossil-v-git.wiki | Fossil versus Git].
* [./fiveminutes.wiki | Up and running in 5 minutes as a single user]
(contributed by Gilles Ganault on 2013-01-08).
* [./antibot.wiki | How Fossil defends against abuse by spiders and bots].
<h3>Links For Fossil Developers:</h3>
* [./contribute.wiki | Contributing] code or documentation to the
Fossil project.
* [./theory1.wiki | Thoughts On The Design Of Fossil].
* [./pop.wiki | Principles Of Operation]
* [./tech_overview.wiki | A Technical Overview Of Fossil].
* The [./fileformat.wiki | file format] used by every content
file stored in the repository.
* The [./delta_format.wiki | format of deltas] used to
efficiently store changes between file revisions.
* The [./delta_encoder_algorithm.wiki | encoder algorithm] used to
efficiently generate deltas.
* The [./sync.wiki | synchronization protocol].
|
Changes to www/inout.wiki.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 | As with the "import" command, the --git option is not required since the git-fast-export file format is currently the only VCS interchange format that Fossil will generate. However, future versions of Fossil might add the ability to generate other VCS interchange formats, and so for compatibility, the use of the --git option recommented. | > > > > > > > > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | As with the "import" command, the --git option is not required since the git-fast-export file format is currently the only VCS interchange format that Fossil will generate. However, future versions of Fossil might add the ability to generate other VCS interchange formats, and so for compatibility, the use of the --git option recommented. An anonymous user sends this comment: <blockquote> The main Fossil branch is called "trunk", while the main git branch is called "master". After you've exported your FOSSIL repo to git, you won't see any files and gitk will complain about a missing "HEAD". You can resolve this problem by merging "trunk" with "master" (first verify using git status that you are on the "master" branch): <tt>git merge trunk</tt> </blockquote> |
Changes to www/makefile.wiki.
| ︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 | separate object code file and the resulting object code files linked together in a final step. Some files require special C-preprocessor macro definitions. When compiling sqlite.c, the following macros are recommended: * -DSQLITE_OMIT_LOAD_EXTENSION=1 * -DSQLITE_ENABLE_LOCKING_STYLE=0 * -DSQLITE_THREADSAFE=0 * -DSQLITE_DEFAULT_FILE_FORMAT=4 * -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 | > | | | | | | | 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 | separate object code file and the resulting object code files linked together in a final step. Some files require special C-preprocessor macro definitions. When compiling sqlite.c, the following macros are recommended: * -DSQLITE_OMIT_LOAD_EXTENSION=1 * -DSQLITE_ENABLE_FTS4=1 * -DSQLITE_ENABLE_LOCKING_STYLE=0 * -DSQLITE_THREADSAFE=0 * -DSQLITE_DEFAULT_FILE_FORMAT=4 * -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 The first two symbol definitions above are required; the others are merely recommended. Extension loading is omitted as a security measure. FTS4 is needed for the search feature. Fossil is single-threaded so mutexing is disabled in SQLite as a performance enhancement. The SQLITE_ENABLE_EXPLAIN_COMMENTS option makes the output of "EXPLAIN" queries in the "[/help?cmd=sqlite3|fossil sql]" command much more readable. When compiling the shell.c source file, these macros are required: * -Dmain=sqlite3_main * -DSQLITE_OMIT_LOAD_EXTENSION=1 The "main()" routine in the shell must be changed into sqlite3_main() |
| ︙ | ︙ |
Changes to www/mkdownload.tcl.
1 2 3 4 5 6 7 8 9 | #!/usr/bin/tclsh # # Run this script to build the "download.html" page. Also generate # the fossil_download_checksums.html page. # # set out [open download.html w] fconfigure $out -encoding utf-8 -translation lf puts $out \ | | > | | | > > | | | > | | | < < | < < < | < | | | | > | | 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 |
#!/usr/bin/tclsh
#
# Run this script to build the "download.html" page. Also generate
# the fossil_download_checksums.html page.
#
#
set out [open download.html w]
fconfigure $out -encoding utf-8 -translation lf
puts $out \
{<!DOCTYPE html>
<html>
<head>
<base href="https://www.fossil-scm.org/download.html" />
<title>Fossil: Download</title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed"
href="/fossil/timeline.rss" />
<link rel="stylesheet" href="/fossil/style.css?default" type="text/css"
media="screen" />
</head>
<body>
<div class="header">
<div class="title"><h1>Fossil</h1>Download</div>
</div>
<div class="mainmenu">
<a href='/fossil/doc/trunk/www/index.wiki'>Home</a>
<a href='/fossil/timeline?y=ci'>Timeline</a>
<a href='/fossil/dir?ci=tip'>Code</a>
<a href='/fossil/doc/trunk/www/permutedindex.html'>Docs</a>
<a href='/fossil/brlist'>Branches</a>
<a href='/fossil/ticket'>Tickets</a>
<a href='/fossil/wiki'>Wiki</a>
<a href='/download.html' class='active'>Download</a>
</div>
<div class="content">
<p>
<center><font size=4>}
puts $out \
"<b>To install Fossil →</b> download the stand-alone executable"
puts $out \
{and put it on your $PATH.
</font><p><small>
RPMs available
<a href="http://download.opensuse.org/repositories/home:/rmax:/fossil/">
here.</a>
Cryptographic checksums for download files are
|
| ︙ | ︙ | |||
66 67 68 69 70 71 72 |
#
foreach datetime [lsort -decr [array names adate]] {
set dt [string range $datetime 0 3]-[string range $datetime 4 5]-
append dt "[string range $datetime 6 7] "
append dt "[string range $datetime 8 9]:[string range $datetime 10 11]:"
append dt "[string range $datetime 12 13]"
set link [string map {{ } +} $dt]
| | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
#
foreach datetime [lsort -decr [array names adate]] {
set dt [string range $datetime 0 3]-[string range $datetime 4 5]-
append dt "[string range $datetime 6 7] "
append dt "[string range $datetime 8 9]:[string range $datetime 10 11]:"
append dt "[string range $datetime 12 13]"
set link [string map {{ } +} $dt]
set hr "/fossil/timeline?c=$link&y=ci"
puts $out "<tr><td colspan=6 align=left><hr>"
puts $out "<center><b><a href=\"$hr\">$dt</a></b></center>"
puts $out "</td></tr>"
puts $out "<tr>"
foreach {prefix suffix img desc} {
fossil-linux-x86 zip linux.gif {Linux 3.x x86}
|
| ︙ | ︙ | |||
109 110 111 112 113 114 115 |
puts $out "[read $rn]"
close $rn
puts $out "</td></tr>"
}
}
puts $out "<tr><td colspan=5><hr></td></tr>"
| | | | 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 |
puts $out "[read $rn]"
close $rn
puts $out "</td></tr>"
}
}
puts $out "<tr><td colspan=5><hr></td></tr>"
puts $out {</table></div>
</body>
</html>
}
close $out
# Generate the checksum page
#
set out [open fossil_download_checksums.html w]
fconfigure $out -encoding utf-8 -translation lf
puts $out {<html>
<title>Fossil Download Checksums</title>
<body>
<h1 align="center">Checksums For Fossil Downloads</h1>
<p>The following table shows the SHA1 checksums for the precompiled
binaries available on the
<a href="/download.html">Fossil website</a>.</p>
<pre>}
foreach file [lsort [glob -nocomplain download/fossil-*.zip]] {
set sha1sum [lindex [exec sha1sum $file] 0]
puts $out "$sha1sum [file tail $file]"
}
puts $out {</pre></body></html>}
close $out
|
Changes to www/mkindex.tcl.
1 2 3 4 5 | #!/bin/sh # # Run this TCL script to generate a WIKI page that contains a # permuted index of the various documentation files. # | | > | 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 |
#!/bin/sh
#
# Run this TCL script to generate a WIKI page that contains a
# permuted index of the various documentation files.
#
# tclsh mkindex.tcl >permutedindex.html
#
set doclist {
adding_code.wiki {Adding New Features To Fossil}
adding_code.wiki {Hacking Fossil}
antibot.wiki {Defense against Spiders and Bots}
bugtheory.wiki {Bug Tracking In Fossil}
branching.wiki {Branching, Forking, Merging, and Tagging}
build.wiki {Compiling and Installing Fossil}
checkin_names.wiki {Checkin And Version Names}
checkin.wiki {Check-in Checklist}
changes.wiki {Fossil Changelog}
copyright-release.html {Contributor License Agreement}
concepts.wiki {Fossil Core Concepts}
contribute.wiki {Contributing Code or Documentation To The Fossil Project}
customskin.md {Theming: Customizing The Appearance of Web Pages}
custom_ticket.wiki {Customizing The Ticket System}
delta_encoder_algorithm.wiki {Fossil Delta Encoding Algorithm}
delta_format.wiki {Fossil Delta Format}
embeddeddoc.wiki {Embedded Project Documentation}
event.wiki {Events}
faq.wiki {Frequently Asked Questions}
fileformat.wiki {Fossil File Format}
|
| ︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
stats.wiki {Performance Statistics}
style.wiki {Source Code Style Guidelines}
ssl.wiki {Using SSL with Fossil}
sync.wiki {The Fossil Sync Protocol}
tech_overview.wiki {A Technical Overview Of The Design And Implementation
Of Fossil}
tech_overview.wiki {SQLite Databases Used By Fossil}
tickets.wiki {The Fossil Ticket System}
theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
webui.wiki {The Fossil Web Interface}
wikitheory.wiki {Wiki In Fossil}
}
set permindex {}
| > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
stats.wiki {Performance Statistics}
style.wiki {Source Code Style Guidelines}
ssl.wiki {Using SSL with Fossil}
sync.wiki {The Fossil Sync Protocol}
tech_overview.wiki {A Technical Overview Of The Design And Implementation
Of Fossil}
tech_overview.wiki {SQLite Databases Used By Fossil}
th1.md {The TH1 Scripting Language}
tickets.wiki {The Fossil Ticket System}
theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
webui.wiki {The Fossil Web Interface}
wikitheory.wiki {Wiki In Fossil}
}
set permindex {}
|
| ︙ | ︙ | |||
75 76 77 78 79 80 81 |
set firstword [string tolower [lindex $suffix 0]]
if {[lsearch $stopwords $firstword]<0} {
lappend permindex [list "$suffix — $prefix" $file]
}
}
}
set permindex [lsort -dict -index 0 $permindex]
| | > | > > > > > > | | | | | > | | | 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 |
set firstword [string tolower [lindex $suffix 0]]
if {[lsearch $stopwords $firstword]<0} {
lappend permindex [list "$suffix — $prefix" $file]
}
}
}
set permindex [lsort -dict -index 0 $permindex]
set out [open permutedindex.html w]
fconfigure $out -encoding utf-8 -translation lf
puts $out \
"<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
puts $out {
<center>
<form action='../../../docsrch' method='GET'>
<input type="text" name="s" size="40" autofocus>
<input type="submit" value="Search Docs">
</form>
</center>
<h2>Primary Documents:</h2>
<ul>
<li> <a href='quickstart.wiki'>Quick-start Guide</a>
<li> <a href='faq.wiki'>FAQ</a>
<li> <a href='build.wiki'>Compiling and installing Fossil</a>
<li> <a href='../COPYRIGHT-BSD2.txt'>License</a>
<li> <a href='http://www.fossil-scm.org/schimpf-book/home'>Jim Schimpf's
book</a>
<li> <a href='../../../help'>Command-line help</a>
</ul>
<a name="pindex"></a>
<h2>Permuted Index:</h2>
<ul>}
foreach entry $permindex {
foreach {title file} $entry break
puts $out "<li><a href=\"$file\">$title</a></li>"
}
puts $out "</ul></div>"
|
Name change from www/permutedindex.wiki to www/permutedindex.html.
|
| | > > > > > > | | | | | > | > | 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 | <div class='fossil-doc' data-title='Index Of Fossil Documentation'> <center> <form action='../../../docsrch' method='GET'> <input type="text" name="s" size="40" autofocus> <input type="submit" value="Search Docs"> </form> </center> <h2>Primary Documents:</h2> <ul> <li> <a href='quickstart.wiki'>Quick-start Guide</a> <li> <a href='faq.wiki'>FAQ</a> <li> <a href='build.wiki'>Compiling and installing Fossil</a> <li> <a href='../COPYRIGHT-BSD2.txt'>License</a> <li> <a href='http://www.fossil-scm.org/schimpf-book/home'>Jim Schimpf's book</a> <li> <a href='../../../help'>Command-line help</a> </ul> <a name="pindex"></a> <h2>Permuted Index:</h2> <ul> <li><a href="fiveminutes.wiki">5 Minutes as a Single User — Update and Running in</a></li> <li><a href="fossil-from-msvc.wiki">2010 IDE — Integrating Fossil in the Microsoft Express</a></li> <li><a href="tech_overview.wiki">A Technical Overview Of The Design And Implementation Of Fossil</a></li> <li><a href="adding_code.wiki">Adding New Features To Fossil</a></li> <li><a href="antibot.wiki">against Spiders and Bots — Defense</a></li> <li><a href="copyright-release.html">Agreement — Contributor License</a></li> <li><a href="delta_encoder_algorithm.wiki">Algorithm — Fossil Delta Encoding</a></li> <li><a href="customskin.md">Appearance of Web Pages — Theming: Customizing The</a></li> <li><a href="fiveminutes.wiki">as a Single User — Update and Running in 5 Minutes</a></li> <li><a href="faq.wiki">Asked Questions — Frequently</a></li> <li><a href="password.wiki">Authentication — Password Management And</a></li> <li><a href="antibot.wiki">Bots — Defense against Spiders and</a></li> <li><a href="private.wiki">Branches — Creating, Syncing, and Deleting Private</a></li> <li><a href="branching.wiki">Branching, Forking, Merging, and Tagging</a></li> <li><a href="bugtheory.wiki">Bug Tracking In Fossil</a></li> |
| ︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | <li><a href="shunning.wiki">Content From Fossil — Shunning: Deleting</a></li> <li><a href="contribute.wiki">Contributing Code or Documentation To The Fossil Project</a></li> <li><a href="copyright-release.html">Contributor License Agreement</a></li> <li><a href="concepts.wiki">Core Concepts — Fossil</a></li> <li><a href="newrepo.wiki">Create A New Fossil Repository — How To</a></li> <li><a href="private.wiki">Creating, Syncing, and Deleting Private Branches</a></li> <li><a href="qandc.wiki">Criticisms — Questions And</a></li> <li><a href="custom_ticket.wiki">Customizing The Ticket System</a></li> <li><a href="tech_overview.wiki">Databases Used By Fossil — SQLite</a></li> <li><a href="antibot.wiki">Defense against Spiders and Bots</a></li> <li><a href="shunning.wiki">Deleting Content From Fossil — Shunning:</a></li> <li><a href="private.wiki">Deleting Private Branches — Creating, Syncing, and</a></li> <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm — Fossil</a></li> <li><a href="delta_format.wiki">Delta Format — Fossil</a></li> | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <li><a href="shunning.wiki">Content From Fossil — Shunning: Deleting</a></li> <li><a href="contribute.wiki">Contributing Code or Documentation To The Fossil Project</a></li> <li><a href="copyright-release.html">Contributor License Agreement</a></li> <li><a href="concepts.wiki">Core Concepts — Fossil</a></li> <li><a href="newrepo.wiki">Create A New Fossil Repository — How To</a></li> <li><a href="private.wiki">Creating, Syncing, and Deleting Private Branches</a></li> <li><a href="qandc.wiki">Criticisms — Questions And</a></li> <li><a href="customskin.md">Customizing The Appearance of Web Pages — Theming:</a></li> <li><a href="custom_ticket.wiki">Customizing The Ticket System</a></li> <li><a href="tech_overview.wiki">Databases Used By Fossil — SQLite</a></li> <li><a href="antibot.wiki">Defense against Spiders and Bots</a></li> <li><a href="shunning.wiki">Deleting Content From Fossil — Shunning:</a></li> <li><a href="private.wiki">Deleting Private Branches — Creating, Syncing, and</a></li> <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm — Fossil</a></li> <li><a href="delta_format.wiki">Delta Format — Fossil</a></li> |
| ︙ | ︙ | |||
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 | <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki">Import And Export To And From Git</a></li> <li><a href="build.wiki">Installing Fossil — Compiling and</a></li> <li><a href="fossil-from-msvc.wiki">Integrating Fossil in the Microsoft Express 2010 IDE</a></li> <li><a href="selfcheck.wiki">Integrity Self Checks — Fossil Repository</a></li> <li><a href="webui.wiki">Interface — The Fossil Web</a></li> <li><a href="copyright-release.html">License Agreement — Contributor</a></li> <li><a href="password.wiki">Management And Authentication — Password</a></li> <li><a href="branching.wiki">Merging, and Tagging — Branching, Forking,</a></li> <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE — Integrating Fossil in the</a></li> <li><a href="fiveminutes.wiki">Minutes as a Single User — Update and Running in 5</a></li> <li><a href="checkin_names.wiki">Names — Checkin And Version</a></li> <li><a href="adding_code.wiki">New Features To Fossil — Adding</a></li> <li><a href="newrepo.wiki">New Fossil Repository — How To Create A</a></li> <li><a href="foss-cklist.wiki">Open-Source Projects — Checklist For Successful</a></li> <li><a href="pop.wiki">Operations — Principles Of</a></li> <li><a href="tech_overview.wiki">Overview Of The Design And Implementation Of Fossil — A Technical</a></li> <li><a href="index.wiki">Page — Home</a></li> <li><a href="password.wiki">Password Management And Authentication</a></li> <li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General — Quotes: What</a></li> <li><a href="stats.wiki">Performance Statistics</a></li> <li><a href="../test/release-checklist.wiki">Pre-Release Testing Checklist</a></li> <li><a href="pop.wiki">Principles Of Operations</a></li> <li><a href="private.wiki">Private Branches — Creating, Syncing, and Deleting</a></li> <li><a href="makefile.wiki">Process — The Fossil Build</a></li> | > > | 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 | <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki">Import And Export To And From Git</a></li> <li><a href="build.wiki">Installing Fossil — Compiling and</a></li> <li><a href="fossil-from-msvc.wiki">Integrating Fossil in the Microsoft Express 2010 IDE</a></li> <li><a href="selfcheck.wiki">Integrity Self Checks — Fossil Repository</a></li> <li><a href="webui.wiki">Interface — The Fossil Web</a></li> <li><a href="th1.md">Language — The TH1 Scripting</a></li> <li><a href="copyright-release.html">License Agreement — Contributor</a></li> <li><a href="password.wiki">Management And Authentication — Password</a></li> <li><a href="branching.wiki">Merging, and Tagging — Branching, Forking,</a></li> <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE — Integrating Fossil in the</a></li> <li><a href="fiveminutes.wiki">Minutes as a Single User — Update and Running in 5</a></li> <li><a href="checkin_names.wiki">Names — Checkin And Version</a></li> <li><a href="adding_code.wiki">New Features To Fossil — Adding</a></li> <li><a href="newrepo.wiki">New Fossil Repository — How To Create A</a></li> <li><a href="foss-cklist.wiki">Open-Source Projects — Checklist For Successful</a></li> <li><a href="pop.wiki">Operations — Principles Of</a></li> <li><a href="tech_overview.wiki">Overview Of The Design And Implementation Of Fossil — A Technical</a></li> <li><a href="index.wiki">Page — Home</a></li> <li><a href="customskin.md">Pages — Theming: Customizing The Appearance of Web</a></li> <li><a href="password.wiki">Password Management And Authentication</a></li> <li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General — Quotes: What</a></li> <li><a href="stats.wiki">Performance Statistics</a></li> <li><a href="../test/release-checklist.wiki">Pre-Release Testing Checklist</a></li> <li><a href="pop.wiki">Principles Of Operations</a></li> <li><a href="private.wiki">Private Branches — Creating, Syncing, and Deleting</a></li> <li><a href="makefile.wiki">Process — The Fossil Build</a></li> |
| ︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 | <li><a href="quotes.wiki">Quotes: What People Are Saying About Fossil, Git, and DVCSes in General</a></li> <li><a href="selfhost.wiki">Repositories — Fossil Self Hosting</a></li> <li><a href="newrepo.wiki">Repository — How To Create A New Fossil</a></li> <li><a href="selfcheck.wiki">Repository Integrity Self Checks — Fossil</a></li> <li><a href="reviews.wiki">Reviews</a></li> <li><a href="fiveminutes.wiki">Running in 5 Minutes as a Single User — Update and</a></li> <li><a href="quotes.wiki">Saying About Fossil, Git, and DVCSes in General — Quotes: What People Are</a></li> <li><a href="selfcheck.wiki">Self Checks — Fossil Repository Integrity</a></li> <li><a href="selfhost.wiki">Self Hosting Repositories — Fossil</a></li> <li><a href="server.wiki">Server — How To Configure A Fossil</a></li> <li><a href="settings.wiki">Settings — Fossil</a></li> <li><a href="shunning.wiki">Shunning: Deleting Content From Fossil</a></li> <li><a href="fiveminutes.wiki">Single User — Update and Running in 5 Minutes as a</a></li> <li><a href="style.wiki">Source Code Style Guidelines</a></li> | > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | <li><a href="quotes.wiki">Quotes: What People Are Saying About Fossil, Git, and DVCSes in General</a></li> <li><a href="selfhost.wiki">Repositories — Fossil Self Hosting</a></li> <li><a href="newrepo.wiki">Repository — How To Create A New Fossil</a></li> <li><a href="selfcheck.wiki">Repository Integrity Self Checks — Fossil</a></li> <li><a href="reviews.wiki">Reviews</a></li> <li><a href="fiveminutes.wiki">Running in 5 Minutes as a Single User — Update and</a></li> <li><a href="quotes.wiki">Saying About Fossil, Git, and DVCSes in General — Quotes: What People Are</a></li> <li><a href="th1.md">Scripting Language — The TH1</a></li> <li><a href="selfcheck.wiki">Self Checks — Fossil Repository Integrity</a></li> <li><a href="selfhost.wiki">Self Hosting Repositories — Fossil</a></li> <li><a href="server.wiki">Server — How To Configure A Fossil</a></li> <li><a href="settings.wiki">Settings — Fossil</a></li> <li><a href="shunning.wiki">Shunning: Deleting Content From Fossil</a></li> <li><a href="fiveminutes.wiki">Single User — Update and Running in 5 Minutes as a</a></li> <li><a href="style.wiki">Source Code Style Guidelines</a></li> |
| ︙ | ︙ | |||
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 | <li><a href="sync.wiki">Sync Protocol — The Fossil</a></li> <li><a href="private.wiki">Syncing, and Deleting Private Branches — Creating,</a></li> <li><a href="custom_ticket.wiki">System — Customizing The Ticket</a></li> <li><a href="tickets.wiki">System — The Fossil Ticket</a></li> <li><a href="branching.wiki">Tagging — Branching, Forking, Merging, and</a></li> <li><a href="tech_overview.wiki">Technical Overview Of The Design And Implementation Of Fossil — A</a></li> <li><a href="../test/release-checklist.wiki">Testing Checklist — Pre-Release</a></li> <li><a href="makefile.wiki">The Fossil Build Process</a></li> <li><a href="sync.wiki">The Fossil Sync Protocol</a></li> <li><a href="tickets.wiki">The Fossil Ticket System</a></li> <li><a href="webui.wiki">The Fossil Web Interface</a></li> <li><a href="theory1.wiki">Thoughts On The Design Of The Fossil DVCS</a></li> <li><a href="custom_ticket.wiki">Ticket System — Customizing The</a></li> <li><a href="tickets.wiki">Ticket System — The Fossil</a></li> <li><a href="hints.wiki">Tips And Usage Hints — Fossil</a></li> <li><a href="bugtheory.wiki">Tracking In Fossil — Bug</a></li> <li><a href="fiveminutes.wiki">Update and Running in 5 Minutes as a Single User</a></li> <li><a href="hints.wiki">Usage Hints — Fossil Tips And</a></li> <li><a href="fiveminutes.wiki">User — Update and Running in 5 Minutes as a Single</a></li> <li><a href="ssl.wiki">Using SSL with Fossil</a></li> <li><a href="checkin_names.wiki">Version Names — Checkin And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> <li><a href="wikitheory.wiki">Wiki In Fossil</a></li> <li><a href="ssl.wiki">with Fossil — Using SSL</a></li> | > > > > | | 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 | <li><a href="sync.wiki">Sync Protocol — The Fossil</a></li> <li><a href="private.wiki">Syncing, and Deleting Private Branches — Creating,</a></li> <li><a href="custom_ticket.wiki">System — Customizing The Ticket</a></li> <li><a href="tickets.wiki">System — The Fossil Ticket</a></li> <li><a href="branching.wiki">Tagging — Branching, Forking, Merging, and</a></li> <li><a href="tech_overview.wiki">Technical Overview Of The Design And Implementation Of Fossil — A</a></li> <li><a href="../test/release-checklist.wiki">Testing Checklist — Pre-Release</a></li> <li><a href="th1.md">TH1 Scripting Language — The</a></li> <li><a href="makefile.wiki">The Fossil Build Process</a></li> <li><a href="sync.wiki">The Fossil Sync Protocol</a></li> <li><a href="tickets.wiki">The Fossil Ticket System</a></li> <li><a href="webui.wiki">The Fossil Web Interface</a></li> <li><a href="th1.md">The TH1 Scripting Language</a></li> <li><a href="customskin.md">Theming: Customizing The Appearance of Web Pages</a></li> <li><a href="theory1.wiki">Thoughts On The Design Of The Fossil DVCS</a></li> <li><a href="custom_ticket.wiki">Ticket System — Customizing The</a></li> <li><a href="tickets.wiki">Ticket System — The Fossil</a></li> <li><a href="hints.wiki">Tips And Usage Hints — Fossil</a></li> <li><a href="bugtheory.wiki">Tracking In Fossil — Bug</a></li> <li><a href="fiveminutes.wiki">Update and Running in 5 Minutes as a Single User</a></li> <li><a href="hints.wiki">Usage Hints — Fossil Tips And</a></li> <li><a href="fiveminutes.wiki">User — Update and Running in 5 Minutes as a Single</a></li> <li><a href="ssl.wiki">Using SSL with Fossil</a></li> <li><a href="checkin_names.wiki">Version Names — Checkin And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="customskin.md">Web Pages — Theming: Customizing The Appearance of</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> <li><a href="wikitheory.wiki">Wiki In Fossil</a></li> <li><a href="ssl.wiki">with Fossil — Using SSL</a></li> </ul></div> |
Changes to www/quickstart.wiki.
| ︙ | ︙ | |||
385 386 387 388 389 390 391 |
<b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
</blockquote>
<h2>More Hints</h2>
<p>A [/help | complete list of commands] is available, as is the
[./hints.wiki|helpful hints] document. See the
| | | 385 386 387 388 389 390 391 392 393 394 395 |
<b>fossil sync http://192.168.1.36:8080/ --proxy off</b>
</blockquote>
<h2>More Hints</h2>
<p>A [/help | complete list of commands] is available, as is the
[./hints.wiki|helpful hints] document. See the
[./permutedindex.html#pindex|permuted index] for additional
documentation.
<p>Explore and have fun!</p>
|
Changes to www/quotes.wiki.
| ︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 | (while following the instructions!!!) than any other single piece of software. <blockquote> <i>Stephen Beal on the [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg17181.html|Fossil mailing list] 2014-09-01.</i> </blockquote> </ol> <h2>On The Usability Of Fossil:</h2> <ol> | > > > > > > > | | 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 | (while following the instructions!!!) than any other single piece of software. <blockquote> <i>Stephen Beal on the [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg17181.html|Fossil mailing list] 2014-09-01.</i> </blockquote> <li>If programmers _really_ wanted to help scientists, they'd build a version control system that was more usable than Git. <blockquote> <i>Tweet by Greg Wilson @gvwilson on 2015-02-22 17:47</i> </blockquote> </ol> <h2>On The Usability Of Fossil:</h2> <ol> <li value=10> Fossil mesmerizes me with simplicity especially after I struggled to get a bug-tracking system to work with mercurial. <blockquote> <i>rawjeev at [http://stackoverflow.com/questions/156322/what-do-people-think-of-the-fossil-dvcs]</i> </blockquote> |
| ︙ | ︙ | |||
106 107 108 109 110 111 112 | </ol> <h2>On Git Versus Fossil</h2> <ol> | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | </ol> <h2>On Git Versus Fossil</h2> <ol> <li value=13> Just want to say thanks for fossil making my life easier.... Also <nowiki>[for]</nowiki> not having a misanthropic command line interface. <blockquote> <i>Joshua Paine at [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg02736.html]</i> </blockquote> |
| ︙ | ︙ |
Changes to www/selfcheck.wiki.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 | zlib-compression which is relatively well-tested but still might cause corruption if used improperly. And there is the relatively new delta-encoding mechanism designed expressly for fossil. We want to make sure that bugs in these encoding mechanisms do not lead to loss of data. To increase our confidence that everything in the repository is | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | zlib-compression which is relatively well-tested but still might cause corruption if used improperly. And there is the relatively new delta-encoding mechanism designed expressly for fossil. We want to make sure that bugs in these encoding mechanisms do not lead to loss of data. To increase our confidence that everything in the repository is recoverable, fossil makes sure it can extract an exact replica of every content file that it changes just prior to transaction commit. So during the course of check-in (or other repository operation) many different files in the repository might be modified. Some files are simply compressed. Other files are delta encoded and then compressed. While all this is going on, fossil makes a record of every file that is encoded and the SHA1 hash of the original content of that |
| ︙ | ︙ |
Changes to www/sync.wiki.
| ︙ | ︙ | |||
382 383 384 385 386 387 388 | <p>The reqconfig card is normally sent in response to the "fossil configuration pull" command. The format is as follows: <blockquote> <b>reqconfig</b> <i>configuration-name</i> </blockquote> | | | < | < > > > > > > > > > > > > > > > > > > > < > | 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 | <p>The reqconfig card is normally sent in response to the "fossil configuration pull" command. The format is as follows: <blockquote> <b>reqconfig</b> <i>configuration-name</i> </blockquote> <p>As of [/timeline?r=trunk&c=2015-01-24+00%3A17%3A55&n=20|2015-01-24], the configuration-name must be one of the following values: <center><table border=0> <tr><td valign="top"> <ul> <li> css <li> header <li> footer <li> logo-mimetype <li> logo-image <li> background-mimetype <li> background-image <li> index-page <li> timeline-block-markup <li> timeline-max-comment <li> timeline-plaintext <ul></td><td valign="top"><ul> <li> adunit <li> adunit-omit-if-admin <li> adunit-omit-if-user <li> white-foreground <li> project-name <li> short-project-name <li> project-description <li> index-page <li> manifest <li> binary-glob <li> clean-glob <ul></td><td valign="top"><ul> <li> ignore-glob <li> keep-glob <li> crnl-glob <li> encoding-glob <li> empty-dirs <li> allow-symlinks <li> ticket-table <li> ticket-common <li> ticket-change <li> ticket-newpage <li> ticket-viewpage <ul></td><td valign="top"><ul> <li> ticket-editpage <li> ticket-reportlist <li> ticket-report-template <li> ticket-key-template <li> ticket-title-expr <li> ticket-closed-expr <li> @reportfmt <li> @user |
| ︙ | ︙ |
Added www/th1.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 163 164 165 166 |
TH1 Scripts
===========
TH1 is a very small scripting language used to help generate web-page
content in Fossil.
Origins
-------
TH1 began as a minimalist reimplementation of the TCL scripting language.
There was a need to test the SQLite library on Symbian phones, but at that
time all of the test cases for SQLite were written in Tcl and Tcl could not
be easily compiled on the SymbianOS. So TH1 was developed as a cut-down
version of TCL that would facilitate running the SQLite test scripts on
SymbianOS.
The testing of SQLite on SymbianOS was eventually accomplished by other
means. But Fossil was first being designed at about the same time.
Early prototypes of Fossil were written in pure TCL. But as the development
shifted toward the use of C-code, the need arose to have a TCL-like
scripting language to help with code generation. TH1 was small and
light-weight and used minimal resources and seemed ideally suited for the
task.
The name "TH1" stands "Test Harness 1", since that was its original purpose.
Overview
--------
TH1 is a string-processing language. All values are strings. Any numerical
operations are accomplished by converting from string to numeric, performing
the computation, then converting the result back into a string. (This might
seem inefficient, but it is faster than people imagine, and numeric
computations do not come up very often for the kinds of work that TH1 does,
so it has never been a factor.)
A TH1 script consist of a sequence of commands.
Each command is terminated by the first (unescaped) newline or ";" character.
The text of the command (excluding the newline or semicolon terminator)
is broken into space-separated tokens. The first token is the command
name and subsequent tokens are the arguments. In this since, TH1 syntax
is similar to the familiar command-line shell syntax.
A token is any sequence of characters other than whitespace and semicolons.
Or, all text without double-quotes is a single token even if it includes
whitespace and semicolons. Or, all text without nested {...} pairs is a
single token.
The nested {...} form of tokens is important because it allows TH1 commands
to have an appearance similar to C/C++. It is important to remember, though,
that a TH1 script is really just a list of text commands, not a context-free
language with a grammar like C/C++. This can be confusing to long-time
C/C++ programmers because TH1 does look a lot like C/C++. But the semantics
of TH1 are closer to FORTH or Lisp than they are to C.
Consider the "if" command in TH1.
if {$current eq "dev"} {
puts "hello"
} else {
puts "world"
}
The example above is a single command. The first token, and the name
of the command, is "if".
The second token is '$current eq "dev"' - an expression. (The outer {...}
are removed from each token by the command parser.) The third token
is the 'puts "hello"', with its whitespace and newlines. The fourth token
is "else". And the fifth and last token is 'puts "world"'.
The "if" command word by evaluating its first argument (the second token)
as an expression, and if that expression is true, evaluating its
second argument (the third token) as a TH1 script.
If the expression is false and the third argument is "else" then
the fourth argument is evaluated as a TH1 expression.
So, you see, even though the example above spans five lines, it is really
just a single command.
Summary of Core TH1 Commands
----------------------------
The original TCL language after when TH1 is modeled has a very rich
repetoire of commands. TH1, as it is designed to be minimalist and
embedded has a greatly reduced command set. The following bullets
summarize the commands available in TH1:
* break
* catch SCRIPT ?VARIABLE?
* continue
* error ?STRING?
* expr EXPR
* for INIT-SCRIPT TEST-EXPR NEXT-SCRIPT BODY-SCRIPT
* if EXPR SCRIPT (elseif EXPR SCRIPT)* ?else SCRIPT?
* info exists VARNAME
* lindex LIST INDEX
* list ARG ...
* llength LIST
* proc NAME ARG-LIST BODY-SCRIPT
* rename OLD NEW
* return ?-code CODE? ?VALUE?
* set VARNAME VALUE
* string compare STR1 STR2
* string first NEEDLE HAYSTACK ?START-INDEX?
* string is CLASS STRING
* string last NEEDLE HAYSTACK ?START-INDEX?
* string length STRING
* string range STRING FIRST LAST
* string repeat STRING COUNT
* unset VARNAME
* uplevel ?LEVEL? SCRIPT
* upvar ?FRAME? OTHERVAR MYVAR ?OTHERVAR MYVAR?
All of the above commands works as in the original TCL. Refer to the
TCL documentation for details.
TH1 Extended Commands
---------------------
There are many new commands added to TH1 and used to access the special
features of Fossil. The following is a summary of the extended commands:
* anoncap
* anycap
* artifact
* checkout
* combobox
* date
* decorate
* enable_output
* getParameter
* globalState
* httpize
* hascap
* hasfeature
* html
* htmlize
* http
* linecount
* puts
* query
* randhex
* regexp
* reinitialize
* render
* repository
* searchable
* setParameter
* setting
* styleHeader
* styleFooter
* tclReady
* trace
* stime
* utime
* wiki
Each of the commands above is documented by a block comment above their
implementation in the th_main.c source file.
**To Do:** We would like to have a community volunteer go through and
copy the documentation for each of these command (with appropriate
format changes and spelling and grammar corrections) into subsequent
sections of this document. It is suggested that the list of extension
commands be left intact - as a quick reference. But it would be really
nice to also have the details of each each command does.
|
Added www/webpage-ex.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 |
Web-Page Examples
=================
Here are a few examples of the many web pages supported
by Fossil. This is not an exhaustive list.
Explore hyperlinks to see more.
<style>
.exbtn {
border: 1px solid #000;
margin: 1ex;
border-radius: 1ex;
padding: 0 1ex;
background-color: #eee;
}
</style>
* <a target='_blank' class='exbtn'
href='../../../timeline?y=ci&n=100'>Example</a>
100 most recent check-ins.
* <a target='_blank' class='exbtn'
href='../../../finfo?name=src/file.c'>Example</a>
All changes to the <b>src/file.c</b> source file.
* <a target='_blank' class='exbtn'
href='../../../timeline?n=200&uf=0c3c2d086a'>Example</a>
All check-ins using a particular version of the <b>src/file.c</b>
source file.
* <a target='_blank' class='exbtn'
href='../../../timeline?n=11&y=ci&c=2014-01-01'>Example</a>
Check-ins proximate to an historical point in time (2014-01-01).
* <a target='_blank' class='exbtn'
href='../../../timeline?n=11&y=ci&c=2014-01-01&v=1'>Example</a>
The previous augmented with file changes.
* <a target='_blank' class='exbtn'
href='../../../timeline?n=25&y=ci&a=1970-01-01'>Example</a>
First 25 check-ins after 1970-01-01. (The first 25 check-ins of
the project.)
* <a target='_blank' class='exbtn'
href='../../../timeline?n=200&r=svn-import'>Example</a>
All check-ins of the "svn-import" branch together with check-ins
that merge with that branch.
* <a target='_blank' class='exbtn'
href='../../../timeline?n=200&t=svn-import'>Example</a>
All check-ins of the "svn-import" branch only.
* <a target='_blank' class='exbtn'
href='../../../timeline?n=100&y=ci&ubg'>Example</a>
100 most recent check-ins color coded by committer.
* <a target='_blank' class='exbtn'
href='../../../timeline?from=version-1.27&to=version-1.28'>Example</a>
All check-ins on the most direct path from
version-1.27 to version-1.28
(Hint: In any graph above, click the square node boxes
for two check-ins or files to see a diff.)
* <a target='_blank' class='exbtn'
href='../../../tree?ci=daff9d20621&type=tree'>Example</a>
All files for a particular check-in (daff9d20621480)
* <a target='_blank' class='exbtn'
href='../../../tree?ci=trunk&type=tree&mtime=1'>Example</a>
All files for the latest check-in on a branch (trunk) sorted by
last modification time.
* <a target='_blank' class='exbtn'
href='../../../fileage?name=svn-import'>Example</a>
Age of all files in the latest checking for branch "svn-import".
last modification time.
* <a target='_blank' class='exbtn'
href='../../../brlist'>Example</a>
Table of branches. (Click on column headers to sort.)
* <a target='_blank' class='exbtn'
href='../../../stat'>Example</a>
Overall repository status.
* <a target='_blank' class='exbtn'
href='../../../reports?view=byfile'>Example</a>
Number of check-ins for each source file.
(Click on column headers to sort.)
* <a target='_blank' class='exbtn'
href='../../../blame?checkin=5260fbf63287&filename=src/rss.c&limit=-1'>
Example</a>
Most recent change to each line of a particular source file in a
particular check-in.
* <a target='_blank' class='exbtn'
href='../../../taglist'>Example</a>
List of tags on check-ins.
|
Changes to www/webui.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 | <title>The Fossil Web Interface</title> One of the innovative features of Fossil is its built-in web interface. This web interface provides everything you need to run a software development project: * [./bugtheory.wiki | Ticketing and bug tracking] * [./wikitheory.wiki | Wiki] * [./embeddeddoc.wiki | On-line documentation] * Status information * Timelines * Graphs of revision and branching history | | | | 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 | <title>The Fossil Web Interface</title> One of the innovative features of Fossil is its built-in web interface. This web interface provides everything you need to run a software development project: * [./bugtheory.wiki | Ticketing and bug tracking] * [./wikitheory.wiki | Wiki] * [./embeddeddoc.wiki | On-line documentation] * Status information * Timelines * Graphs of revision and branching history * [./event.wiki | Technical notes] * File and version lists and differences * Download historical versions as ZIP archives * Historical change data * Add and remove tags on checkins * Move checkins between branches * Revise checkin comments * Manage user credentials and access permissions * And so forth... (some [./webpage-ex.md|examples]) You get all of this, and more, for free when you use Fossil. There are no extra programs to install or setup. Everything you need is already pre-configured and built into the self-contained, stand-alone Fossil executable. As an example of how useful this web interface can be, |
| ︙ | ︙ |
Changes to www/wikitheory.wiki.
1 2 3 4 5 6 7 8 9 | <title>Wiki In Fossil</title> <h2>Introduction</h2> Fossil uses [/wiki_rules | wiki markup] for many things: * Stand-alone wiki pages. * Description and comments in [./bugtheory.wiki | bug reports]. * Check-in comments. * [./embeddeddoc.wiki | Embedded documentation] files whose | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<title>Wiki In Fossil</title>
<h2>Introduction</h2>
Fossil uses [/wiki_rules | wiki markup] for many things:
* Stand-alone wiki pages.
* Description and comments in [./bugtheory.wiki | bug reports].
* Check-in comments.
* [./embeddeddoc.wiki | Embedded documentation] files whose
name ends in ".wiki".
* [./event.wiki | Technical notes].
The [/wiki_rules | formatting rules] for fossil wiki
are designed to be simple and intuitive. The idea is that wiki provides
paragraph breaks, numbered and bulleted lists, and hyperlinking for
simple documents together with a safe subset of HTML for more complex
formatting tasks.
|
| ︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
all formatting tasks.
3. Where the fossil wiki markup language is insufficient, HTML is
used. HTML is a standard language familiar to most programmers so
there is nothing new to learn. And, though cumbersome, the HTML
does not need to be used very often so is not a burden.
<h2>Stand-alone Wiki Pages</h2>
Each wiki page has its own revision history which is independent of
the sequence of check-ins (check-ins). Wiki pages can branch and merge
just like check-ins, though as of this writing (2008-07-29) there is
no mechanism in the user interface to support branching and merging.
| > > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
all formatting tasks.
3. Where the fossil wiki markup language is insufficient, HTML is
used. HTML is a standard language familiar to most programmers so
there is nothing new to learn. And, though cumbersome, the HTML
does not need to be used very often so is not a burden.
UPDATE: Since 2012, Fossil also contains a [/md_rules | Markdown]
rendering engine. Markdown can optionally be used to format
[./embeddeddoc.wiki | embedded documents], wiki pages,
[./event.wiki | technical notes], and bug report text.
<h2>Stand-alone Wiki Pages</h2>
Each wiki page has its own revision history which is independent of
the sequence of check-ins (check-ins). Wiki pages can branch and merge
just like check-ins, though as of this writing (2008-07-29) there is
no mechanism in the user interface to support branching and merging.
|
| ︙ | ︙ |