Fossil SCM

Extended the online help for the commit, close, configure, clone and checkout commands

Arjen Markus 2011-05-24 07:27 arjen-doc-updates
Commit 7df226540de76325323251311d3730cf38eb28ee
+11 -1
--- src/checkin.c
+++ src/checkin.c
@@ -841,12 +841,22 @@
841841
** The --private option creates a private check-in that is never synced.
842842
** Children of private check-ins are automatically private.
843843
**
844844
** the --tag option applies the symbolic tag name to the check-in.
845845
**
846
-** Options:
846
+** Notes:
847
+** - If you commit without the --branch option, the last branch (or the
848
+** trunk) will be used.
849
+** - If you do not specify a commit message or an empty message, the commit
850
+** will be aborted.
851
+** - fossil prefers text files in the UNIX format (line-endings only "LF").
852
+** If it encounters text files in the Windows format (CRLF), it will
853
+** warn about that.
854
+** (File that are considered binary are stored as-is)
847855
**
856
+** SUMMARY: fossil commit ?OPTIONS? ?FILE...?
857
+** Options:
848858
** --comment|-m COMMENT-TEXT
849859
** --message-file|-M COMMENT-FILE
850860
** --branch NEW-BRANCH-NAME
851861
** --bgcolor COLOR
852862
** --nosign
853863
--- src/checkin.c
+++ src/checkin.c
@@ -841,12 +841,22 @@
841 ** The --private option creates a private check-in that is never synced.
842 ** Children of private check-ins are automatically private.
843 **
844 ** the --tag option applies the symbolic tag name to the check-in.
845 **
846 ** Options:
 
 
 
 
 
 
 
 
847 **
 
 
848 ** --comment|-m COMMENT-TEXT
849 ** --message-file|-M COMMENT-FILE
850 ** --branch NEW-BRANCH-NAME
851 ** --bgcolor COLOR
852 ** --nosign
853
--- src/checkin.c
+++ src/checkin.c
@@ -841,12 +841,22 @@
841 ** The --private option creates a private check-in that is never synced.
842 ** Children of private check-ins are automatically private.
843 **
844 ** the --tag option applies the symbolic tag name to the check-in.
845 **
846 ** Notes:
847 ** - If you commit without the --branch option, the last branch (or the
848 ** trunk) will be used.
849 ** - If you do not specify a commit message or an empty message, the commit
850 ** will be aborted.
851 ** - fossil prefers text files in the UNIX format (line-endings only "LF").
852 ** If it encounters text files in the Windows format (CRLF), it will
853 ** warn about that.
854 ** (File that are considered binary are stored as-is)
855 **
856 ** SUMMARY: fossil commit ?OPTIONS? ?FILE...?
857 ** Options:
858 ** --comment|-m COMMENT-TEXT
859 ** --message-file|-M COMMENT-FILE
860 ** --branch NEW-BRANCH-NAME
861 ** --bgcolor COLOR
862 ** --nosign
863
+8 -3
--- src/checkout.c
+++ src/checkout.c
@@ -166,11 +166,11 @@
166166
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
167167
unlink(zManFile);
168168
free(zManFile);
169169
}
170170
}
171
-
171
+
172172
}
173173
174174
/*
175175
** COMMAND: checkout
176176
** COMMAND: co
@@ -185,20 +185,23 @@
185185
**
186186
** The --latest flag can be used in place of VERSION to checkout the
187187
** latest version in the repository.
188188
**
189189
** See also the "update" command.
190
+**
191
+** SUMMARY: fossil checkout VERSION ?-f|--force? ?--keep?
192
+** Note: VERSION can also be --latest
190193
*/
191194
void checkout_cmd(void){
192195
int forceFlag; /* Force checkout even if edits exist */
193196
int keepFlag; /* Do not change any files on disk */
194197
int latestFlag; /* Checkout the latest version */
195198
char *zVers; /* Version to checkout */
196199
int promptFlag; /* True to prompt before overwriting */
197200
int vid, prior;
198201
Blob cksum1, cksum1b, cksum2;
199
-
202
+
200203
db_must_be_within_tree();
201204
db_begin_transaction();
202205
forceFlag = find_option("force","f",0)!=0;
203206
keepFlag = find_option("keep",0,0)!=0;
204207
latestFlag = find_option("latest",0,0)!=0;
@@ -280,12 +283,14 @@
280283
** COMMAND: close
281284
**
282285
** Usage: %fossil close ?-f|--force?
283286
**
284287
** The opposite of "open". Close the current database connection.
285
-** Require a -f or --force flag if there are unsaved changed in the
288
+** Require a -f or --force flag if there are unsaved changes in the
286289
** current check-out.
290
+**
291
+** SUMMARY: fossil close ?-f|--force?
287292
*/
288293
void close_cmd(void){
289294
int forceFlag = find_option("force","f",0)!=0;
290295
db_must_be_within_tree();
291296
if( !forceFlag && unsaved_changes()==1 ){
292297
--- src/checkout.c
+++ src/checkout.c
@@ -166,11 +166,11 @@
166 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
167 unlink(zManFile);
168 free(zManFile);
169 }
170 }
171
172 }
173
174 /*
175 ** COMMAND: checkout
176 ** COMMAND: co
@@ -185,20 +185,23 @@
185 **
186 ** The --latest flag can be used in place of VERSION to checkout the
187 ** latest version in the repository.
188 **
189 ** See also the "update" command.
 
 
 
190 */
191 void checkout_cmd(void){
192 int forceFlag; /* Force checkout even if edits exist */
193 int keepFlag; /* Do not change any files on disk */
194 int latestFlag; /* Checkout the latest version */
195 char *zVers; /* Version to checkout */
196 int promptFlag; /* True to prompt before overwriting */
197 int vid, prior;
198 Blob cksum1, cksum1b, cksum2;
199
200 db_must_be_within_tree();
201 db_begin_transaction();
202 forceFlag = find_option("force","f",0)!=0;
203 keepFlag = find_option("keep",0,0)!=0;
204 latestFlag = find_option("latest",0,0)!=0;
@@ -280,12 +283,14 @@
280 ** COMMAND: close
281 **
282 ** Usage: %fossil close ?-f|--force?
283 **
284 ** The opposite of "open". Close the current database connection.
285 ** Require a -f or --force flag if there are unsaved changed in the
286 ** current check-out.
 
 
287 */
288 void close_cmd(void){
289 int forceFlag = find_option("force","f",0)!=0;
290 db_must_be_within_tree();
291 if( !forceFlag && unsaved_changes()==1 ){
292
--- src/checkout.c
+++ src/checkout.c
@@ -166,11 +166,11 @@
166 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
167 unlink(zManFile);
168 free(zManFile);
169 }
170 }
171
172 }
173
174 /*
175 ** COMMAND: checkout
176 ** COMMAND: co
@@ -185,20 +185,23 @@
185 **
186 ** The --latest flag can be used in place of VERSION to checkout the
187 ** latest version in the repository.
188 **
189 ** See also the "update" command.
190 **
191 ** SUMMARY: fossil checkout VERSION ?-f|--force? ?--keep?
192 ** Note: VERSION can also be --latest
193 */
194 void checkout_cmd(void){
195 int forceFlag; /* Force checkout even if edits exist */
196 int keepFlag; /* Do not change any files on disk */
197 int latestFlag; /* Checkout the latest version */
198 char *zVers; /* Version to checkout */
199 int promptFlag; /* True to prompt before overwriting */
200 int vid, prior;
201 Blob cksum1, cksum1b, cksum2;
202
203 db_must_be_within_tree();
204 db_begin_transaction();
205 forceFlag = find_option("force","f",0)!=0;
206 keepFlag = find_option("keep",0,0)!=0;
207 latestFlag = find_option("latest",0,0)!=0;
@@ -280,12 +283,14 @@
283 ** COMMAND: close
284 **
285 ** Usage: %fossil close ?-f|--force?
286 **
287 ** The opposite of "open". Close the current database connection.
288 ** Require a -f or --force flag if there are unsaved changes in the
289 ** current check-out.
290 **
291 ** SUMMARY: fossil close ?-f|--force?
292 */
293 void close_cmd(void){
294 int forceFlag = find_option("force","f",0)!=0;
295 db_must_be_within_tree();
296 if( !forceFlag && unsaved_changes()==1 ){
297
+3 -3
--- src/clone.c
+++ src/clone.c
@@ -27,20 +27,20 @@
2727
** COMMAND: clone
2828
**
2929
** Usage: %fossil clone ?OPTIONS? URL FILENAME
3030
**
3131
** Make a clone of a repository specified by URL in the local
32
-** file named FILENAME.
32
+** file named FILENAME.
3333
**
3434
** By default, your current login name is used to create the default
3535
** admin user. This can be overridden using the -A|--admin-user
3636
** parameter.
3737
**
38
+** SUMMARY: fossil clone ?OPTIONS? URL FILENAME
3839
** Options:
39
-**
4040
** --admin-user|-A USERNAME Make USERNAME the administrator
41
-** --private Also clone private branches
41
+** --private Also clone private branches
4242
**
4343
*/
4444
void clone_cmd(void){
4545
char *zPassword;
4646
const char *zDefaultUser; /* Optional name of the default user */
4747
--- src/clone.c
+++ src/clone.c
@@ -27,20 +27,20 @@
27 ** COMMAND: clone
28 **
29 ** Usage: %fossil clone ?OPTIONS? URL FILENAME
30 **
31 ** Make a clone of a repository specified by URL in the local
32 ** file named FILENAME.
33 **
34 ** By default, your current login name is used to create the default
35 ** admin user. This can be overridden using the -A|--admin-user
36 ** parameter.
37 **
 
38 ** Options:
39 **
40 ** --admin-user|-A USERNAME Make USERNAME the administrator
41 ** --private Also clone private branches
42 **
43 */
44 void clone_cmd(void){
45 char *zPassword;
46 const char *zDefaultUser; /* Optional name of the default user */
47
--- src/clone.c
+++ src/clone.c
@@ -27,20 +27,20 @@
27 ** COMMAND: clone
28 **
29 ** Usage: %fossil clone ?OPTIONS? URL FILENAME
30 **
31 ** Make a clone of a repository specified by URL in the local
32 ** file named FILENAME.
33 **
34 ** By default, your current login name is used to create the default
35 ** admin user. This can be overridden using the -A|--admin-user
36 ** parameter.
37 **
38 ** SUMMARY: fossil clone ?OPTIONS? URL FILENAME
39 ** Options:
 
40 ** --admin-user|-A USERNAME Make USERNAME the administrator
41 ** --private Also clone private branches
42 **
43 */
44 void clone_cmd(void){
45 char *zPassword;
46 const char *zDefaultUser; /* Optional name of the default user */
47
+28 -12
--- src/configure.c
+++ src/configure.c
@@ -57,11 +57,11 @@
5757
};
5858
5959
6060
/*
6161
** The following is a list of settings that we are willing to
62
-** transfer.
62
+** transfer.
6363
**
6464
** Setting names that begin with an alphabetic characters refer to
6565
** single entries in the CONFIG table. Setting names that begin with
6666
** "@" are for special processing.
6767
*/
@@ -147,28 +147,28 @@
147147
void configure_render_special_name(const char *zName, Blob *pOut){
148148
Stmt q;
149149
if( fossil_strcmp(zName, "@shun")==0 ){
150150
db_prepare(&q, "SELECT uuid FROM shun");
151151
while( db_step(&q)==SQLITE_ROW ){
152
- blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n",
152
+ blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n",
153153
db_column_text(&q, 0)
154154
);
155155
}
156156
db_finalize(&q);
157157
}else if( fossil_strcmp(zName, "@reportfmt")==0 ){
158158
db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt");
159159
while( db_step(&q)==SQLITE_ROW ){
160160
blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)"
161
- " VALUES(%Q,%Q,%Q);\n",
161
+ " VALUES(%Q,%Q,%Q);\n",
162162
db_column_text(&q, 0),
163163
db_column_text(&q, 1),
164164
db_column_text(&q, 2)
165165
);
166166
}
167167
db_finalize(&q);
168168
}else if( fossil_strcmp(zName, "@user")==0 ){
169
- db_prepare(&q,
169
+ db_prepare(&q,
170170
"SELECT login, CASE WHEN length(pw)==40 THEN pw END,"
171171
" cap, info, quote(photo) FROM user");
172172
while( db_step(&q)==SQLITE_ROW ){
173173
blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)"
174174
" VALUES(%Q,%Q,%Q,%Q,%s);\n",
@@ -259,11 +259,11 @@
259259
@ );
260260
@ INSERT INTO _xfer_reportfmt SELECT * FROM reportfmt;
261261
@ INSERT INTO _xfer_user SELECT * FROM user;
262262
;
263263
db_multi_exec(zSQL1);
264
-
264
+
265265
/* When the replace flag is set, add triggers that run the first time
266266
** that new data is seen. The triggers run only once and delete all the
267267
** existing data.
268268
*/
269269
if( replaceFlag ){
@@ -339,11 +339,11 @@
339339
const char *zFilename /* Write into this file */
340340
){
341341
int i;
342342
Blob out;
343343
blob_zero(&out);
344
- blob_appendf(&out,
344
+ blob_appendf(&out,
345345
"-- The \"%s\" configuration exported from\n"
346346
"-- repository \"%s\"\n"
347347
"-- on %s\n",
348348
zMask, g.zRepositoryName,
349349
db_text(0, "SELECT datetime('now')")
@@ -350,14 +350,14 @@
350350
);
351351
for(i=0; i<count(aConfig); i++){
352352
if( (aConfig[i].groupMask & mask)!=0 ){
353353
const char *zName = aConfig[i].zName;
354354
if( zName[0]!='@' ){
355
- char *zValue = db_text(0,
355
+ char *zValue = db_text(0,
356356
"SELECT quote(value) FROM config WHERE name=%Q", zName);
357357
if( zValue ){
358
- blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n",
358
+ blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n",
359359
zName, zValue);
360360
}
361361
free(zValue);
362362
}else{
363363
configure_render_special_name(zName, &out);
@@ -395,11 +395,11 @@
395395
**
396396
** %fossil configuration pull AREA ?URL?
397397
**
398398
** Pull and install the configuration from a different server
399399
** identified by URL. If no URL is specified, then the default
400
-** server is used.
400
+** server is used.
401401
**
402402
** %fossil configuration push AREA ?URL?
403403
**
404404
** Push the local configuration into the remote server identified
405405
** by URL. Admin privilege is required on the remote server for
@@ -410,10 +410,26 @@
410410
** Restore the configuration to the default. AREA as above.
411411
**
412412
** WARNING: Do not import, merge, or pull configurations from an untrusted
413413
** source. The inbound configuration is not checked for safety and can
414414
** introduce security vulnerabilities.
415
+**
416
+**
417
+** SUMMARY: fossil configure METHOD ... ?-R|--repository REPOSITORY?
418
+** Where: METHOD = export, import, merge, pull, push or reset
419
+**
420
+** For methods export, pull, push and reset:
421
+**
422
+** fossil configure METHOD AREA ?FILENAME|URL? ?-R|--repository REPOSITORY?
423
+**
424
+** AREA = all email project shun skin ticket user
425
+**
426
+** FILENAME used with methods export, URL used with the others
427
+**
428
+** For methods import and merge
429
+**
430
+** fossil configure METHOD FILENAME -R|--repository REPOSITORY?
415431
*/
416432
void configuration_cmd(void){
417433
int n;
418434
const char *zMethod;
419435
if( g.argc<3 ){
@@ -428,11 +444,11 @@
428444
usage("export AREA FILENAME");
429445
}
430446
mask = find_area(g.argv[3]);
431447
export_config(mask, g.argv[3], g.argv[4]);
432448
}else
433
- if( strncmp(zMethod, "import", n)==0
449
+ if( strncmp(zMethod, "import", n)==0
434450
|| strncmp(zMethod, "merge", n)==0 ){
435451
Blob in;
436452
if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod));
437453
blob_read_from_file(&in, g.argv[3]);
438454
db_begin_transaction();
@@ -474,11 +490,11 @@
474490
if( strncmp(zMethod, "reset", n)==0 ){
475491
int mask, i;
476492
char *zBackup;
477493
if( g.argc!=4 ) usage("reset AREA");
478494
mask = find_area(g.argv[3]);
479
- zBackup = db_text(0,
495
+ zBackup = db_text(0,
480496
"SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')");
481497
db_begin_transaction();
482498
export_config(mask, g.argv[3], zBackup);
483499
for(i=0; i<count(aConfig); i++){
484500
const char *zName = aConfig[i].zName;
@@ -496,13 +512,13 @@
496512
db_multi_exec("DELETE FROM reportfmt");
497513
}
498514
}
499515
db_end_transaction(0);
500516
printf("Configuration reset to factory defaults.\n");
501
- printf("To recover, use: %s %s import %s\n",
517
+ printf("To recover, use: %s %s import %s\n",
502518
fossil_nameofexe(), g.argv[1], zBackup);
503519
}else
504520
{
505521
fossil_fatal("METHOD should be one of:"
506522
" export import merge pull push reset");
507523
}
508524
}
509525
--- src/configure.c
+++ src/configure.c
@@ -57,11 +57,11 @@
57 };
58
59
60 /*
61 ** The following is a list of settings that we are willing to
62 ** transfer.
63 **
64 ** Setting names that begin with an alphabetic characters refer to
65 ** single entries in the CONFIG table. Setting names that begin with
66 ** "@" are for special processing.
67 */
@@ -147,28 +147,28 @@
147 void configure_render_special_name(const char *zName, Blob *pOut){
148 Stmt q;
149 if( fossil_strcmp(zName, "@shun")==0 ){
150 db_prepare(&q, "SELECT uuid FROM shun");
151 while( db_step(&q)==SQLITE_ROW ){
152 blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n",
153 db_column_text(&q, 0)
154 );
155 }
156 db_finalize(&q);
157 }else if( fossil_strcmp(zName, "@reportfmt")==0 ){
158 db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt");
159 while( db_step(&q)==SQLITE_ROW ){
160 blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)"
161 " VALUES(%Q,%Q,%Q);\n",
162 db_column_text(&q, 0),
163 db_column_text(&q, 1),
164 db_column_text(&q, 2)
165 );
166 }
167 db_finalize(&q);
168 }else if( fossil_strcmp(zName, "@user")==0 ){
169 db_prepare(&q,
170 "SELECT login, CASE WHEN length(pw)==40 THEN pw END,"
171 " cap, info, quote(photo) FROM user");
172 while( db_step(&q)==SQLITE_ROW ){
173 blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)"
174 " VALUES(%Q,%Q,%Q,%Q,%s);\n",
@@ -259,11 +259,11 @@
259 @ );
260 @ INSERT INTO _xfer_reportfmt SELECT * FROM reportfmt;
261 @ INSERT INTO _xfer_user SELECT * FROM user;
262 ;
263 db_multi_exec(zSQL1);
264
265 /* When the replace flag is set, add triggers that run the first time
266 ** that new data is seen. The triggers run only once and delete all the
267 ** existing data.
268 */
269 if( replaceFlag ){
@@ -339,11 +339,11 @@
339 const char *zFilename /* Write into this file */
340 ){
341 int i;
342 Blob out;
343 blob_zero(&out);
344 blob_appendf(&out,
345 "-- The \"%s\" configuration exported from\n"
346 "-- repository \"%s\"\n"
347 "-- on %s\n",
348 zMask, g.zRepositoryName,
349 db_text(0, "SELECT datetime('now')")
@@ -350,14 +350,14 @@
350 );
351 for(i=0; i<count(aConfig); i++){
352 if( (aConfig[i].groupMask & mask)!=0 ){
353 const char *zName = aConfig[i].zName;
354 if( zName[0]!='@' ){
355 char *zValue = db_text(0,
356 "SELECT quote(value) FROM config WHERE name=%Q", zName);
357 if( zValue ){
358 blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n",
359 zName, zValue);
360 }
361 free(zValue);
362 }else{
363 configure_render_special_name(zName, &out);
@@ -395,11 +395,11 @@
395 **
396 ** %fossil configuration pull AREA ?URL?
397 **
398 ** Pull and install the configuration from a different server
399 ** identified by URL. If no URL is specified, then the default
400 ** server is used.
401 **
402 ** %fossil configuration push AREA ?URL?
403 **
404 ** Push the local configuration into the remote server identified
405 ** by URL. Admin privilege is required on the remote server for
@@ -410,10 +410,26 @@
410 ** Restore the configuration to the default. AREA as above.
411 **
412 ** WARNING: Do not import, merge, or pull configurations from an untrusted
413 ** source. The inbound configuration is not checked for safety and can
414 ** introduce security vulnerabilities.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415 */
416 void configuration_cmd(void){
417 int n;
418 const char *zMethod;
419 if( g.argc<3 ){
@@ -428,11 +444,11 @@
428 usage("export AREA FILENAME");
429 }
430 mask = find_area(g.argv[3]);
431 export_config(mask, g.argv[3], g.argv[4]);
432 }else
433 if( strncmp(zMethod, "import", n)==0
434 || strncmp(zMethod, "merge", n)==0 ){
435 Blob in;
436 if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod));
437 blob_read_from_file(&in, g.argv[3]);
438 db_begin_transaction();
@@ -474,11 +490,11 @@
474 if( strncmp(zMethod, "reset", n)==0 ){
475 int mask, i;
476 char *zBackup;
477 if( g.argc!=4 ) usage("reset AREA");
478 mask = find_area(g.argv[3]);
479 zBackup = db_text(0,
480 "SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')");
481 db_begin_transaction();
482 export_config(mask, g.argv[3], zBackup);
483 for(i=0; i<count(aConfig); i++){
484 const char *zName = aConfig[i].zName;
@@ -496,13 +512,13 @@
496 db_multi_exec("DELETE FROM reportfmt");
497 }
498 }
499 db_end_transaction(0);
500 printf("Configuration reset to factory defaults.\n");
501 printf("To recover, use: %s %s import %s\n",
502 fossil_nameofexe(), g.argv[1], zBackup);
503 }else
504 {
505 fossil_fatal("METHOD should be one of:"
506 " export import merge pull push reset");
507 }
508 }
509
--- src/configure.c
+++ src/configure.c
@@ -57,11 +57,11 @@
57 };
58
59
60 /*
61 ** The following is a list of settings that we are willing to
62 ** transfer.
63 **
64 ** Setting names that begin with an alphabetic characters refer to
65 ** single entries in the CONFIG table. Setting names that begin with
66 ** "@" are for special processing.
67 */
@@ -147,28 +147,28 @@
147 void configure_render_special_name(const char *zName, Blob *pOut){
148 Stmt q;
149 if( fossil_strcmp(zName, "@shun")==0 ){
150 db_prepare(&q, "SELECT uuid FROM shun");
151 while( db_step(&q)==SQLITE_ROW ){
152 blob_appendf(pOut, "INSERT OR IGNORE INTO shun VALUES('%s');\n",
153 db_column_text(&q, 0)
154 );
155 }
156 db_finalize(&q);
157 }else if( fossil_strcmp(zName, "@reportfmt")==0 ){
158 db_prepare(&q, "SELECT title, cols, sqlcode FROM reportfmt");
159 while( db_step(&q)==SQLITE_ROW ){
160 blob_appendf(pOut, "INSERT INTO _xfer_reportfmt(title,cols,sqlcode)"
161 " VALUES(%Q,%Q,%Q);\n",
162 db_column_text(&q, 0),
163 db_column_text(&q, 1),
164 db_column_text(&q, 2)
165 );
166 }
167 db_finalize(&q);
168 }else if( fossil_strcmp(zName, "@user")==0 ){
169 db_prepare(&q,
170 "SELECT login, CASE WHEN length(pw)==40 THEN pw END,"
171 " cap, info, quote(photo) FROM user");
172 while( db_step(&q)==SQLITE_ROW ){
173 blob_appendf(pOut, "INSERT INTO _xfer_user(login,pw,cap,info,photo)"
174 " VALUES(%Q,%Q,%Q,%Q,%s);\n",
@@ -259,11 +259,11 @@
259 @ );
260 @ INSERT INTO _xfer_reportfmt SELECT * FROM reportfmt;
261 @ INSERT INTO _xfer_user SELECT * FROM user;
262 ;
263 db_multi_exec(zSQL1);
264
265 /* When the replace flag is set, add triggers that run the first time
266 ** that new data is seen. The triggers run only once and delete all the
267 ** existing data.
268 */
269 if( replaceFlag ){
@@ -339,11 +339,11 @@
339 const char *zFilename /* Write into this file */
340 ){
341 int i;
342 Blob out;
343 blob_zero(&out);
344 blob_appendf(&out,
345 "-- The \"%s\" configuration exported from\n"
346 "-- repository \"%s\"\n"
347 "-- on %s\n",
348 zMask, g.zRepositoryName,
349 db_text(0, "SELECT datetime('now')")
@@ -350,14 +350,14 @@
350 );
351 for(i=0; i<count(aConfig); i++){
352 if( (aConfig[i].groupMask & mask)!=0 ){
353 const char *zName = aConfig[i].zName;
354 if( zName[0]!='@' ){
355 char *zValue = db_text(0,
356 "SELECT quote(value) FROM config WHERE name=%Q", zName);
357 if( zValue ){
358 blob_appendf(&out,"REPLACE INTO config VALUES(%Q,%s);\n",
359 zName, zValue);
360 }
361 free(zValue);
362 }else{
363 configure_render_special_name(zName, &out);
@@ -395,11 +395,11 @@
395 **
396 ** %fossil configuration pull AREA ?URL?
397 **
398 ** Pull and install the configuration from a different server
399 ** identified by URL. If no URL is specified, then the default
400 ** server is used.
401 **
402 ** %fossil configuration push AREA ?URL?
403 **
404 ** Push the local configuration into the remote server identified
405 ** by URL. Admin privilege is required on the remote server for
@@ -410,10 +410,26 @@
410 ** Restore the configuration to the default. AREA as above.
411 **
412 ** WARNING: Do not import, merge, or pull configurations from an untrusted
413 ** source. The inbound configuration is not checked for safety and can
414 ** introduce security vulnerabilities.
415 **
416 **
417 ** SUMMARY: fossil configure METHOD ... ?-R|--repository REPOSITORY?
418 ** Where: METHOD = export, import, merge, pull, push or reset
419 **
420 ** For methods export, pull, push and reset:
421 **
422 ** fossil configure METHOD AREA ?FILENAME|URL? ?-R|--repository REPOSITORY?
423 **
424 ** AREA = all email project shun skin ticket user
425 **
426 ** FILENAME used with methods export, URL used with the others
427 **
428 ** For methods import and merge
429 **
430 ** fossil configure METHOD FILENAME -R|--repository REPOSITORY?
431 */
432 void configuration_cmd(void){
433 int n;
434 const char *zMethod;
435 if( g.argc<3 ){
@@ -428,11 +444,11 @@
444 usage("export AREA FILENAME");
445 }
446 mask = find_area(g.argv[3]);
447 export_config(mask, g.argv[3], g.argv[4]);
448 }else
449 if( strncmp(zMethod, "import", n)==0
450 || strncmp(zMethod, "merge", n)==0 ){
451 Blob in;
452 if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod));
453 blob_read_from_file(&in, g.argv[3]);
454 db_begin_transaction();
@@ -474,11 +490,11 @@
490 if( strncmp(zMethod, "reset", n)==0 ){
491 int mask, i;
492 char *zBackup;
493 if( g.argc!=4 ) usage("reset AREA");
494 mask = find_area(g.argv[3]);
495 zBackup = db_text(0,
496 "SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')");
497 db_begin_transaction();
498 export_config(mask, g.argv[3], zBackup);
499 for(i=0; i<count(aConfig); i++){
500 const char *zName = aConfig[i].zName;
@@ -496,13 +512,13 @@
512 db_multi_exec("DELETE FROM reportfmt");
513 }
514 }
515 db_end_transaction(0);
516 printf("Configuration reset to factory defaults.\n");
517 printf("To recover, use: %s %s import %s\n",
518 fossil_nameofexe(), g.argv[1], zBackup);
519 }else
520 {
521 fossil_fatal("METHOD should be one of:"
522 " export import merge pull push reset");
523 }
524 }
525

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button