Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Combine the "config" and "setting" commands into a single "settings" command. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
134e2aeccc0acc8a4ced04da5403df23 |
| User & Date: | drh 2007-09-28 20:08:32.000 |
Context
|
2007-10-02
| ||
| 10:34 | Added rudimentary proxy support to fossil chat client ... (check-in: 307233d828 user: mjanssen tags: trunk) | |
|
2007-09-28
| ||
| 20:08 | Combine the "config" and "setting" commands into a single "settings" command. ... (check-in: 134e2aeccc user: drh tags: trunk) | |
| 15:44 | Add enumeration lists and indented paragraphs in the wiki. ... (check-in: ab637af752 user: drh tags: trunk) | |
Changes
Changes to ideas.txt.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 | relatedversions add or subtract associate with manifest presentin add or subtract uuid fixedin add or subtract uuid Other table columns: origintime lastchange | | > > > > > > > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | relatedversions add or subtract associate with manifest presentin add or subtract uuid fixedin add or subtract uuid Other table columns: origintime lastchange Field Types: text width height enum width valuelist datetime width cumulative-text width height set-of-uuid width set-of-checkin width Tables: tktrid(rid, tkid, mtime); index(tkid, mtime); ticket(tkid, tkuuid, title, com, status, ...); tktfield(name, type, width, height, default, valuelist); tktxref(tkid, mid); index(tkid); index(mid); |
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
220 221 222 223 224 225 226 |
char *zComment;
int i;
blob_set(&text,
"\n# Enter comments on this commit. Lines beginning with # are ignored\n"
"#\n"
);
status_report(&text, "# ");
| | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
char *zComment;
int i;
blob_set(&text,
"\n# Enter comments on this commit. Lines beginning with # are ignored\n"
"#\n"
);
status_report(&text, "# ");
zEditor = db_get("editor", 0);
if( zEditor==0 ){
zEditor = getenv("VISUAL");
}
if( zEditor==0 ){
zEditor = getenv("EDITOR");
}
if( zEditor==0 ){
|
| ︙ | ︙ |
Changes to src/clearsign.c.
| ︙ | ︙ | |||
32 33 34 35 36 37 38 |
** Clearsign the given blob. Put the signed version in
** pOut.
*/
int clearsign(Blob *pIn, Blob *pOut){
char *zRand;
char *zIn;
char *zOut;
| | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
** Clearsign the given blob. Put the signed version in
** pOut.
*/
int clearsign(Blob *pIn, Blob *pOut){
char *zRand;
char *zIn;
char *zOut;
char *zBase = db_get("clear-sign", "gpg --clearsign -o ");
char *zCmd;
int rc;
zRand = db_text(0, "SELECT hex(randomblob(10))");
zOut = mprintf("out-%s", zRand);
zIn = mprintf("in-%z", zRand);
blob_write_to_file(pIn, zOut);
zCmd = mprintf("%s %s %s", zBase, zIn, zOut);
|
| ︙ | ︙ |
Changes to src/clone.c.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 | } url_parse(g.argv[2]); db_create_repository(g.argv[3]); db_open_repository(g.argv[3]); db_begin_transaction(); db_initial_setup(0, 0); user_select(); | | | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
}
url_parse(g.argv[2]);
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_begin_transaction();
db_initial_setup(0, 0);
user_select();
db_set("content-schema", CONTENT_SCHEMA, 0);
db_set("aux-schema", AUX_SCHEMA, 0);
if( !g.urlIsFile ){
db_set("last-sync-url", g.argv[2], 0);
}
db_multi_exec(
"INSERT INTO config(name,value)"
" VALUES('server-code', lower(hex(randomblob(20))));"
);
if( g.urlIsFile ){
Stmt q;
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
677 678 679 680 681 682 683 |
**
** The makeInitialVersion flag determines whether or not an initial
** manifest is created. The makeServerCodes flag determines whether or
** not server and project codes are invented for this repository.
*/
void db_initial_setup (int makeInitialVersion, int makeServerCodes){
char *zDate;
| | | | | | | | | 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 |
**
** The makeInitialVersion flag determines whether or not an initial
** manifest is created. The makeServerCodes flag determines whether or
** not server and project codes are invented for this repository.
*/
void db_initial_setup (int makeInitialVersion, int makeServerCodes){
char *zDate;
const char *zUser;
Blob hash;
Blob manifest;
db_set("content-schema", CONTENT_SCHEMA, 0);
db_set("aux-schema", AUX_SCHEMA, 0);
if( makeServerCodes ){
db_multi_exec(
"INSERT INTO config(name,value)"
" VALUES('server-code', lower(hex(randomblob(20))));"
"INSERT INTO config(name,value)"
" VALUES('project-code', lower(hex(randomblob(20))));"
);
}
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
if( !db_is_global("safemerge") ) db_set_int("safemerge", 0, 0);
if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
zUser = db_get("default-user", 0);
if( zUser==0 ){
zUser = getenv("USER");
}
if( zUser==0 ){
zUser = "root";
}
db_multi_exec(
|
| ︙ | ︙ | |||
830 831 832 833 834 835 836 | } } /* ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the ** repository and local databases. */ | | | > | | > > > > > > > > | > | > > > | > > > > > > > > > | > > > | | < > > | < < > | | > > | > | | > > > > | 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 |
}
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
** repository and local databases.
*/
const char *db_get(const char *zName, const char *zDefault){
const char *z = 0;
if( g.repositoryOpen ){
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
}
if( z==0 ){
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
}
if( z==0 ){
z = zDefault;
}
return z;
}
void db_set(const char *zName, const char *zValue, int globalFlag){
db_begin_transaction();
db_multi_exec("REPLACE INTO %sconfig(name,value) VALUES(%Q,%Q)",
globalFlag ? "global_" : "", zName, zValue);
if( globalFlag && g.repositoryOpen ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
db_end_transaction(0);
}
int db_is_global(const char *zName){
return db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName);
}
int db_get_int(const char *zName, int dflt){
int v;
int rc;
if( g.repositoryOpen ){
Stmt q;
db_prepare(&q, "SELECT value FROM config WHERE name=%Q", zName);
rc = db_step(&q);
if( rc==SQLITE_ROW ){
v = db_column_int(&q, 0);
}
db_finalize(&q);
}else{
rc = SQLITE_DONE;
}
if( rc==SQLITE_DONE ){
v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName);
}
return v;
}
void db_set_int(const char *zName, int value, int globalFlag){
db_begin_transaction();
db_multi_exec("REPLACE INTO %sconfig(name,value) VALUES(%Q,%d)",
globalFlag ? "global_" : "", zName, value);
if( globalFlag && g.repositoryOpen ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
db_end_transaction(0);
}
char *db_lget(const char *zName, const char *zDefault){
return db_text((char*)zDefault,
"SELECT value FROM vvar WHERE name=%Q", zName);
}
void db_lset(const char *zName, const char *zValue){
db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%Q)", zName, zValue);
|
| ︙ | ︙ | |||
902 903 904 905 906 907 908 |
g.argv = azNewArgv;
g.argc = 3;
update_cmd();
}
}
/*
| < < < < < < | < < < < < < < < < < < | < < | | < < < | < < < < > > < < | < < < < < | | | > | < < < | | < < < < < < < < < | | | | | > > > > > > > > > > > > | | | | 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 |
g.argv = azNewArgv;
g.argc = 3;
update_cmd();
}
}
/*
** Print the value of a setting named zName
*/
static void print_setting(const char *zName){
Stmt q;
db_prepare(&q,
"SELECT '(local)', value FROM config WHERE name=%Q"
" UNION ALL "
"SELECT '(global)', value FROM global_config WHERE name=%Q",
zName, zName
);
if( db_step(&q)==SQLITE_ROW ){
printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
db_column_text(&q, 1));
}else{
printf("%-20s\n", zName);
}
db_finalize(&q);
}
/*
** COMMAND: settings
** %fossil setting ?PROPERTY? ?VALUE? ?-global?
**
** With no arguments, list all properties and their values. With just
** a property name, show the value of that property. With a value
** argument, change the property for the current repository.
**
** autosync If enabled, automatically pull prior to
** commit or update and automatically push
** after commit or tag or branch creation.
**
** clear-sign Command used to clear-sign manifests at check-in.
** The default is "gpg --clearsign -o ".
**
** editor Text editor command used for check-in comments.
**
** localauth If enabled, require that HTTP connections from
** 127.0.0.1 be authenticated by password. If
** false, all HTTP requests from localhost have
** unrestricted access to the repository.
**
** omit-sign When enabled, fossil will not attempt to sign any
** commit with gpg. All commits will be unsigned.
**
** safemerge If enabled, when commit will cause a fork, the
** commit will not abort with warning. Also update
** will not be allowed if local changes exist.
*/
void setting_cmd(void){
static const char *azName[] = {
"autosync",
"clearsign",
"editor",
"localauth",
"omitsig",
"safemerge",
};
int i;
int globalFlag = find_option("global","g",0)!=0;
db_find_and_open_repository();
if( g.argc==2 ){
for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
print_setting(azName[i]);
}
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int n = strlen(zName);
for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
if( strncmp(azName[i], zName, n)==0 ) break;
}
if( i>=sizeof(azName)/sizeof(azName[0]) ){
fossil_fatal("no such setting: %s", zName);
}
if( g.argc==4 ){
db_set(azName[i], g.argv[3], globalFlag);
}else{
print_setting(azName[i]);
}
}else{
usage("?PROPERTY? ?VALUE?");
}
}
|
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
86 87 88 89 90 91 92 |
usage("?OPTIONS? FILE");
}
db_must_be_within_tree();
if( internalDiff==0 ){
const char *zExternalCommand;
if( strcmp(g.argv[1], "diff")==0 ){
| | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
usage("?OPTIONS? FILE");
}
db_must_be_within_tree();
if( internalDiff==0 ){
const char *zExternalCommand;
if( strcmp(g.argv[1], "diff")==0 ){
zExternalCommand = db_get("diff-command", 0);
}else{
zExternalCommand = db_get("gdiff-command", 0);
}
if( zExternalCommand==0 ){
internalDiff=1;
}
blob_zero(&cmd);
blob_appendf(&cmd, "%s ", zExternalCommand);
}
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
427 428 429 430 431 432 433 |
}
if( zQ==0 && P("submit") ){
zQ = "off";
}
if( zQ ){
int iQ = strcmp(zQ,"on")==0 || atoi(zQ);
if( iQ!=iVal ){
| | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
}
if( zQ==0 && P("submit") ){
zQ = "off";
}
if( zQ ){
int iQ = strcmp(zQ,"on")==0 || atoi(zQ);
if( iQ!=iVal ){
db_set(zVar, iQ ? "1" : "0", 0);
iVal = iQ;
}
}
if( iVal ){
@ <input type="checkbox" name="%s(zQParm)" checked>%s(zLabel)</input>
}else{
@ <input type="checkbox" name="%s(zQParm)">%s(zLabel)</input>
|
| ︙ | ︙ | |||
451 452 453 454 455 456 457 |
const char *zVar, /* The corresponding row in the VAR table */
const char *zQParm, /* The query parameter */
const char *zDflt /* Default value if VAR table entry does not exist */
){
const char *zVal = db_get(zVar, zDflt);
const char *zQ = P(zQParm);
if( zQ && strcmp(zQ,zVal)!=0 ){
| | | | 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 |
const char *zVar, /* The corresponding row in the VAR table */
const char *zQParm, /* The query parameter */
const char *zDflt /* Default value if VAR table entry does not exist */
){
const char *zVal = db_get(zVar, zDflt);
const char *zQ = P(zQParm);
if( zQ && strcmp(zQ,zVal)!=0 ){
db_set(zVar, zQ, 0);
zVal = zQ;
}
@ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)">
@ %s(zLabel)
}
/*
** Generate a text box for an attribute.
*/
static void textarea_attribute(
const char *zLabel, /* The text label on the textarea */
int rows, /* Rows in the textarea */
int cols, /* Columns in the textarea */
const char *zVar, /* The corresponding row in the VAR table */
const char *zQParm, /* The query parameter */
const char *zDflt /* Default value if VAR table entry does not exist */
){
const char *zVal = db_get(zVar, zDflt);
const char *zQ = P(zQParm);
if( zQ && strcmp(zQ,zVal)!=0 ){
db_set(zVar, zQ, 0);
zVal = zQ;
}
@ <textarea name="%s(zQParm)" rows="%d(rows)" cols="%d(cols)">%h(zVal)</textarea>
@ %s(zLabel)
}
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
143 144 145 146 147 148 149 |
/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
| | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
char *zHome = (char*)db_get("homepage", 0);
if( zHome ){
g.zExtra = zHome;
g.okRdWiki = 1;
wiki_page();
}else{
style_header("Main Title Page");
@ No homepage configured for this server
|
| ︙ | ︙ |
Changes to src/sync.c.
| ︙ | ︙ | |||
72 73 74 75 76 77 78 |
if( zUrl==0 ){
usage("URL");
}
url_parse(zUrl);
if( g.urlIsFile ){
fossil_fatal("network sync only");
}
| | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
if( zUrl==0 ){
usage("URL");
}
url_parse(zUrl);
if( g.urlIsFile ){
fossil_fatal("network sync only");
}
db_set("last-sync-url", zUrl, 0);
user_select();
if( g.argc==2 ){
if( g.urlPort!=80 ){
printf("Server: http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
}else{
printf("Server: http://%s%s\n", g.urlName, g.urlPath);
}
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
198 199 200 201 202 203 204 |
}else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){
user_select();
if( g.argc==3 ){
printf("%s\n", g.zLogin);
}else if( g.localOpen ){
db_lset("default-user", g.zLogin);
}else{
| | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
}else if( n>=2 && strncmp(g.argv[2],"default",n)==0 ){
user_select();
if( g.argc==3 ){
printf("%s\n", g.zLogin);
}else if( g.localOpen ){
db_lset("default-user", g.zLogin);
}else{
db_set("default-user", g.zLogin, 0);
}
}else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){
Stmt q;
db_prepare(&q, "SELECT login, info FROM user ORDER BY login");
while( db_step(&q)==SQLITE_ROW ){
printf("%-12s %s\n", db_column_text(&q, 0), db_column_text(&q, 1));
}
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
810 811 812 813 814 815 816 |
){
if( blob_eq_str(&xfer.aToken[1], zSCode, -1) ){
fossil_fatal("server loop");
}
nMsg++;
if( zPCode==0 ){
zPCode = mprintf("%b", &xfer.aToken[2]);
| | | | 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 |
){
if( blob_eq_str(&xfer.aToken[1], zSCode, -1) ){
fossil_fatal("server loop");
}
nMsg++;
if( zPCode==0 ){
zPCode = mprintf("%b", &xfer.aToken[2]);
db_set("project-code", zPCode, 0);
}
cloneFlag = 0;
pullFlag = 1;
blob_appendf(&send, "pull %s %s\n", zSCode, zPCode);
nMsg++;
}else
/* cookie TEXT
**
** The server might include a cookie in its reply. The client
** should remember this cookie and send it back to the server
** in its next query.
**
** Each cookie received overwrites the prior cookie from the
** same server.
*/
if( blob_eq(&xfer.aToken[0], "cookie") && xfer.nToken==2 ){
db_set("cookie", blob_str(&xfer.aToken[1]), 0);
}else
/* message MESSAGE
**
** Print a message. Similar to "error" but does not stop processing
*/
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
|
| ︙ | ︙ |