Fossil SCM
Add the '--no-repository' option to the 'fossil sqlite3' command and make use of it for the merge5 test.
Commit
2e1ccc6a36d4de8ce9db11819fd9ecec00a17ec5
Parent
42c4d8f2d537a87…
2 files changed
+10
-4
+1
-1
+10
-4
| --- src/sqlcmd.c | ||
| +++ src/sqlcmd.c | ||
| @@ -152,17 +152,21 @@ | ||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /* |
| 155 | 155 | ** COMMAND: sqlite3 |
| 156 | 156 | ** |
| 157 | -** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS? | |
| 157 | +** Usage: %fossil sqlite3 ?FOSSIL_OPTS? ?DATABASE? ?SHELL_OPTS? | |
| 158 | 158 | ** |
| 159 | -** Run the standalone sqlite3 command-line shell on DATABASE with OPTIONS. | |
| 159 | +** Run the standalone sqlite3 command-line shell on DATABASE with SHELL_OPTS. | |
| 160 | 160 | ** If DATABASE is omitted, then the repository that serves the working |
| 161 | 161 | ** directory is opened. See https://www.sqlite.org/cli.html for additional |
| 162 | 162 | ** information. |
| 163 | 163 | ** |
| 164 | +** Fossil Options: | |
| 165 | +** | |
| 166 | +** --no-repository Skip opening the repository database. | |
| 167 | +** | |
| 164 | 168 | ** WARNING: Careless use of this command can corrupt a Fossil repository |
| 165 | 169 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 166 | 170 | ** running any SQL commands that modifies the repository database. |
| 167 | 171 | ** |
| 168 | 172 | ** The following extensions to the usual SQLite commands are provided: |
| @@ -194,12 +198,14 @@ | ||
| 194 | 198 | ** CREATE VIRTUAL TABLE temp.foci USING files_of_checkin; |
| 195 | 199 | ** SELECT * FROM foci WHERE checkinID=symbolic_name_to_rid('trunk'); |
| 196 | 200 | */ |
| 197 | 201 | void cmd_sqlite3(void){ |
| 198 | 202 | extern int sqlite3_shell(int, char**); |
| 199 | - db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 200 | - db_close(1); | |
| 203 | + if( !find_option("no-repository", 0, 0)!=0 ){ | |
| 204 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 205 | + db_close(1); | |
| 206 | + } | |
| 201 | 207 | sqlite3_shutdown(); |
| 202 | 208 | sqlite3_shell(g.argc-1, g.argv+1); |
| 203 | 209 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 204 | 210 | g.db = 0; |
| 205 | 211 | g.zMainDbType = 0; |
| 206 | 212 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -152,17 +152,21 @@ | |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | ** COMMAND: sqlite3 |
| 156 | ** |
| 157 | ** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS? |
| 158 | ** |
| 159 | ** Run the standalone sqlite3 command-line shell on DATABASE with OPTIONS. |
| 160 | ** If DATABASE is omitted, then the repository that serves the working |
| 161 | ** directory is opened. See https://www.sqlite.org/cli.html for additional |
| 162 | ** information. |
| 163 | ** |
| 164 | ** WARNING: Careless use of this command can corrupt a Fossil repository |
| 165 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 166 | ** running any SQL commands that modifies the repository database. |
| 167 | ** |
| 168 | ** The following extensions to the usual SQLite commands are provided: |
| @@ -194,12 +198,14 @@ | |
| 194 | ** CREATE VIRTUAL TABLE temp.foci USING files_of_checkin; |
| 195 | ** SELECT * FROM foci WHERE checkinID=symbolic_name_to_rid('trunk'); |
| 196 | */ |
| 197 | void cmd_sqlite3(void){ |
| 198 | extern int sqlite3_shell(int, char**); |
| 199 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 200 | db_close(1); |
| 201 | sqlite3_shutdown(); |
| 202 | sqlite3_shell(g.argc-1, g.argv+1); |
| 203 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 204 | g.db = 0; |
| 205 | g.zMainDbType = 0; |
| 206 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -152,17 +152,21 @@ | |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | ** COMMAND: sqlite3 |
| 156 | ** |
| 157 | ** Usage: %fossil sqlite3 ?FOSSIL_OPTS? ?DATABASE? ?SHELL_OPTS? |
| 158 | ** |
| 159 | ** Run the standalone sqlite3 command-line shell on DATABASE with SHELL_OPTS. |
| 160 | ** If DATABASE is omitted, then the repository that serves the working |
| 161 | ** directory is opened. See https://www.sqlite.org/cli.html for additional |
| 162 | ** information. |
| 163 | ** |
| 164 | ** Fossil Options: |
| 165 | ** |
| 166 | ** --no-repository Skip opening the repository database. |
| 167 | ** |
| 168 | ** WARNING: Careless use of this command can corrupt a Fossil repository |
| 169 | ** in ways that are unrecoverable. Be sure you know what you are doing before |
| 170 | ** running any SQL commands that modifies the repository database. |
| 171 | ** |
| 172 | ** The following extensions to the usual SQLite commands are provided: |
| @@ -194,12 +198,14 @@ | |
| 198 | ** CREATE VIRTUAL TABLE temp.foci USING files_of_checkin; |
| 199 | ** SELECT * FROM foci WHERE checkinID=symbolic_name_to_rid('trunk'); |
| 200 | */ |
| 201 | void cmd_sqlite3(void){ |
| 202 | extern int sqlite3_shell(int, char**); |
| 203 | if( !find_option("no-repository", 0, 0)!=0 ){ |
| 204 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 205 | db_close(1); |
| 206 | } |
| 207 | sqlite3_shutdown(); |
| 208 | sqlite3_shell(g.argc-1, g.argv+1); |
| 209 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 210 | g.db = 0; |
| 211 | g.zMainDbType = 0; |
| 212 |
+1
-1
| --- test/merge5.test | ||
| +++ test/merge5.test | ||
| @@ -48,11 +48,11 @@ | ||
| 48 | 48 | # We need not to clutter the $HOME of the test caller. |
| 49 | 49 | set env(HOME) [pwd] |
| 50 | 50 | |
| 51 | 51 | # Construct a test repository |
| 52 | 52 | # |
| 53 | -exec sqlite3 m5.fossil <$testdir/${testfile}_repo.sql | |
| 53 | +exec fossil sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql | |
| 54 | 54 | fossil rebuild m5.fossil |
| 55 | 55 | fossil open m5.fossil |
| 56 | 56 | fossil user default drh --user drh |
| 57 | 57 | fossil update baseline |
| 58 | 58 | checkout-test 10 { |
| 59 | 59 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -48,11 +48,11 @@ | |
| 48 | # We need not to clutter the $HOME of the test caller. |
| 49 | set env(HOME) [pwd] |
| 50 | |
| 51 | # Construct a test repository |
| 52 | # |
| 53 | exec sqlite3 m5.fossil <$testdir/${testfile}_repo.sql |
| 54 | fossil rebuild m5.fossil |
| 55 | fossil open m5.fossil |
| 56 | fossil user default drh --user drh |
| 57 | fossil update baseline |
| 58 | checkout-test 10 { |
| 59 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -48,11 +48,11 @@ | |
| 48 | # We need not to clutter the $HOME of the test caller. |
| 49 | set env(HOME) [pwd] |
| 50 | |
| 51 | # Construct a test repository |
| 52 | # |
| 53 | exec fossil sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql |
| 54 | fossil rebuild m5.fossil |
| 55 | fossil open m5.fossil |
| 56 | fossil user default drh --user drh |
| 57 | fossil update baseline |
| 58 | checkout-test 10 { |
| 59 |