Fossil SCM
Report an error if the repository schema version does not match what the fossil executable expects.
Commit
c0c3d92340da4aa70b0853707e88490d1a4798ae
Parent
6c7332141811955…
16 files changed
+2
-2
+1
-1
+1
-1
+32
-4
+1
-1
+1
-1
+10
-5
+1
-1
+3
-1
+2
-2
+1
-1
+1
-1
+1
-1
+1
-1
+1
-1
+1
-1
+2
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -48,11 +48,11 @@ | ||
| 48 | 48 | zUserOvrd = find_option("user-override",0,1); |
| 49 | 49 | verify_all_options(); |
| 50 | 50 | if( g.argc<5 ){ |
| 51 | 51 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| 52 | 52 | } |
| 53 | - db_find_and_open_repository(1); | |
| 53 | + db_find_and_open_repository(0, 0); | |
| 54 | 54 | noSign = db_get_int("omitsign", 0)|noSign; |
| 55 | 55 | |
| 56 | 56 | /* fossil branch new name */ |
| 57 | 57 | zBranch = g.argv[3]; |
| 58 | 58 | if( zBranch==0 || zBranch[0]==0 ){ |
| @@ -188,11 +188,11 @@ | ||
| 188 | 188 | ** |
| 189 | 189 | */ |
| 190 | 190 | void branch_cmd(void){ |
| 191 | 191 | int n; |
| 192 | 192 | const char *zCmd = "list"; |
| 193 | - db_find_and_open_repository(1); | |
| 193 | + db_find_and_open_repository(0, 0); | |
| 194 | 194 | if( g.argc<2 ){ |
| 195 | 195 | usage("new|list ..."); |
| 196 | 196 | } |
| 197 | 197 | if( g.argc>=3 ) zCmd = g.argv[2]; |
| 198 | 198 | n = strlen(zCmd); |
| 199 | 199 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -48,11 +48,11 @@ | |
| 48 | zUserOvrd = find_option("user-override",0,1); |
| 49 | verify_all_options(); |
| 50 | if( g.argc<5 ){ |
| 51 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| 52 | } |
| 53 | db_find_and_open_repository(1); |
| 54 | noSign = db_get_int("omitsign", 0)|noSign; |
| 55 | |
| 56 | /* fossil branch new name */ |
| 57 | zBranch = g.argv[3]; |
| 58 | if( zBranch==0 || zBranch[0]==0 ){ |
| @@ -188,11 +188,11 @@ | |
| 188 | ** |
| 189 | */ |
| 190 | void branch_cmd(void){ |
| 191 | int n; |
| 192 | const char *zCmd = "list"; |
| 193 | db_find_and_open_repository(1); |
| 194 | if( g.argc<2 ){ |
| 195 | usage("new|list ..."); |
| 196 | } |
| 197 | if( g.argc>=3 ) zCmd = g.argv[2]; |
| 198 | n = strlen(zCmd); |
| 199 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -48,11 +48,11 @@ | |
| 48 | zUserOvrd = find_option("user-override",0,1); |
| 49 | verify_all_options(); |
| 50 | if( g.argc<5 ){ |
| 51 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| 52 | } |
| 53 | db_find_and_open_repository(0, 0); |
| 54 | noSign = db_get_int("omitsign", 0)|noSign; |
| 55 | |
| 56 | /* fossil branch new name */ |
| 57 | zBranch = g.argv[3]; |
| 58 | if( zBranch==0 || zBranch[0]==0 ){ |
| @@ -188,11 +188,11 @@ | |
| 188 | ** |
| 189 | */ |
| 190 | void branch_cmd(void){ |
| 191 | int n; |
| 192 | const char *zCmd = "list"; |
| 193 | db_find_and_open_repository(0, 0); |
| 194 | if( g.argc<2 ){ |
| 195 | usage("new|list ..."); |
| 196 | } |
| 197 | if( g.argc>=3 ) zCmd = g.argv[2]; |
| 198 | n = strlen(zCmd); |
| 199 |
+1
-1
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -415,11 +415,11 @@ | ||
| 415 | 415 | int n; |
| 416 | 416 | const char *zMethod; |
| 417 | 417 | if( g.argc<3 ){ |
| 418 | 418 | usage("export|import|merge|pull|reset ..."); |
| 419 | 419 | } |
| 420 | - db_find_and_open_repository(1); | |
| 420 | + db_find_and_open_repository(0, 0); | |
| 421 | 421 | zMethod = g.argv[2]; |
| 422 | 422 | n = strlen(zMethod); |
| 423 | 423 | if( strncmp(zMethod, "export", n)==0 ){ |
| 424 | 424 | int mask; |
| 425 | 425 | if( g.argc!=5 ){ |
| 426 | 426 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -415,11 +415,11 @@ | |
| 415 | int n; |
| 416 | const char *zMethod; |
| 417 | if( g.argc<3 ){ |
| 418 | usage("export|import|merge|pull|reset ..."); |
| 419 | } |
| 420 | db_find_and_open_repository(1); |
| 421 | zMethod = g.argv[2]; |
| 422 | n = strlen(zMethod); |
| 423 | if( strncmp(zMethod, "export", n)==0 ){ |
| 424 | int mask; |
| 425 | if( g.argc!=5 ){ |
| 426 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -415,11 +415,11 @@ | |
| 415 | int n; |
| 416 | const char *zMethod; |
| 417 | if( g.argc<3 ){ |
| 418 | usage("export|import|merge|pull|reset ..."); |
| 419 | } |
| 420 | db_find_and_open_repository(0, 0); |
| 421 | zMethod = g.argv[2]; |
| 422 | n = strlen(zMethod); |
| 423 | if( strncmp(zMethod, "export", n)==0 ){ |
| 424 | int mask; |
| 425 | if( g.argc!=5 ){ |
| 426 |
+1
-1
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -297,11 +297,11 @@ | ||
| 297 | 297 | */ |
| 298 | 298 | void artifact_cmd(void){ |
| 299 | 299 | int rid; |
| 300 | 300 | Blob content; |
| 301 | 301 | const char *zFile; |
| 302 | - db_find_and_open_repository(1); | |
| 302 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 303 | 303 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 304 | 304 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 305 | 305 | rid = name_to_rid(g.argv[2]); |
| 306 | 306 | content_get(rid, &content); |
| 307 | 307 | blob_write_to_file(&content, zFile); |
| 308 | 308 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -297,11 +297,11 @@ | |
| 297 | */ |
| 298 | void artifact_cmd(void){ |
| 299 | int rid; |
| 300 | Blob content; |
| 301 | const char *zFile; |
| 302 | db_find_and_open_repository(1); |
| 303 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 304 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 305 | rid = name_to_rid(g.argv[2]); |
| 306 | content_get(rid, &content); |
| 307 | blob_write_to_file(&content, zFile); |
| 308 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -297,11 +297,11 @@ | |
| 297 | */ |
| 298 | void artifact_cmd(void){ |
| 299 | int rid; |
| 300 | Blob content; |
| 301 | const char *zFile; |
| 302 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 303 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 304 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 305 | rid = name_to_rid(g.argv[2]); |
| 306 | content_get(rid, &content); |
| 307 | blob_write_to_file(&content, zFile); |
| 308 |
M
src/db.c
+32
-4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -612,11 +612,11 @@ | ||
| 612 | 612 | /* |
| 613 | 613 | ** zDbName is the name of a database file. If no other database |
| 614 | 614 | ** file is open, then open this one. If another database file is |
| 615 | 615 | ** already open, then attach zDbName using the name zLabel. |
| 616 | 616 | */ |
| 617 | -void db_open_or_attach(const char *zDbName, const char *zLabel){ | |
| 617 | +static void db_open_or_attach(const char *zDbName, const char *zLabel){ | |
| 618 | 618 | if( !g.db ){ |
| 619 | 619 | g.db = openDatabase(zDbName); |
| 620 | 620 | g.zRepoDb = "main"; |
| 621 | 621 | db_connection_init(); |
| 622 | 622 | }else{ |
| @@ -826,19 +826,30 @@ | ||
| 826 | 826 | db_open_or_attach(zDbName, "repository"); |
| 827 | 827 | g.repositoryOpen = 1; |
| 828 | 828 | g.zRepositoryName = mprintf("%s", zDbName); |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | +/* | |
| 832 | +** Flags for the db_find_and_open_repository() function. | |
| 833 | +*/ | |
| 834 | +#if INTERFACE | |
| 835 | +#define OPEN_OK_NOT_FOUND 0x001 /* Do not error out if not found */ | |
| 836 | +#define OPEN_ANY_SCHEMA 0x002 /* Do not error if schema is wrong */ | |
| 837 | +#endif | |
| 838 | + | |
| 831 | 839 | /* |
| 832 | 840 | ** Try to find the repository and open it. Use the -R or --repository |
| 833 | 841 | ** option to locate the repository. If no such option is available, then |
| 834 | 842 | ** use the repository of the open checkout if there is one. |
| 835 | 843 | ** |
| 836 | 844 | ** Error out if the repository cannot be opened. |
| 837 | 845 | */ |
| 838 | -void db_find_and_open_repository(int errIfNotFound){ | |
| 846 | +void db_find_and_open_repository(int bFlags, const char *zRepoFilename){ | |
| 839 | 847 | const char *zRep = find_option("repository", "R", 1); |
| 848 | + if( zRep==0 ){ | |
| 849 | + zRep = zRepoFilename; | |
| 850 | + } | |
| 840 | 851 | if( zRep==0 ){ |
| 841 | 852 | if( db_open_local()==0 ){ |
| 842 | 853 | goto rep_not_found; |
| 843 | 854 | } |
| 844 | 855 | zRep = db_lget("repository", 0); |
| @@ -846,17 +857,33 @@ | ||
| 846 | 857 | goto rep_not_found; |
| 847 | 858 | } |
| 848 | 859 | } |
| 849 | 860 | db_open_repository(zRep); |
| 850 | 861 | if( g.repositoryOpen ){ |
| 862 | + if( (bFlags & OPEN_ANY_SCHEMA)==0 ) db_verify_schema(); | |
| 851 | 863 | return; |
| 852 | 864 | } |
| 853 | 865 | rep_not_found: |
| 854 | - if( errIfNotFound ){ | |
| 866 | + if( (bFlags & OPEN_OK_NOT_FOUND)==0 ){ | |
| 855 | 867 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 856 | 868 | } |
| 857 | 869 | } |
| 870 | + | |
| 871 | +/* | |
| 872 | +** Verify that the repository schema is correct. If it is not correct, | |
| 873 | +** issue a fatal error and die. | |
| 874 | +*/ | |
| 875 | +void db_verify_schema(void){ | |
| 876 | + if( db_exists("SELECT 1 FROM config" | |
| 877 | + " WHERE name='aux-schema'" | |
| 878 | + " AND value<>'%s'", AUX_SCHEMA) ){ | |
| 879 | + fossil_warning("incorrect repository schema version"); | |
| 880 | + fossil_warning("you have version \"%s\" but you need version \"%s\"", | |
| 881 | + db_get("aux-schema",0), AUX_SCHEMA); | |
| 882 | + fossil_fatal("run \"fossil rebuild\" to fix this problem"); | |
| 883 | + } | |
| 884 | +} | |
| 858 | 885 | |
| 859 | 886 | /* |
| 860 | 887 | ** COMMAND: test-move-repository |
| 861 | 888 | ** |
| 862 | 889 | ** Usage: %fossil test-move-repository PATHNAME |
| @@ -892,10 +919,11 @@ | ||
| 892 | 919 | void db_must_be_within_tree(void){ |
| 893 | 920 | if( db_open_local()==0 ){ |
| 894 | 921 | fossil_fatal("not within an open checkout"); |
| 895 | 922 | } |
| 896 | 923 | db_open_repository(0); |
| 924 | + db_verify_schema(); | |
| 897 | 925 | } |
| 898 | 926 | |
| 899 | 927 | /* |
| 900 | 928 | ** Close the database connection. |
| 901 | 929 | */ |
| @@ -1625,11 +1653,11 @@ | ||
| 1625 | 1653 | void setting_cmd(void){ |
| 1626 | 1654 | int i; |
| 1627 | 1655 | int globalFlag = find_option("global","g",0)!=0; |
| 1628 | 1656 | int unsetFlag = g.argv[1][0]=='u'; |
| 1629 | 1657 | db_open_config(1); |
| 1630 | - db_find_and_open_repository(0); | |
| 1658 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 1631 | 1659 | if( !g.repositoryOpen ){ |
| 1632 | 1660 | globalFlag = 1; |
| 1633 | 1661 | } |
| 1634 | 1662 | if( unsetFlag && g.argc!=3 ){ |
| 1635 | 1663 | usage("PROPERTY ?-global?"); |
| 1636 | 1664 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -612,11 +612,11 @@ | |
| 612 | /* |
| 613 | ** zDbName is the name of a database file. If no other database |
| 614 | ** file is open, then open this one. If another database file is |
| 615 | ** already open, then attach zDbName using the name zLabel. |
| 616 | */ |
| 617 | void db_open_or_attach(const char *zDbName, const char *zLabel){ |
| 618 | if( !g.db ){ |
| 619 | g.db = openDatabase(zDbName); |
| 620 | g.zRepoDb = "main"; |
| 621 | db_connection_init(); |
| 622 | }else{ |
| @@ -826,19 +826,30 @@ | |
| 826 | db_open_or_attach(zDbName, "repository"); |
| 827 | g.repositoryOpen = 1; |
| 828 | g.zRepositoryName = mprintf("%s", zDbName); |
| 829 | } |
| 830 | |
| 831 | /* |
| 832 | ** Try to find the repository and open it. Use the -R or --repository |
| 833 | ** option to locate the repository. If no such option is available, then |
| 834 | ** use the repository of the open checkout if there is one. |
| 835 | ** |
| 836 | ** Error out if the repository cannot be opened. |
| 837 | */ |
| 838 | void db_find_and_open_repository(int errIfNotFound){ |
| 839 | const char *zRep = find_option("repository", "R", 1); |
| 840 | if( zRep==0 ){ |
| 841 | if( db_open_local()==0 ){ |
| 842 | goto rep_not_found; |
| 843 | } |
| 844 | zRep = db_lget("repository", 0); |
| @@ -846,17 +857,33 @@ | |
| 846 | goto rep_not_found; |
| 847 | } |
| 848 | } |
| 849 | db_open_repository(zRep); |
| 850 | if( g.repositoryOpen ){ |
| 851 | return; |
| 852 | } |
| 853 | rep_not_found: |
| 854 | if( errIfNotFound ){ |
| 855 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | /* |
| 860 | ** COMMAND: test-move-repository |
| 861 | ** |
| 862 | ** Usage: %fossil test-move-repository PATHNAME |
| @@ -892,10 +919,11 @@ | |
| 892 | void db_must_be_within_tree(void){ |
| 893 | if( db_open_local()==0 ){ |
| 894 | fossil_fatal("not within an open checkout"); |
| 895 | } |
| 896 | db_open_repository(0); |
| 897 | } |
| 898 | |
| 899 | /* |
| 900 | ** Close the database connection. |
| 901 | */ |
| @@ -1625,11 +1653,11 @@ | |
| 1625 | void setting_cmd(void){ |
| 1626 | int i; |
| 1627 | int globalFlag = find_option("global","g",0)!=0; |
| 1628 | int unsetFlag = g.argv[1][0]=='u'; |
| 1629 | db_open_config(1); |
| 1630 | db_find_and_open_repository(0); |
| 1631 | if( !g.repositoryOpen ){ |
| 1632 | globalFlag = 1; |
| 1633 | } |
| 1634 | if( unsetFlag && g.argc!=3 ){ |
| 1635 | usage("PROPERTY ?-global?"); |
| 1636 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -612,11 +612,11 @@ | |
| 612 | /* |
| 613 | ** zDbName is the name of a database file. If no other database |
| 614 | ** file is open, then open this one. If another database file is |
| 615 | ** already open, then attach zDbName using the name zLabel. |
| 616 | */ |
| 617 | static void db_open_or_attach(const char *zDbName, const char *zLabel){ |
| 618 | if( !g.db ){ |
| 619 | g.db = openDatabase(zDbName); |
| 620 | g.zRepoDb = "main"; |
| 621 | db_connection_init(); |
| 622 | }else{ |
| @@ -826,19 +826,30 @@ | |
| 826 | db_open_or_attach(zDbName, "repository"); |
| 827 | g.repositoryOpen = 1; |
| 828 | g.zRepositoryName = mprintf("%s", zDbName); |
| 829 | } |
| 830 | |
| 831 | /* |
| 832 | ** Flags for the db_find_and_open_repository() function. |
| 833 | */ |
| 834 | #if INTERFACE |
| 835 | #define OPEN_OK_NOT_FOUND 0x001 /* Do not error out if not found */ |
| 836 | #define OPEN_ANY_SCHEMA 0x002 /* Do not error if schema is wrong */ |
| 837 | #endif |
| 838 | |
| 839 | /* |
| 840 | ** Try to find the repository and open it. Use the -R or --repository |
| 841 | ** option to locate the repository. If no such option is available, then |
| 842 | ** use the repository of the open checkout if there is one. |
| 843 | ** |
| 844 | ** Error out if the repository cannot be opened. |
| 845 | */ |
| 846 | void db_find_and_open_repository(int bFlags, const char *zRepoFilename){ |
| 847 | const char *zRep = find_option("repository", "R", 1); |
| 848 | if( zRep==0 ){ |
| 849 | zRep = zRepoFilename; |
| 850 | } |
| 851 | if( zRep==0 ){ |
| 852 | if( db_open_local()==0 ){ |
| 853 | goto rep_not_found; |
| 854 | } |
| 855 | zRep = db_lget("repository", 0); |
| @@ -846,17 +857,33 @@ | |
| 857 | goto rep_not_found; |
| 858 | } |
| 859 | } |
| 860 | db_open_repository(zRep); |
| 861 | if( g.repositoryOpen ){ |
| 862 | if( (bFlags & OPEN_ANY_SCHEMA)==0 ) db_verify_schema(); |
| 863 | return; |
| 864 | } |
| 865 | rep_not_found: |
| 866 | if( (bFlags & OPEN_OK_NOT_FOUND)==0 ){ |
| 867 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | /* |
| 872 | ** Verify that the repository schema is correct. If it is not correct, |
| 873 | ** issue a fatal error and die. |
| 874 | */ |
| 875 | void db_verify_schema(void){ |
| 876 | if( db_exists("SELECT 1 FROM config" |
| 877 | " WHERE name='aux-schema'" |
| 878 | " AND value<>'%s'", AUX_SCHEMA) ){ |
| 879 | fossil_warning("incorrect repository schema version"); |
| 880 | fossil_warning("you have version \"%s\" but you need version \"%s\"", |
| 881 | db_get("aux-schema",0), AUX_SCHEMA); |
| 882 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | /* |
| 887 | ** COMMAND: test-move-repository |
| 888 | ** |
| 889 | ** Usage: %fossil test-move-repository PATHNAME |
| @@ -892,10 +919,11 @@ | |
| 919 | void db_must_be_within_tree(void){ |
| 920 | if( db_open_local()==0 ){ |
| 921 | fossil_fatal("not within an open checkout"); |
| 922 | } |
| 923 | db_open_repository(0); |
| 924 | db_verify_schema(); |
| 925 | } |
| 926 | |
| 927 | /* |
| 928 | ** Close the database connection. |
| 929 | */ |
| @@ -1625,11 +1653,11 @@ | |
| 1653 | void setting_cmd(void){ |
| 1654 | int i; |
| 1655 | int globalFlag = find_option("global","g",0)!=0; |
| 1656 | int unsetFlag = g.argv[1][0]=='u'; |
| 1657 | db_open_config(1); |
| 1658 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 1659 | if( !g.repositoryOpen ){ |
| 1660 | globalFlag = 1; |
| 1661 | } |
| 1662 | if( unsetFlag && g.argc!=3 ){ |
| 1663 | usage("PROPERTY ?-global?"); |
| 1664 |
+1
-1
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -442,11 +442,11 @@ | ||
| 442 | 442 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 443 | 443 | } |
| 444 | 444 | }else if( zFrom==0 ){ |
| 445 | 445 | fossil_fatal("must use --from if --to is present"); |
| 446 | 446 | }else{ |
| 447 | - db_find_and_open_repository(1); | |
| 447 | + db_find_and_open_repository(0, 0); | |
| 448 | 448 | verify_all_options(); |
| 449 | 449 | if( !isInternDiff ){ |
| 450 | 450 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 451 | 451 | } |
| 452 | 452 | if( g.argc==3 ){ |
| 453 | 453 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -442,11 +442,11 @@ | |
| 442 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 443 | } |
| 444 | }else if( zFrom==0 ){ |
| 445 | fossil_fatal("must use --from if --to is present"); |
| 446 | }else{ |
| 447 | db_find_and_open_repository(1); |
| 448 | verify_all_options(); |
| 449 | if( !isInternDiff ){ |
| 450 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 451 | } |
| 452 | if( g.argc==3 ){ |
| 453 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -442,11 +442,11 @@ | |
| 442 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 443 | } |
| 444 | }else if( zFrom==0 ){ |
| 445 | fossil_fatal("must use --from if --to is present"); |
| 446 | }else{ |
| 447 | db_find_and_open_repository(0, 0); |
| 448 | verify_all_options(); |
| 449 | if( !isInternDiff ){ |
| 450 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 451 | } |
| 452 | if( g.argc==3 ){ |
| 453 |
+1
-1
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -100,11 +100,11 @@ | ||
| 100 | 100 | int i; |
| 101 | 101 | Bag blobs, vers; |
| 102 | 102 | bag_init(&blobs); |
| 103 | 103 | bag_init(&vers); |
| 104 | 104 | |
| 105 | - db_find_and_open_repository(1); | |
| 105 | + db_find_and_open_repository(0, 0); | |
| 106 | 106 | |
| 107 | 107 | /* Step 1: Generate "blob" records for every artifact that is part |
| 108 | 108 | ** of a check-in |
| 109 | 109 | */ |
| 110 | 110 | fossil_binary_mode(stdout); |
| 111 | 111 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | int i; |
| 101 | Bag blobs, vers; |
| 102 | bag_init(&blobs); |
| 103 | bag_init(&vers); |
| 104 | |
| 105 | db_find_and_open_repository(1); |
| 106 | |
| 107 | /* Step 1: Generate "blob" records for every artifact that is part |
| 108 | ** of a check-in |
| 109 | */ |
| 110 | fossil_binary_mode(stdout); |
| 111 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | int i; |
| 101 | Bag blobs, vers; |
| 102 | bag_init(&blobs); |
| 103 | bag_init(&vers); |
| 104 | |
| 105 | db_find_and_open_repository(0, 0); |
| 106 | |
| 107 | /* Step 1: Generate "blob" records for every artifact that is part |
| 108 | ** of a check-in |
| 109 | */ |
| 110 | fossil_binary_mode(stdout); |
| 111 |
+10
-5
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -360,20 +360,25 @@ | ||
| 360 | 360 | forceFlag = find_option("force","f",0)!=0; |
| 361 | 361 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 362 | 362 | if( g.argc==3 ){ |
| 363 | 363 | db_open_repository(g.argv[2]); |
| 364 | 364 | }else{ |
| 365 | - db_find_and_open_repository(1); | |
| 365 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 366 | 366 | if( g.argc!=2 ){ |
| 367 | 367 | usage("?REPOSITORY-FILENAME?"); |
| 368 | 368 | } |
| 369 | 369 | db_close(); |
| 370 | 370 | db_open_repository(g.zRepositoryName); |
| 371 | 371 | } |
| 372 | 372 | db_begin_transaction(); |
| 373 | 373 | ttyOutput = 1; |
| 374 | 374 | errCnt = rebuild_db(randomizeFlag, 1); |
| 375 | + db_multi_exec( | |
| 376 | + "REPLACE INTO config(name,value) VALUES('content-schema','%s');" | |
| 377 | + "REPLACE INTO config(name,value) VALUES('aux-schema','%s');", | |
| 378 | + CONTENT_SCHEMA, AUX_SCHEMA | |
| 379 | + ); | |
| 375 | 380 | if( errCnt && !forceFlag ){ |
| 376 | 381 | printf("%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 377 | 382 | errCnt); |
| 378 | 383 | db_end_transaction(1); |
| 379 | 384 | }else{ |
| @@ -381,19 +386,19 @@ | ||
| 381 | 386 | db_end_transaction(0); |
| 382 | 387 | } |
| 383 | 388 | } |
| 384 | 389 | |
| 385 | 390 | /* |
| 386 | -** COMMAND: test-detach | |
| 391 | +** COMMAND: test-detach ?REPOSITORY? | |
| 387 | 392 | ** |
| 388 | 393 | ** Change the project-code and make other changes in order to prevent |
| 389 | 394 | ** the repository from ever again pushing or pulling to other |
| 390 | 395 | ** repositories. Used to create a "test" repository for development |
| 391 | 396 | ** testing by cloning a working project repository. |
| 392 | 397 | */ |
| 393 | 398 | void test_detach_cmd(void){ |
| 394 | - db_find_and_open_repository(1); | |
| 399 | + db_find_and_open_repository(0, g.argv[2]); | |
| 395 | 400 | db_begin_transaction(); |
| 396 | 401 | db_multi_exec( |
| 397 | 402 | "DELETE FROM config WHERE name='last-sync-url';" |
| 398 | 403 | "UPDATE config SET value=lower(hex(randomblob(20)))" |
| 399 | 404 | " WHERE name='project-code';" |
| @@ -411,11 +416,11 @@ | ||
| 411 | 416 | */ |
| 412 | 417 | void test_createcluster_cmd(void){ |
| 413 | 418 | if( g.argc==3 ){ |
| 414 | 419 | db_open_repository(g.argv[2]); |
| 415 | 420 | }else{ |
| 416 | - db_find_and_open_repository(1); | |
| 421 | + db_find_and_open_repository(0, 0); | |
| 417 | 422 | if( g.argc!=2 ){ |
| 418 | 423 | usage("?REPOSITORY-FILENAME?"); |
| 419 | 424 | } |
| 420 | 425 | db_close(); |
| 421 | 426 | db_open_repository(g.zRepositoryName); |
| @@ -638,11 +643,11 @@ | ||
| 638 | 643 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 639 | 644 | }else{ |
| 640 | 645 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 641 | 646 | } |
| 642 | 647 | /* open repository and open query for all artifacts */ |
| 643 | - db_find_and_open_repository(1); | |
| 648 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 644 | 649 | bag_init(&bagDone); |
| 645 | 650 | ttyOutput = 1; |
| 646 | 651 | processCnt = 0; |
| 647 | 652 | if (!g.fQuiet) { |
| 648 | 653 | printf("0 (0%%)...\r"); |
| 649 | 654 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -360,20 +360,25 @@ | |
| 360 | forceFlag = find_option("force","f",0)!=0; |
| 361 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 362 | if( g.argc==3 ){ |
| 363 | db_open_repository(g.argv[2]); |
| 364 | }else{ |
| 365 | db_find_and_open_repository(1); |
| 366 | if( g.argc!=2 ){ |
| 367 | usage("?REPOSITORY-FILENAME?"); |
| 368 | } |
| 369 | db_close(); |
| 370 | db_open_repository(g.zRepositoryName); |
| 371 | } |
| 372 | db_begin_transaction(); |
| 373 | ttyOutput = 1; |
| 374 | errCnt = rebuild_db(randomizeFlag, 1); |
| 375 | if( errCnt && !forceFlag ){ |
| 376 | printf("%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 377 | errCnt); |
| 378 | db_end_transaction(1); |
| 379 | }else{ |
| @@ -381,19 +386,19 @@ | |
| 381 | db_end_transaction(0); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | /* |
| 386 | ** COMMAND: test-detach |
| 387 | ** |
| 388 | ** Change the project-code and make other changes in order to prevent |
| 389 | ** the repository from ever again pushing or pulling to other |
| 390 | ** repositories. Used to create a "test" repository for development |
| 391 | ** testing by cloning a working project repository. |
| 392 | */ |
| 393 | void test_detach_cmd(void){ |
| 394 | db_find_and_open_repository(1); |
| 395 | db_begin_transaction(); |
| 396 | db_multi_exec( |
| 397 | "DELETE FROM config WHERE name='last-sync-url';" |
| 398 | "UPDATE config SET value=lower(hex(randomblob(20)))" |
| 399 | " WHERE name='project-code';" |
| @@ -411,11 +416,11 @@ | |
| 411 | */ |
| 412 | void test_createcluster_cmd(void){ |
| 413 | if( g.argc==3 ){ |
| 414 | db_open_repository(g.argv[2]); |
| 415 | }else{ |
| 416 | db_find_and_open_repository(1); |
| 417 | if( g.argc!=2 ){ |
| 418 | usage("?REPOSITORY-FILENAME?"); |
| 419 | } |
| 420 | db_close(); |
| 421 | db_open_repository(g.zRepositoryName); |
| @@ -638,11 +643,11 @@ | |
| 638 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 639 | }else{ |
| 640 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 641 | } |
| 642 | /* open repository and open query for all artifacts */ |
| 643 | db_find_and_open_repository(1); |
| 644 | bag_init(&bagDone); |
| 645 | ttyOutput = 1; |
| 646 | processCnt = 0; |
| 647 | if (!g.fQuiet) { |
| 648 | printf("0 (0%%)...\r"); |
| 649 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -360,20 +360,25 @@ | |
| 360 | forceFlag = find_option("force","f",0)!=0; |
| 361 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 362 | if( g.argc==3 ){ |
| 363 | db_open_repository(g.argv[2]); |
| 364 | }else{ |
| 365 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 366 | if( g.argc!=2 ){ |
| 367 | usage("?REPOSITORY-FILENAME?"); |
| 368 | } |
| 369 | db_close(); |
| 370 | db_open_repository(g.zRepositoryName); |
| 371 | } |
| 372 | db_begin_transaction(); |
| 373 | ttyOutput = 1; |
| 374 | errCnt = rebuild_db(randomizeFlag, 1); |
| 375 | db_multi_exec( |
| 376 | "REPLACE INTO config(name,value) VALUES('content-schema','%s');" |
| 377 | "REPLACE INTO config(name,value) VALUES('aux-schema','%s');", |
| 378 | CONTENT_SCHEMA, AUX_SCHEMA |
| 379 | ); |
| 380 | if( errCnt && !forceFlag ){ |
| 381 | printf("%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 382 | errCnt); |
| 383 | db_end_transaction(1); |
| 384 | }else{ |
| @@ -381,19 +386,19 @@ | |
| 386 | db_end_transaction(0); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | /* |
| 391 | ** COMMAND: test-detach ?REPOSITORY? |
| 392 | ** |
| 393 | ** Change the project-code and make other changes in order to prevent |
| 394 | ** the repository from ever again pushing or pulling to other |
| 395 | ** repositories. Used to create a "test" repository for development |
| 396 | ** testing by cloning a working project repository. |
| 397 | */ |
| 398 | void test_detach_cmd(void){ |
| 399 | db_find_and_open_repository(0, g.argv[2]); |
| 400 | db_begin_transaction(); |
| 401 | db_multi_exec( |
| 402 | "DELETE FROM config WHERE name='last-sync-url';" |
| 403 | "UPDATE config SET value=lower(hex(randomblob(20)))" |
| 404 | " WHERE name='project-code';" |
| @@ -411,11 +416,11 @@ | |
| 416 | */ |
| 417 | void test_createcluster_cmd(void){ |
| 418 | if( g.argc==3 ){ |
| 419 | db_open_repository(g.argv[2]); |
| 420 | }else{ |
| 421 | db_find_and_open_repository(0, 0); |
| 422 | if( g.argc!=2 ){ |
| 423 | usage("?REPOSITORY-FILENAME?"); |
| 424 | } |
| 425 | db_close(); |
| 426 | db_open_repository(g.zRepositoryName); |
| @@ -638,11 +643,11 @@ | |
| 643 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 644 | }else{ |
| 645 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 646 | } |
| 647 | /* open repository and open query for all artifacts */ |
| 648 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 649 | bag_init(&bagDone); |
| 650 | ttyOutput = 1; |
| 651 | processCnt = 0; |
| 652 | if (!g.fQuiet) { |
| 653 | printf("0 (0%%)...\r"); |
| 654 |
+1
-1
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -40,11 +40,11 @@ | ||
| 40 | 40 | ** a date) which can change frequently. When the content schema changes, |
| 41 | 41 | ** we have to execute special procedures to update the schema. When |
| 42 | 42 | ** the aux schema changes, all we need to do is rebuild the database. |
| 43 | 43 | */ |
| 44 | 44 | #define CONTENT_SCHEMA "1" |
| 45 | -#define AUX_SCHEMA "2006-12-23" | |
| 45 | +#define AUX_SCHEMA "2010-11-24" | |
| 46 | 46 | |
| 47 | 47 | #endif /* INTERFACE */ |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /* |
| 51 | 51 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -40,11 +40,11 @@ | |
| 40 | ** a date) which can change frequently. When the content schema changes, |
| 41 | ** we have to execute special procedures to update the schema. When |
| 42 | ** the aux schema changes, all we need to do is rebuild the database. |
| 43 | */ |
| 44 | #define CONTENT_SCHEMA "1" |
| 45 | #define AUX_SCHEMA "2006-12-23" |
| 46 | |
| 47 | #endif /* INTERFACE */ |
| 48 | |
| 49 | |
| 50 | /* |
| 51 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -40,11 +40,11 @@ | |
| 40 | ** a date) which can change frequently. When the content schema changes, |
| 41 | ** we have to execute special procedures to update the schema. When |
| 42 | ** the aux schema changes, all we need to do is rebuild the database. |
| 43 | */ |
| 44 | #define CONTENT_SCHEMA "1" |
| 45 | #define AUX_SCHEMA "2010-11-24" |
| 46 | |
| 47 | #endif /* INTERFACE */ |
| 48 | |
| 49 | |
| 50 | /* |
| 51 |
+3
-1
| --- src/sqlcmd.c | ||
| +++ src/sqlcmd.c | ||
| @@ -75,17 +75,19 @@ | ||
| 75 | 75 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 76 | 76 | ** running any SQL commands that modifies the repository database. |
| 77 | 77 | */ |
| 78 | 78 | void sqlite3_cmd(void){ |
| 79 | 79 | extern int sqlite3_shell(int, char**); |
| 80 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 81 | + db_close(); | |
| 82 | + sqlite3_shutdown(); | |
| 80 | 83 | sqlite3_shell(g.argc-1, g.argv+1); |
| 81 | 84 | } |
| 82 | 85 | |
| 83 | 86 | /* |
| 84 | 87 | ** This routine is called by the patched sqlite3 command-line shell in order |
| 85 | 88 | ** to load the name and database connection for the open Fossil database. |
| 86 | 89 | */ |
| 87 | 90 | void fossil_open(const char **pzRepoName){ |
| 88 | - db_must_be_within_tree(); | |
| 89 | 91 | sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 90 | 92 | *pzRepoName = g.zRepositoryName; |
| 91 | 93 | } |
| 92 | 94 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -75,17 +75,19 @@ | |
| 75 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 76 | ** running any SQL commands that modifies the repository database. |
| 77 | */ |
| 78 | void sqlite3_cmd(void){ |
| 79 | extern int sqlite3_shell(int, char**); |
| 80 | sqlite3_shell(g.argc-1, g.argv+1); |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | ** This routine is called by the patched sqlite3 command-line shell in order |
| 85 | ** to load the name and database connection for the open Fossil database. |
| 86 | */ |
| 87 | void fossil_open(const char **pzRepoName){ |
| 88 | db_must_be_within_tree(); |
| 89 | sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 90 | *pzRepoName = g.zRepositoryName; |
| 91 | } |
| 92 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -75,17 +75,19 @@ | |
| 75 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 76 | ** running any SQL commands that modifies the repository database. |
| 77 | */ |
| 78 | void sqlite3_cmd(void){ |
| 79 | extern int sqlite3_shell(int, char**); |
| 80 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 81 | db_close(); |
| 82 | sqlite3_shutdown(); |
| 83 | sqlite3_shell(g.argc-1, g.argv+1); |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | ** This routine is called by the patched sqlite3 command-line shell in order |
| 88 | ** to load the name and database connection for the open Fossil database. |
| 89 | */ |
| 90 | void fossil_open(const char **pzRepoName){ |
| 91 | sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 92 | *pzRepoName = g.zRepositoryName; |
| 93 | } |
| 94 |
+2
-2
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -96,11 +96,11 @@ | ||
| 96 | 96 | const char *zPw = 0; |
| 97 | 97 | int configSync = 0; |
| 98 | 98 | int urlOptional = find_option("autourl",0,0)!=0; |
| 99 | 99 | g.dontKeepUrl = find_option("once",0,0)!=0; |
| 100 | 100 | url_proxy_options(); |
| 101 | - db_find_and_open_repository(1); | |
| 101 | + db_find_and_open_repository(0, 0); | |
| 102 | 102 | db_open_config(0); |
| 103 | 103 | if( g.argc==2 ){ |
| 104 | 104 | zUrl = db_get("last-sync-url", 0); |
| 105 | 105 | zPw = unobscure(db_get("last-sync-pw", 0)); |
| 106 | 106 | if( db_get_boolean("auto-sync",1) ) configSync = CONFIGSET_SHUN; |
| @@ -224,11 +224,11 @@ | ||
| 224 | 224 | ** |
| 225 | 225 | ** See also: clone, push, pull, sync |
| 226 | 226 | */ |
| 227 | 227 | void remote_url_cmd(void){ |
| 228 | 228 | char *zUrl; |
| 229 | - db_find_and_open_repository(1); | |
| 229 | + db_find_and_open_repository(0, 0); | |
| 230 | 230 | if( g.argc!=2 && g.argc!=3 ){ |
| 231 | 231 | usage("remote-url ?URL|off?"); |
| 232 | 232 | } |
| 233 | 233 | if( g.argc==3 ){ |
| 234 | 234 | if( strcmp(g.argv[2],"off")==0 ){ |
| 235 | 235 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -96,11 +96,11 @@ | |
| 96 | const char *zPw = 0; |
| 97 | int configSync = 0; |
| 98 | int urlOptional = find_option("autourl",0,0)!=0; |
| 99 | g.dontKeepUrl = find_option("once",0,0)!=0; |
| 100 | url_proxy_options(); |
| 101 | db_find_and_open_repository(1); |
| 102 | db_open_config(0); |
| 103 | if( g.argc==2 ){ |
| 104 | zUrl = db_get("last-sync-url", 0); |
| 105 | zPw = unobscure(db_get("last-sync-pw", 0)); |
| 106 | if( db_get_boolean("auto-sync",1) ) configSync = CONFIGSET_SHUN; |
| @@ -224,11 +224,11 @@ | |
| 224 | ** |
| 225 | ** See also: clone, push, pull, sync |
| 226 | */ |
| 227 | void remote_url_cmd(void){ |
| 228 | char *zUrl; |
| 229 | db_find_and_open_repository(1); |
| 230 | if( g.argc!=2 && g.argc!=3 ){ |
| 231 | usage("remote-url ?URL|off?"); |
| 232 | } |
| 233 | if( g.argc==3 ){ |
| 234 | if( strcmp(g.argv[2],"off")==0 ){ |
| 235 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -96,11 +96,11 @@ | |
| 96 | const char *zPw = 0; |
| 97 | int configSync = 0; |
| 98 | int urlOptional = find_option("autourl",0,0)!=0; |
| 99 | g.dontKeepUrl = find_option("once",0,0)!=0; |
| 100 | url_proxy_options(); |
| 101 | db_find_and_open_repository(0, 0); |
| 102 | db_open_config(0); |
| 103 | if( g.argc==2 ){ |
| 104 | zUrl = db_get("last-sync-url", 0); |
| 105 | zPw = unobscure(db_get("last-sync-pw", 0)); |
| 106 | if( db_get_boolean("auto-sync",1) ) configSync = CONFIGSET_SHUN; |
| @@ -224,11 +224,11 @@ | |
| 224 | ** |
| 225 | ** See also: clone, push, pull, sync |
| 226 | */ |
| 227 | void remote_url_cmd(void){ |
| 228 | char *zUrl; |
| 229 | db_find_and_open_repository(0, 0); |
| 230 | if( g.argc!=2 && g.argc!=3 ){ |
| 231 | usage("remote-url ?URL|off?"); |
| 232 | } |
| 233 | if( g.argc==3 ){ |
| 234 | if( strcmp(g.argv[2],"off")==0 ){ |
| 235 |
+1
-1
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -368,11 +368,11 @@ | ||
| 368 | 368 | int n; |
| 369 | 369 | int fRaw = find_option("raw","",0)!=0; |
| 370 | 370 | int fPropagate = find_option("propagate","",0)!=0; |
| 371 | 371 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 372 | 372 | |
| 373 | - db_find_and_open_repository(1); | |
| 373 | + db_find_and_open_repository(0, 0); | |
| 374 | 374 | if( g.argc<3 ){ |
| 375 | 375 | goto tag_cmd_usage; |
| 376 | 376 | } |
| 377 | 377 | n = strlen(g.argv[2]); |
| 378 | 378 | if( n==0 ){ |
| 379 | 379 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -368,11 +368,11 @@ | |
| 368 | int n; |
| 369 | int fRaw = find_option("raw","",0)!=0; |
| 370 | int fPropagate = find_option("propagate","",0)!=0; |
| 371 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 372 | |
| 373 | db_find_and_open_repository(1); |
| 374 | if( g.argc<3 ){ |
| 375 | goto tag_cmd_usage; |
| 376 | } |
| 377 | n = strlen(g.argv[2]); |
| 378 | if( n==0 ){ |
| 379 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -368,11 +368,11 @@ | |
| 368 | int n; |
| 369 | int fRaw = find_option("raw","",0)!=0; |
| 370 | int fPropagate = find_option("propagate","",0)!=0; |
| 371 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 372 | |
| 373 | db_find_and_open_repository(0, 0); |
| 374 | if( g.argc<3 ){ |
| 375 | goto tag_cmd_usage; |
| 376 | } |
| 377 | n = strlen(g.argv[2]); |
| 378 | if( n==0 ){ |
| 379 |
+1
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1131,11 +1131,11 @@ | ||
| 1131 | 1131 | char *zDate; |
| 1132 | 1132 | Blob sql; |
| 1133 | 1133 | int objid = 0; |
| 1134 | 1134 | Blob uuid; |
| 1135 | 1135 | int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */ |
| 1136 | - db_find_and_open_repository(1); | |
| 1136 | + db_find_and_open_repository(0, 0); | |
| 1137 | 1137 | zCount = find_option("count","n",1); |
| 1138 | 1138 | zType = find_option("type","t",1); |
| 1139 | 1139 | if( zCount ){ |
| 1140 | 1140 | n = atoi(zCount); |
| 1141 | 1141 | }else{ |
| 1142 | 1142 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1131,11 +1131,11 @@ | |
| 1131 | char *zDate; |
| 1132 | Blob sql; |
| 1133 | int objid = 0; |
| 1134 | Blob uuid; |
| 1135 | int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */ |
| 1136 | db_find_and_open_repository(1); |
| 1137 | zCount = find_option("count","n",1); |
| 1138 | zType = find_option("type","t",1); |
| 1139 | if( zCount ){ |
| 1140 | n = atoi(zCount); |
| 1141 | }else{ |
| 1142 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1131,11 +1131,11 @@ | |
| 1131 | char *zDate; |
| 1132 | Blob sql; |
| 1133 | int objid = 0; |
| 1134 | Blob uuid; |
| 1135 | int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */ |
| 1136 | db_find_and_open_repository(0, 0); |
| 1137 | zCount = find_option("count","n",1); |
| 1138 | zType = find_option("type","t",1); |
| 1139 | if( zCount ){ |
| 1140 | n = atoi(zCount); |
| 1141 | }else{ |
| 1142 |
+1
-1
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -903,11 +903,11 @@ | ||
| 903 | 903 | */ |
| 904 | 904 | void ticket_cmd(void){ |
| 905 | 905 | int n; |
| 906 | 906 | |
| 907 | 907 | /* do some ints, we want to be inside a checkout */ |
| 908 | - db_find_and_open_repository(1); | |
| 908 | + db_find_and_open_repository(0, 0); | |
| 909 | 909 | user_select(); |
| 910 | 910 | /* |
| 911 | 911 | ** Check that the user exists. |
| 912 | 912 | */ |
| 913 | 913 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){ |
| 914 | 914 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -903,11 +903,11 @@ | |
| 903 | */ |
| 904 | void ticket_cmd(void){ |
| 905 | int n; |
| 906 | |
| 907 | /* do some ints, we want to be inside a checkout */ |
| 908 | db_find_and_open_repository(1); |
| 909 | user_select(); |
| 910 | /* |
| 911 | ** Check that the user exists. |
| 912 | */ |
| 913 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){ |
| 914 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -903,11 +903,11 @@ | |
| 903 | */ |
| 904 | void ticket_cmd(void){ |
| 905 | int n; |
| 906 | |
| 907 | /* do some ints, we want to be inside a checkout */ |
| 908 | db_find_and_open_repository(0, 0); |
| 909 | user_select(); |
| 910 | /* |
| 911 | ** Check that the user exists. |
| 912 | */ |
| 913 | if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){ |
| 914 |
+1
-1
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -174,11 +174,11 @@ | ||
| 174 | 174 | ** |
| 175 | 175 | ** Change the web access password for a user. |
| 176 | 176 | */ |
| 177 | 177 | void user_cmd(void){ |
| 178 | 178 | int n; |
| 179 | - db_find_and_open_repository(1); | |
| 179 | + db_find_and_open_repository(0, 0); | |
| 180 | 180 | if( g.argc<3 ){ |
| 181 | 181 | usage("capabilities|default|list|new|password ..."); |
| 182 | 182 | } |
| 183 | 183 | n = strlen(g.argv[2]); |
| 184 | 184 | if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ |
| 185 | 185 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -174,11 +174,11 @@ | |
| 174 | ** |
| 175 | ** Change the web access password for a user. |
| 176 | */ |
| 177 | void user_cmd(void){ |
| 178 | int n; |
| 179 | db_find_and_open_repository(1); |
| 180 | if( g.argc<3 ){ |
| 181 | usage("capabilities|default|list|new|password ..."); |
| 182 | } |
| 183 | n = strlen(g.argv[2]); |
| 184 | if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ |
| 185 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -174,11 +174,11 @@ | |
| 174 | ** |
| 175 | ** Change the web access password for a user. |
| 176 | */ |
| 177 | void user_cmd(void){ |
| 178 | int n; |
| 179 | db_find_and_open_repository(0, 0); |
| 180 | if( g.argc<3 ){ |
| 181 | usage("capabilities|default|list|new|password ..."); |
| 182 | } |
| 183 | n = strlen(g.argv[2]); |
| 184 | if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ |
| 185 |
+1
-1
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -880,11 +880,11 @@ | ||
| 880 | 880 | ** Diffs the local copy of a page with a given version (defaulting |
| 881 | 881 | ** to the head version). |
| 882 | 882 | */ |
| 883 | 883 | void wiki_cmd(void){ |
| 884 | 884 | int n; |
| 885 | - db_find_and_open_repository(1); | |
| 885 | + db_find_and_open_repository(0, 0); | |
| 886 | 886 | if( g.argc<3 ){ |
| 887 | 887 | goto wiki_cmd_usage; |
| 888 | 888 | } |
| 889 | 889 | n = strlen(g.argv[2]); |
| 890 | 890 | if( n==0 ){ |
| 891 | 891 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -880,11 +880,11 @@ | |
| 880 | ** Diffs the local copy of a page with a given version (defaulting |
| 881 | ** to the head version). |
| 882 | */ |
| 883 | void wiki_cmd(void){ |
| 884 | int n; |
| 885 | db_find_and_open_repository(1); |
| 886 | if( g.argc<3 ){ |
| 887 | goto wiki_cmd_usage; |
| 888 | } |
| 889 | n = strlen(g.argv[2]); |
| 890 | if( n==0 ){ |
| 891 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -880,11 +880,11 @@ | |
| 880 | ** Diffs the local copy of a page with a given version (defaulting |
| 881 | ** to the head version). |
| 882 | */ |
| 883 | void wiki_cmd(void){ |
| 884 | int n; |
| 885 | db_find_and_open_repository(0, 0); |
| 886 | if( g.argc<3 ){ |
| 887 | goto wiki_cmd_usage; |
| 888 | } |
| 889 | n = strlen(g.argv[2]); |
| 890 | if( n==0 ){ |
| 891 |
+1
-1
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -388,11 +388,11 @@ | ||
| 388 | 388 | void baseline_zip_cmd(void){ |
| 389 | 389 | int rid; |
| 390 | 390 | Blob zip; |
| 391 | 391 | const char *zName; |
| 392 | 392 | zName = find_option("name", 0, 1); |
| 393 | - db_find_and_open_repository(1); | |
| 393 | + db_find_and_open_repository(0, 0); | |
| 394 | 394 | if( g.argc!=4 ){ |
| 395 | 395 | usage("VERSION OUTPUTFILE"); |
| 396 | 396 | } |
| 397 | 397 | rid = name_to_rid(g.argv[2]); |
| 398 | 398 | if( zName==0 ){ |
| 399 | 399 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -388,11 +388,11 @@ | |
| 388 | void baseline_zip_cmd(void){ |
| 389 | int rid; |
| 390 | Blob zip; |
| 391 | const char *zName; |
| 392 | zName = find_option("name", 0, 1); |
| 393 | db_find_and_open_repository(1); |
| 394 | if( g.argc!=4 ){ |
| 395 | usage("VERSION OUTPUTFILE"); |
| 396 | } |
| 397 | rid = name_to_rid(g.argv[2]); |
| 398 | if( zName==0 ){ |
| 399 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -388,11 +388,11 @@ | |
| 388 | void baseline_zip_cmd(void){ |
| 389 | int rid; |
| 390 | Blob zip; |
| 391 | const char *zName; |
| 392 | zName = find_option("name", 0, 1); |
| 393 | db_find_and_open_repository(0, 0); |
| 394 | if( g.argc!=4 ){ |
| 395 | usage("VERSION OUTPUTFILE"); |
| 396 | } |
| 397 | rid = name_to_rid(g.argv[2]); |
| 398 | if( zName==0 ){ |
| 399 |