Fossil SCM

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

mistachkin 2016-01-14 05:34 trunk merge
Commit 2e1ccc6a36d4de8ce9db11819fd9ecec00a17ec5
2 files changed +10 -4 +1 -1
+10 -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:
@@ -194,12 +198,14 @@
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){
198202
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
+ }
201207
sqlite3_shutdown();
202208
sqlite3_shell(g.argc-1, g.argv+1);
203209
sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit);
204210
g.db = 0;
205211
g.zMainDbType = 0;
206212
--- 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
--- 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