Diff
Not logged in

Differences From:

File src/checkout.c part of check-in [a040ae6e17] - Write the new manifest file to the root of the check-out tree when doing an update. by drh on 2007-08-08 15:18:53. [view]

To:

File src/checkout.c part of check-in [4452576730808f] - Add the "close" command. by drh on 2007-08-11 01:16:31. [view]

@@ -124,9 +124,9 @@
   forceFlag = find_option("force","f",0)!=0;
   noWrite = find_option("dontwrite",0,0)!=0;
   if( g.argc!=3 ) usage("?--force? VERSION");
   if( !forceFlag && unsaved_changes()==1 ){
-    fossil_panic("there are unsaved changes in the current checkout");
+    fossil_fatal("there are unsaved changes in the current checkout");
   }
   if( forceFlag ){
     db_multi_exec("DELETE FROM vfile");
     prior = 0;
@@ -155,5 +155,23 @@
   if( blob_compare(&cksum1, &cksum1b) ){
     printf("WARNING: manifest checksum does not agree with manifest\n");
   }
   db_end_transaction(0);
+}
+
+/*
+** COMMAND: close
+**
+** The opposite of "open".  Close the current database connection.
+** Require a -f or --force flag if there are unsaved changed in the
+** current check-out.
+*/
+void close_cmd(void){
+  int forceFlag = find_option("force","f",0)!=0;
+  db_must_be_within_tree();
+  if( !forceFlag && unsaved_changes()==1 ){
+    fossil_fatal("there are unsaved changes in the current checkout");
+  }
+  db_close();
+  unlink(mprintf("%s_FOSSIL_", g.zLocalRoot));
+  unlink(mprintf("%s_FOSSIL_-journal", g.zLocalRoot));
 }