Fossil SCM
Add the '--no-repository' option to the 'fossil sqlite3' command and make use of it for the merge5 test.
Commit
56f74a120d0aac8773b0c43e2a3c8f7f13b709d1
Parent
be81a2fd3cd569d…
2 files changed
+12
-4
+1
-1
+12
-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: |
| @@ -193,13 +197,17 @@ | ||
| 193 | 197 | ** |
| 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){ |
| 202 | + int noRepository; | |
| 198 | 203 | extern int sqlite3_shell(int, char**); |
| 199 | - db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 200 | - db_close(1); | |
| 204 | + noRepository = find_option("no-repository", 0, 0)!=0; | |
| 205 | + if( !noRepository ){ | |
| 206 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 207 | + db_close(1); | |
| 208 | + } | |
| 201 | 209 | sqlite3_shutdown(); |
| 202 | 210 | sqlite3_shell(g.argc-1, g.argv+1); |
| 203 | 211 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 204 | 212 | g.db = 0; |
| 205 | 213 | g.zMainDbType = 0; |
| 206 | 214 |
| --- 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: |
| @@ -193,13 +197,17 @@ | |
| 193 | ** |
| 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: |
| @@ -193,13 +197,17 @@ | |
| 197 | ** |
| 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 | int noRepository; |
| 203 | extern int sqlite3_shell(int, char**); |
| 204 | noRepository = find_option("no-repository", 0, 0)!=0; |
| 205 | if( !noRepository ){ |
| 206 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 207 | db_close(1); |
| 208 | } |
| 209 | sqlite3_shutdown(); |
| 210 | sqlite3_shell(g.argc-1, g.argv+1); |
| 211 | sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); |
| 212 | g.db = 0; |
| 213 | g.zMainDbType = 0; |
| 214 |
+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 |