Fossil SCM

Add the '--no-repository' option to the 'fossil sqlite3' command and make use of it for the merge5 test.

mistachkin 2016-01-13 01:31 UTC trunk
Commit 56f74a120d0aac8773b0c43e2a3c8f7f13b709d1
2 files changed +12 -4 +1 -1
+12 -4
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -152,17 +152,21 @@
152152
}
153153
154154
/*
155155
** COMMAND: sqlite3
156156
**
157
-** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS?
157
+** Usage: %fossil sqlite3 ?FOSSIL_OPTS? ?DATABASE? ?SHELL_OPTS?
158158
**
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.
160160
** If DATABASE is omitted, then the repository that serves the working
161161
** directory is opened. See https://www.sqlite.org/cli.html for additional
162162
** information.
163163
**
164
+** Fossil Options:
165
+**
166
+** --no-repository Skip opening the repository database.
167
+**
164168
** WARNING: Careless use of this command can corrupt a Fossil repository
165169
** in ways that are unrecoverable. Be sure you know what you are doing before
166170
** running any SQL commands that modifies the repository database.
167171
**
168172
** The following extensions to the usual SQLite commands are provided:
@@ -193,13 +197,17 @@
193197
**
194198
** CREATE VIRTUAL TABLE temp.foci USING files_of_checkin;
195199
** SELECT * FROM foci WHERE checkinID=symbolic_name_to_rid('trunk');
196200
*/
197201
void cmd_sqlite3(void){
202
+ int noRepository;
198203
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
+ }
201209
sqlite3_shutdown();
202210
sqlite3_shell(g.argc-1, g.argv+1);
203211
sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit);
204212
g.db = 0;
205213
g.zMainDbType = 0;
206214
--- 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
--- test/merge5.test
+++ test/merge5.test
@@ -48,11 +48,11 @@
4848
# We need not to clutter the $HOME of the test caller.
4949
set env(HOME) [pwd]
5050
5151
# Construct a test repository
5252
#
53
-exec sqlite3 m5.fossil <$testdir/${testfile}_repo.sql
53
+exec fossil sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql
5454
fossil rebuild m5.fossil
5555
fossil open m5.fossil
5656
fossil user default drh --user drh
5757
fossil update baseline
5858
checkout-test 10 {
5959
--- 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

Keyboard Shortcuts

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