Overview
SHA1 Hash: | 4e683ef07b04f5f27ab860c8737fb8b92975ac54 |
---|---|
Date: | 2008-05-05 17:24:38 |
User: | drh |
Comment: | Add the ability to modify global settings (such as the proxy setting) even when there are no repositories defined. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/branch.c from [c6483e4ed6] to [dcb06f995d].
@@ -176,11 +176,11 @@ ** List all branches ** */ void branch_cmd(void){ int n; - db_find_and_open_repository(); + db_find_and_open_repository(1); if( g.argc<3 ){ usage("new|list ..."); } n = strlen(g.argv[2]); if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){
Modified src/construct.c from [e55d0051c5] to [a5be93c8e9].
@@ -88,11 +88,11 @@ Blob zOut; Stmt q; if( (g.argc != 3) && (g.argc != 5) ){ usage ("?-R|--repository REPOSITORY? DESTINATION"); } - db_find_and_open_repository (); + db_find_and_open_repository(1); zDestination = g.argv[g.argc-1]; if( !file_isdir (zDestination) ){ fossil_panic("not a directory: %s", zDestination); } /* Iterate over all blobs in the repository, retrieve their
Modified src/db.c from [79e9e0ceda] to [2d2f919945].
@@ -672,11 +672,11 @@ ** option to locate the repository. If no such option is available, then ** use the repository of the open checkout if there is one. ** ** Error out if the repository cannot be opened. */ -void db_find_and_open_repository(void){ +void db_find_and_open_repository(int errIfNotFound){ const char *zRep = find_option("repository", "R", 1); if( zRep==0 ){ if( db_open_local()==0 ){ goto rep_not_found; } @@ -688,11 +688,13 @@ db_open_repository(zRep); if( g.repositoryOpen ){ return; } rep_not_found: - fossil_fatal("use --repository or -R to specific the repository database"); + if( errIfNotFound ){ + fossil_fatal("use --repository or -R to specific the repository database"); + } } /* ** Open the local database. If unable, exit with an error. */ @@ -1036,16 +1038,23 @@ /* ** 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( g.repositoryOpen ){ + db_prepare(&q, + "SELECT '(local)', value FROM config WHERE name=%Q" + " UNION ALL " + "SELECT '(global)', value FROM global_config WHERE name=%Q", + zName, zName + ); + }else{ + db_prepare(&q, + "SELECT '(global)', value FROM global_config WHERE name=%Q", + 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); @@ -1098,11 +1107,15 @@ "diff-command", "gdiff-command", }; int i; int globalFlag = find_option("global","g",0)!=0; - db_find_and_open_repository(); + db_find_and_open_repository(0); + if( !g.repositoryOpen ){ + db_open_config(); + globalFlag = 1; + } 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 ){
Modified src/sync.c from [b1aa8a41a0] to [8dd56b0a12].
@@ -71,11 +71,11 @@ ** of a server to sync against. If no argument is given, use the ** most recently synced URL. Remember the current URL for next time. */ static void process_sync_args(void){ const char *zUrl = 0; - db_find_and_open_repository(); + db_find_and_open_repository(1); if( g.argc==2 ){ zUrl = db_get("last-sync-url", 0); }else if( g.argc==3 ){ zUrl = g.argv[2]; }
Modified src/tag.c from [002d575145] to [29b50a2f4d].
@@ -329,11 +329,11 @@ ** List all tags, or if UUID is supplied, list ** all tags and their values for UUID. */ void tag_cmd(void){ int n; - db_find_and_open_repository(); + db_find_and_open_repository(1); if( g.argc<3 ){ goto tag_cmd_usage; } n = strlen(g.argv[2]); if( n==0 ){
Modified src/th.c from [a687d76a2d] to [7781ea6ed2].
@@ -2669,6 +2669,5 @@ error_out: Th_ErrorMessage(interp, "expected pointer, got: \"", z, n); return TH_ERROR; } -
Modified src/timeline.c from [dea6e9f6b0] to [b5fdec786b].
@@ -588,11 +588,11 @@ char *zDate; char *zSQL; int objid = 0; Blob uuid; int mode = 1 ; /* 1: before 2:after 3:children 4:parents */ - db_find_and_open_repository(); + db_find_and_open_repository(1); zCount = find_option("n","count",1); if( zCount ){ n = atoi(zCount); }else{ n = 20;
Modified src/user.c from [5fc6aec086] to [1f03854c87].
@@ -177,11 +177,11 @@ ** ** Change the web access password for a user. */ void user_cmd(void){ int n; - db_find_and_open_repository(); + db_find_and_open_repository(1); if( g.argc<3 ){ usage("capabilities|default|list|new|password ..."); } n = strlen(g.argv[2]); if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){