Fossil SCM

Add the "close" command.

drh 2007-08-11 01:16 trunk
Commit 4452576730808ff4669afba08536c3ef359c4b4e
1 file changed +19 -1
+19 -1
--- src/checkout.c
+++ src/checkout.c
@@ -123,11 +123,11 @@
123123
db_begin_transaction();
124124
forceFlag = find_option("force","f",0)!=0;
125125
noWrite = find_option("dontwrite",0,0)!=0;
126126
if( g.argc!=3 ) usage("?--force? VERSION");
127127
if( !forceFlag && unsaved_changes()==1 ){
128
- fossil_panic("there are unsaved changes in the current checkout");
128
+ fossil_fatal("there are unsaved changes in the current checkout");
129129
}
130130
if( forceFlag ){
131131
db_multi_exec("DELETE FROM vfile");
132132
prior = 0;
133133
}else{
@@ -155,5 +155,23 @@
155155
if( blob_compare(&cksum1, &cksum1b) ){
156156
printf("WARNING: manifest checksum does not agree with manifest\n");
157157
}
158158
db_end_transaction(0);
159159
}
160
+
161
+/*
162
+** COMMAND: close
163
+**
164
+** The opposite of "open". Close the current database connection.
165
+** Require a -f or --force flag if there are unsaved changed in the
166
+** current check-out.
167
+*/
168
+void close_cmd(void){
169
+ int forceFlag = find_option("force","f",0)!=0;
170
+ db_must_be_within_tree();
171
+ if( !forceFlag && unsaved_changes()==1 ){
172
+ fossil_fatal("there are unsaved changes in the current checkout");
173
+ }
174
+ db_close();
175
+ unlink(mprintf("%s_FOSSIL_", g.zLocalRoot));
176
+ unlink(mprintf("%s_FOSSIL_-journal", g.zLocalRoot));
177
+}
160178
--- src/checkout.c
+++ src/checkout.c
@@ -123,11 +123,11 @@
123 db_begin_transaction();
124 forceFlag = find_option("force","f",0)!=0;
125 noWrite = find_option("dontwrite",0,0)!=0;
126 if( g.argc!=3 ) usage("?--force? VERSION");
127 if( !forceFlag && unsaved_changes()==1 ){
128 fossil_panic("there are unsaved changes in the current checkout");
129 }
130 if( forceFlag ){
131 db_multi_exec("DELETE FROM vfile");
132 prior = 0;
133 }else{
@@ -155,5 +155,23 @@
155 if( blob_compare(&cksum1, &cksum1b) ){
156 printf("WARNING: manifest checksum does not agree with manifest\n");
157 }
158 db_end_transaction(0);
159 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
--- src/checkout.c
+++ src/checkout.c
@@ -123,11 +123,11 @@
123 db_begin_transaction();
124 forceFlag = find_option("force","f",0)!=0;
125 noWrite = find_option("dontwrite",0,0)!=0;
126 if( g.argc!=3 ) usage("?--force? VERSION");
127 if( !forceFlag && unsaved_changes()==1 ){
128 fossil_fatal("there are unsaved changes in the current checkout");
129 }
130 if( forceFlag ){
131 db_multi_exec("DELETE FROM vfile");
132 prior = 0;
133 }else{
@@ -155,5 +155,23 @@
155 if( blob_compare(&cksum1, &cksum1b) ){
156 printf("WARNING: manifest checksum does not agree with manifest\n");
157 }
158 db_end_transaction(0);
159 }
160
161 /*
162 ** COMMAND: close
163 **
164 ** The opposite of "open". Close the current database connection.
165 ** Require a -f or --force flag if there are unsaved changed in the
166 ** current check-out.
167 */
168 void close_cmd(void){
169 int forceFlag = find_option("force","f",0)!=0;
170 db_must_be_within_tree();
171 if( !forceFlag && unsaved_changes()==1 ){
172 fossil_fatal("there are unsaved changes in the current checkout");
173 }
174 db_close();
175 unlink(mprintf("%s_FOSSIL_", g.zLocalRoot));
176 unlink(mprintf("%s_FOSSIL_-journal", g.zLocalRoot));
177 }
178

Keyboard Shortcuts

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