Fossil SCM

Add the test-move-repository command.

drh 2010-05-22 11:46 trunk
Commit 4a198644196af9bc7387dde3bed66bbd2d4659d2
1 file changed +30
+30
--- src/db.c
+++ src/db.c
@@ -845,10 +845,40 @@
845845
rep_not_found:
846846
if( errIfNotFound ){
847847
fossil_fatal("use --repository or -R to specify the repository database");
848848
}
849849
}
850
+
851
+/*
852
+** COMMAND: test-move-repository
853
+**
854
+** Usage: %fossil test-move-repository PATHNAME
855
+**
856
+** Change the location of the repository database on a local check-out.
857
+** Use this command to avoid having to close and reopen a checkout
858
+** when relocating the repository database.
859
+*/
860
+void move_repo_cmd(void){
861
+ Blob repo;
862
+ char *zRepo;
863
+ if( g.argc!=3 ){
864
+ usage("PATHNAME");
865
+ }
866
+ if( db_open_local()==0 ){
867
+ fossil_fatal("not in a local checkout");
868
+ return;
869
+ }
870
+ file_canonical_name(g.argv[2], &repo);
871
+ zRepo = blob_str(&repo);
872
+ if( access(zRepo, 0) ){
873
+ fossil_fatal("no such file: %s", zRepo);
874
+ }
875
+ db_open_or_attach(zRepo, "test_repo");
876
+ db_lset("repository", blob_str(&repo));
877
+ db_close();
878
+}
879
+
850880
851881
/*
852882
** Open the local database. If unable, exit with an error.
853883
*/
854884
void db_must_be_within_tree(void){
855885
--- src/db.c
+++ src/db.c
@@ -845,10 +845,40 @@
845 rep_not_found:
846 if( errIfNotFound ){
847 fossil_fatal("use --repository or -R to specify the repository database");
848 }
849 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
851 /*
852 ** Open the local database. If unable, exit with an error.
853 */
854 void db_must_be_within_tree(void){
855
--- src/db.c
+++ src/db.c
@@ -845,10 +845,40 @@
845 rep_not_found:
846 if( errIfNotFound ){
847 fossil_fatal("use --repository or -R to specify the repository database");
848 }
849 }
850
851 /*
852 ** COMMAND: test-move-repository
853 **
854 ** Usage: %fossil test-move-repository PATHNAME
855 **
856 ** Change the location of the repository database on a local check-out.
857 ** Use this command to avoid having to close and reopen a checkout
858 ** when relocating the repository database.
859 */
860 void move_repo_cmd(void){
861 Blob repo;
862 char *zRepo;
863 if( g.argc!=3 ){
864 usage("PATHNAME");
865 }
866 if( db_open_local()==0 ){
867 fossil_fatal("not in a local checkout");
868 return;
869 }
870 file_canonical_name(g.argv[2], &repo);
871 zRepo = blob_str(&repo);
872 if( access(zRepo, 0) ){
873 fossil_fatal("no such file: %s", zRepo);
874 }
875 db_open_or_attach(zRepo, "test_repo");
876 db_lset("repository", blob_str(&repo));
877 db_close();
878 }
879
880
881 /*
882 ** Open the local database. If unable, exit with an error.
883 */
884 void db_must_be_within_tree(void){
885

Keyboard Shortcuts

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