Fossil SCM

Fix ticket [38cecac15f]: test-move-repository requires access to original repository

jan.nijtmans 2013-03-15 14:07 trunk merge
Commit e5905473a8dbd647e07636c2af234b0526f8948c
+14 -16
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929929
**
930930
** This routine always opens the user database regardless of whether or
931931
** not the repository database is found. If the _FOSSIL_ or .fslckout file
932932
** is found, it is attached to the open database connection too.
933933
*/
934
-int db_open_local(void){
934
+int db_open_local(const char *zDbName){
935935
int i, n;
936936
char zPwd[2000];
937937
static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938938
939939
if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951951
zPwd[n] = 0;
952952
}
953953
g.zLocalRoot = mprintf("%s/", zPwd);
954954
g.localOpen = 1;
955955
db_open_config(0);
956
- db_open_repository(0);
956
+ db_open_repository(zDbName);
957957
return 1;
958958
}
959959
}
960960
n--;
961961
while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
10441044
const char *zRep = find_option("repository", "R", 1);
10451045
if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
10461046
zRep = g.argv[nArgUsed];
10471047
}
10481048
if( zRep==0 ){
1049
- if( db_open_local()==0 ){
1049
+ if( db_open_local(0)==0 ){
10501050
goto rep_not_found;
10511051
}
10521052
zRep = db_repository_filename();
10531053
if( zRep==0 ){
10541054
goto rep_not_found;
@@ -1130,18 +1130,18 @@
11301130
Blob repo;
11311131
char *zRepo;
11321132
if( g.argc!=3 ){
11331133
usage("PATHNAME");
11341134
}
1135
- if( db_open_local()==0 ){
1136
- fossil_fatal("not in a local checkout");
1137
- return;
1138
- }
11391135
file_canonical_name(g.argv[2], &repo, 0);
11401136
zRepo = blob_str(&repo);
11411137
if( file_access(zRepo, 0) ){
11421138
fossil_fatal("no such file: %s", zRepo);
1139
+ }
1140
+ if( db_open_local(zRepo)==0 ){
1141
+ fossil_fatal("not in a local checkout");
1142
+ return;
11431143
}
11441144
db_open_or_attach(zRepo, "test_repo", 0);
11451145
db_lset("repository", blob_str(&repo));
11461146
db_close(1);
11471147
}
@@ -1149,11 +1149,11 @@
11491149
11501150
/*
11511151
** Open the local database. If unable, exit with an error.
11521152
*/
11531153
void db_must_be_within_tree(void){
1154
- if( db_open_local()==0 ){
1154
+ if( db_open_local(0)==0 ){
11551155
fossil_fatal("current directory is not within an open checkout");
11561156
}
11571157
db_open_repository(0);
11581158
db_verify_schema();
11591159
}
@@ -1964,11 +1964,10 @@
19641964
** --nested Allow opening a repository inside an opened checkout
19651965
**
19661966
** See also: close
19671967
*/
19681968
void cmd_open(void){
1969
- Blob path;
19701969
int vid;
19711970
int keepFlag;
19721971
int allowNested;
19731972
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
19741973
@@ -1976,15 +1975,14 @@
19761975
keepFlag = find_option("keep",0,0)!=0;
19771976
allowNested = find_option("nested",0,0)!=0;
19781977
if( g.argc!=3 && g.argc!=4 ){
19791978
usage("REPOSITORY-FILENAME ?VERSION?");
19801979
}
1981
- if( !allowNested && db_open_local() ){
1980
+ if( !allowNested && db_open_local(0) ){
19821981
fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
19831982
}
1984
- file_canonical_name(g.argv[2], &path, 0);
1985
- db_open_repository(blob_str(&path));
1983
+ db_open_repository(g.argv[2]);
19861984
#if defined(_WIN32) || defined(__CYGWIN__)
19871985
# define LOCALDB_NAME "./_FOSSIL_"
19881986
#else
19891987
# define LOCALDB_NAME "./.fslckout"
19901988
#endif
@@ -1992,13 +1990,13 @@
19921990
#ifdef FOSSIL_LOCAL_WAL
19931991
"COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
19941992
#endif
19951993
(char*)0);
19961994
db_delete_on_failure(LOCALDB_NAME);
1997
- db_open_local();
1995
+ db_open_local(0);
19981996
db_lset("repository", g.argv[2]);
1999
- db_record_repository_filename(blob_str(&path));
1997
+ db_record_repository_filename(g.argv[2]);
20001998
vid = db_int(0, "SELECT pid FROM plink y"
20011999
" WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
20022000
if( vid==0 ){
20032001
db_lset_int("checkout", 1);
20042002
}else{
@@ -2342,11 +2340,11 @@
23422340
}
23432341
if( unsetFlag && g.argc!=3 ){
23442342
usage("PROPERTY ?-global?");
23452343
}
23462344
if( g.argc==2 ){
2347
- int openLocal = db_open_local();
2345
+ int openLocal = db_open_local(0);
23482346
for(i=0; ctrlSettings[i].name; i++){
23492347
print_setting(&ctrlSettings[i], openLocal);
23502348
}
23512349
}else if( g.argc==3 || g.argc==4 ){
23522350
const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
23662364
db_unset(ctrlSettings[i].name, globalFlag);
23672365
}else if( g.argc==4 ){
23682366
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
23692367
}else{
23702368
isManifest = 0;
2371
- print_setting(&ctrlSettings[i], db_open_local());
2369
+ print_setting(&ctrlSettings[i], db_open_local(0));
23722370
}
23732371
if( isManifest && g.localOpen ){
23742372
manifest_to_disk(db_lget_int("checkout", 0));
23752373
}
23762374
}else{
23772375
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929 **
930 ** This routine always opens the user database regardless of whether or
931 ** not the repository database is found. If the _FOSSIL_ or .fslckout file
932 ** is found, it is attached to the open database connection too.
933 */
934 int db_open_local(void){
935 int i, n;
936 char zPwd[2000];
937 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938
939 if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951 zPwd[n] = 0;
952 }
953 g.zLocalRoot = mprintf("%s/", zPwd);
954 g.localOpen = 1;
955 db_open_config(0);
956 db_open_repository(0);
957 return 1;
958 }
959 }
960 n--;
961 while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
1044 const char *zRep = find_option("repository", "R", 1);
1045 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1046 zRep = g.argv[nArgUsed];
1047 }
1048 if( zRep==0 ){
1049 if( db_open_local()==0 ){
1050 goto rep_not_found;
1051 }
1052 zRep = db_repository_filename();
1053 if( zRep==0 ){
1054 goto rep_not_found;
@@ -1130,18 +1130,18 @@
1130 Blob repo;
1131 char *zRepo;
1132 if( g.argc!=3 ){
1133 usage("PATHNAME");
1134 }
1135 if( db_open_local()==0 ){
1136 fossil_fatal("not in a local checkout");
1137 return;
1138 }
1139 file_canonical_name(g.argv[2], &repo, 0);
1140 zRepo = blob_str(&repo);
1141 if( file_access(zRepo, 0) ){
1142 fossil_fatal("no such file: %s", zRepo);
 
 
 
 
1143 }
1144 db_open_or_attach(zRepo, "test_repo", 0);
1145 db_lset("repository", blob_str(&repo));
1146 db_close(1);
1147 }
@@ -1149,11 +1149,11 @@
1149
1150 /*
1151 ** Open the local database. If unable, exit with an error.
1152 */
1153 void db_must_be_within_tree(void){
1154 if( db_open_local()==0 ){
1155 fossil_fatal("current directory is not within an open checkout");
1156 }
1157 db_open_repository(0);
1158 db_verify_schema();
1159 }
@@ -1964,11 +1964,10 @@
1964 ** --nested Allow opening a repository inside an opened checkout
1965 **
1966 ** See also: close
1967 */
1968 void cmd_open(void){
1969 Blob path;
1970 int vid;
1971 int keepFlag;
1972 int allowNested;
1973 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
1974
@@ -1976,15 +1975,14 @@
1976 keepFlag = find_option("keep",0,0)!=0;
1977 allowNested = find_option("nested",0,0)!=0;
1978 if( g.argc!=3 && g.argc!=4 ){
1979 usage("REPOSITORY-FILENAME ?VERSION?");
1980 }
1981 if( !allowNested && db_open_local() ){
1982 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1983 }
1984 file_canonical_name(g.argv[2], &path, 0);
1985 db_open_repository(blob_str(&path));
1986 #if defined(_WIN32) || defined(__CYGWIN__)
1987 # define LOCALDB_NAME "./_FOSSIL_"
1988 #else
1989 # define LOCALDB_NAME "./.fslckout"
1990 #endif
@@ -1992,13 +1990,13 @@
1992 #ifdef FOSSIL_LOCAL_WAL
1993 "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1994 #endif
1995 (char*)0);
1996 db_delete_on_failure(LOCALDB_NAME);
1997 db_open_local();
1998 db_lset("repository", g.argv[2]);
1999 db_record_repository_filename(blob_str(&path));
2000 vid = db_int(0, "SELECT pid FROM plink y"
2001 " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
2002 if( vid==0 ){
2003 db_lset_int("checkout", 1);
2004 }else{
@@ -2342,11 +2340,11 @@
2342 }
2343 if( unsetFlag && g.argc!=3 ){
2344 usage("PROPERTY ?-global?");
2345 }
2346 if( g.argc==2 ){
2347 int openLocal = db_open_local();
2348 for(i=0; ctrlSettings[i].name; i++){
2349 print_setting(&ctrlSettings[i], openLocal);
2350 }
2351 }else if( g.argc==3 || g.argc==4 ){
2352 const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
2366 db_unset(ctrlSettings[i].name, globalFlag);
2367 }else if( g.argc==4 ){
2368 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
2369 }else{
2370 isManifest = 0;
2371 print_setting(&ctrlSettings[i], db_open_local());
2372 }
2373 if( isManifest && g.localOpen ){
2374 manifest_to_disk(db_lget_int("checkout", 0));
2375 }
2376 }else{
2377
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929 **
930 ** This routine always opens the user database regardless of whether or
931 ** not the repository database is found. If the _FOSSIL_ or .fslckout file
932 ** is found, it is attached to the open database connection too.
933 */
934 int db_open_local(const char *zDbName){
935 int i, n;
936 char zPwd[2000];
937 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938
939 if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951 zPwd[n] = 0;
952 }
953 g.zLocalRoot = mprintf("%s/", zPwd);
954 g.localOpen = 1;
955 db_open_config(0);
956 db_open_repository(zDbName);
957 return 1;
958 }
959 }
960 n--;
961 while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
1044 const char *zRep = find_option("repository", "R", 1);
1045 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1046 zRep = g.argv[nArgUsed];
1047 }
1048 if( zRep==0 ){
1049 if( db_open_local(0)==0 ){
1050 goto rep_not_found;
1051 }
1052 zRep = db_repository_filename();
1053 if( zRep==0 ){
1054 goto rep_not_found;
@@ -1130,18 +1130,18 @@
1130 Blob repo;
1131 char *zRepo;
1132 if( g.argc!=3 ){
1133 usage("PATHNAME");
1134 }
 
 
 
 
1135 file_canonical_name(g.argv[2], &repo, 0);
1136 zRepo = blob_str(&repo);
1137 if( file_access(zRepo, 0) ){
1138 fossil_fatal("no such file: %s", zRepo);
1139 }
1140 if( db_open_local(zRepo)==0 ){
1141 fossil_fatal("not in a local checkout");
1142 return;
1143 }
1144 db_open_or_attach(zRepo, "test_repo", 0);
1145 db_lset("repository", blob_str(&repo));
1146 db_close(1);
1147 }
@@ -1149,11 +1149,11 @@
1149
1150 /*
1151 ** Open the local database. If unable, exit with an error.
1152 */
1153 void db_must_be_within_tree(void){
1154 if( db_open_local(0)==0 ){
1155 fossil_fatal("current directory is not within an open checkout");
1156 }
1157 db_open_repository(0);
1158 db_verify_schema();
1159 }
@@ -1964,11 +1964,10 @@
1964 ** --nested Allow opening a repository inside an opened checkout
1965 **
1966 ** See also: close
1967 */
1968 void cmd_open(void){
 
1969 int vid;
1970 int keepFlag;
1971 int allowNested;
1972 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
1973
@@ -1976,15 +1975,14 @@
1975 keepFlag = find_option("keep",0,0)!=0;
1976 allowNested = find_option("nested",0,0)!=0;
1977 if( g.argc!=3 && g.argc!=4 ){
1978 usage("REPOSITORY-FILENAME ?VERSION?");
1979 }
1980 if( !allowNested && db_open_local(0) ){
1981 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1982 }
1983 db_open_repository(g.argv[2]);
 
1984 #if defined(_WIN32) || defined(__CYGWIN__)
1985 # define LOCALDB_NAME "./_FOSSIL_"
1986 #else
1987 # define LOCALDB_NAME "./.fslckout"
1988 #endif
@@ -1992,13 +1990,13 @@
1990 #ifdef FOSSIL_LOCAL_WAL
1991 "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1992 #endif
1993 (char*)0);
1994 db_delete_on_failure(LOCALDB_NAME);
1995 db_open_local(0);
1996 db_lset("repository", g.argv[2]);
1997 db_record_repository_filename(g.argv[2]);
1998 vid = db_int(0, "SELECT pid FROM plink y"
1999 " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
2000 if( vid==0 ){
2001 db_lset_int("checkout", 1);
2002 }else{
@@ -2342,11 +2340,11 @@
2340 }
2341 if( unsetFlag && g.argc!=3 ){
2342 usage("PROPERTY ?-global?");
2343 }
2344 if( g.argc==2 ){
2345 int openLocal = db_open_local(0);
2346 for(i=0; ctrlSettings[i].name; i++){
2347 print_setting(&ctrlSettings[i], openLocal);
2348 }
2349 }else if( g.argc==3 || g.argc==4 ){
2350 const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
2364 db_unset(ctrlSettings[i].name, globalFlag);
2365 }else if( g.argc==4 ){
2366 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
2367 }else{
2368 isManifest = 0;
2369 print_setting(&ctrlSettings[i], db_open_local(0));
2370 }
2371 if( isManifest && g.localOpen ){
2372 manifest_to_disk(db_lget_int("checkout", 0));
2373 }
2374 }else{
2375
+14 -16
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929929
**
930930
** This routine always opens the user database regardless of whether or
931931
** not the repository database is found. If the _FOSSIL_ or .fslckout file
932932
** is found, it is attached to the open database connection too.
933933
*/
934
-int db_open_local(void){
934
+int db_open_local(const char *zDbName){
935935
int i, n;
936936
char zPwd[2000];
937937
static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938938
939939
if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951951
zPwd[n] = 0;
952952
}
953953
g.zLocalRoot = mprintf("%s/", zPwd);
954954
g.localOpen = 1;
955955
db_open_config(0);
956
- db_open_repository(0);
956
+ db_open_repository(zDbName);
957957
return 1;
958958
}
959959
}
960960
n--;
961961
while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
10441044
const char *zRep = find_option("repository", "R", 1);
10451045
if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
10461046
zRep = g.argv[nArgUsed];
10471047
}
10481048
if( zRep==0 ){
1049
- if( db_open_local()==0 ){
1049
+ if( db_open_local(0)==0 ){
10501050
goto rep_not_found;
10511051
}
10521052
zRep = db_repository_filename();
10531053
if( zRep==0 ){
10541054
goto rep_not_found;
@@ -1130,18 +1130,18 @@
11301130
Blob repo;
11311131
char *zRepo;
11321132
if( g.argc!=3 ){
11331133
usage("PATHNAME");
11341134
}
1135
- if( db_open_local()==0 ){
1136
- fossil_fatal("not in a local checkout");
1137
- return;
1138
- }
11391135
file_canonical_name(g.argv[2], &repo, 0);
11401136
zRepo = blob_str(&repo);
11411137
if( file_access(zRepo, 0) ){
11421138
fossil_fatal("no such file: %s", zRepo);
1139
+ }
1140
+ if( db_open_local(zRepo)==0 ){
1141
+ fossil_fatal("not in a local checkout");
1142
+ return;
11431143
}
11441144
db_open_or_attach(zRepo, "test_repo", 0);
11451145
db_lset("repository", blob_str(&repo));
11461146
db_close(1);
11471147
}
@@ -1149,11 +1149,11 @@
11491149
11501150
/*
11511151
** Open the local database. If unable, exit with an error.
11521152
*/
11531153
void db_must_be_within_tree(void){
1154
- if( db_open_local()==0 ){
1154
+ if( db_open_local(0)==0 ){
11551155
fossil_fatal("current directory is not within an open checkout");
11561156
}
11571157
db_open_repository(0);
11581158
db_verify_schema();
11591159
}
@@ -1964,11 +1964,10 @@
19641964
** --nested Allow opening a repository inside an opened checkout
19651965
**
19661966
** See also: close
19671967
*/
19681968
void cmd_open(void){
1969
- Blob path;
19701969
int vid;
19711970
int keepFlag;
19721971
int allowNested;
19731972
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
19741973
@@ -1976,15 +1975,14 @@
19761975
keepFlag = find_option("keep",0,0)!=0;
19771976
allowNested = find_option("nested",0,0)!=0;
19781977
if( g.argc!=3 && g.argc!=4 ){
19791978
usage("REPOSITORY-FILENAME ?VERSION?");
19801979
}
1981
- if( !allowNested && db_open_local() ){
1980
+ if( !allowNested && db_open_local(0) ){
19821981
fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
19831982
}
1984
- file_canonical_name(g.argv[2], &path, 0);
1985
- db_open_repository(blob_str(&path));
1983
+ db_open_repository(g.argv[2]);
19861984
#if defined(_WIN32) || defined(__CYGWIN__)
19871985
# define LOCALDB_NAME "./_FOSSIL_"
19881986
#else
19891987
# define LOCALDB_NAME "./.fslckout"
19901988
#endif
@@ -1992,13 +1990,13 @@
19921990
#ifdef FOSSIL_LOCAL_WAL
19931991
"COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
19941992
#endif
19951993
(char*)0);
19961994
db_delete_on_failure(LOCALDB_NAME);
1997
- db_open_local();
1995
+ db_open_local(0);
19981996
db_lset("repository", g.argv[2]);
1999
- db_record_repository_filename(blob_str(&path));
1997
+ db_record_repository_filename(g.argv[2]);
20001998
vid = db_int(0, "SELECT pid FROM plink y"
20011999
" WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
20022000
if( vid==0 ){
20032001
db_lset_int("checkout", 1);
20042002
}else{
@@ -2342,11 +2340,11 @@
23422340
}
23432341
if( unsetFlag && g.argc!=3 ){
23442342
usage("PROPERTY ?-global?");
23452343
}
23462344
if( g.argc==2 ){
2347
- int openLocal = db_open_local();
2345
+ int openLocal = db_open_local(0);
23482346
for(i=0; ctrlSettings[i].name; i++){
23492347
print_setting(&ctrlSettings[i], openLocal);
23502348
}
23512349
}else if( g.argc==3 || g.argc==4 ){
23522350
const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
23662364
db_unset(ctrlSettings[i].name, globalFlag);
23672365
}else if( g.argc==4 ){
23682366
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
23692367
}else{
23702368
isManifest = 0;
2371
- print_setting(&ctrlSettings[i], db_open_local());
2369
+ print_setting(&ctrlSettings[i], db_open_local(0));
23722370
}
23732371
if( isManifest && g.localOpen ){
23742372
manifest_to_disk(db_lget_int("checkout", 0));
23752373
}
23762374
}else{
23772375
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929 **
930 ** This routine always opens the user database regardless of whether or
931 ** not the repository database is found. If the _FOSSIL_ or .fslckout file
932 ** is found, it is attached to the open database connection too.
933 */
934 int db_open_local(void){
935 int i, n;
936 char zPwd[2000];
937 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938
939 if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951 zPwd[n] = 0;
952 }
953 g.zLocalRoot = mprintf("%s/", zPwd);
954 g.localOpen = 1;
955 db_open_config(0);
956 db_open_repository(0);
957 return 1;
958 }
959 }
960 n--;
961 while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
1044 const char *zRep = find_option("repository", "R", 1);
1045 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1046 zRep = g.argv[nArgUsed];
1047 }
1048 if( zRep==0 ){
1049 if( db_open_local()==0 ){
1050 goto rep_not_found;
1051 }
1052 zRep = db_repository_filename();
1053 if( zRep==0 ){
1054 goto rep_not_found;
@@ -1130,18 +1130,18 @@
1130 Blob repo;
1131 char *zRepo;
1132 if( g.argc!=3 ){
1133 usage("PATHNAME");
1134 }
1135 if( db_open_local()==0 ){
1136 fossil_fatal("not in a local checkout");
1137 return;
1138 }
1139 file_canonical_name(g.argv[2], &repo, 0);
1140 zRepo = blob_str(&repo);
1141 if( file_access(zRepo, 0) ){
1142 fossil_fatal("no such file: %s", zRepo);
 
 
 
 
1143 }
1144 db_open_or_attach(zRepo, "test_repo", 0);
1145 db_lset("repository", blob_str(&repo));
1146 db_close(1);
1147 }
@@ -1149,11 +1149,11 @@
1149
1150 /*
1151 ** Open the local database. If unable, exit with an error.
1152 */
1153 void db_must_be_within_tree(void){
1154 if( db_open_local()==0 ){
1155 fossil_fatal("current directory is not within an open checkout");
1156 }
1157 db_open_repository(0);
1158 db_verify_schema();
1159 }
@@ -1964,11 +1964,10 @@
1964 ** --nested Allow opening a repository inside an opened checkout
1965 **
1966 ** See also: close
1967 */
1968 void cmd_open(void){
1969 Blob path;
1970 int vid;
1971 int keepFlag;
1972 int allowNested;
1973 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
1974
@@ -1976,15 +1975,14 @@
1976 keepFlag = find_option("keep",0,0)!=0;
1977 allowNested = find_option("nested",0,0)!=0;
1978 if( g.argc!=3 && g.argc!=4 ){
1979 usage("REPOSITORY-FILENAME ?VERSION?");
1980 }
1981 if( !allowNested && db_open_local() ){
1982 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1983 }
1984 file_canonical_name(g.argv[2], &path, 0);
1985 db_open_repository(blob_str(&path));
1986 #if defined(_WIN32) || defined(__CYGWIN__)
1987 # define LOCALDB_NAME "./_FOSSIL_"
1988 #else
1989 # define LOCALDB_NAME "./.fslckout"
1990 #endif
@@ -1992,13 +1990,13 @@
1992 #ifdef FOSSIL_LOCAL_WAL
1993 "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1994 #endif
1995 (char*)0);
1996 db_delete_on_failure(LOCALDB_NAME);
1997 db_open_local();
1998 db_lset("repository", g.argv[2]);
1999 db_record_repository_filename(blob_str(&path));
2000 vid = db_int(0, "SELECT pid FROM plink y"
2001 " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
2002 if( vid==0 ){
2003 db_lset_int("checkout", 1);
2004 }else{
@@ -2342,11 +2340,11 @@
2342 }
2343 if( unsetFlag && g.argc!=3 ){
2344 usage("PROPERTY ?-global?");
2345 }
2346 if( g.argc==2 ){
2347 int openLocal = db_open_local();
2348 for(i=0; ctrlSettings[i].name; i++){
2349 print_setting(&ctrlSettings[i], openLocal);
2350 }
2351 }else if( g.argc==3 || g.argc==4 ){
2352 const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
2366 db_unset(ctrlSettings[i].name, globalFlag);
2367 }else if( g.argc==4 ){
2368 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
2369 }else{
2370 isManifest = 0;
2371 print_setting(&ctrlSettings[i], db_open_local());
2372 }
2373 if( isManifest && g.localOpen ){
2374 manifest_to_disk(db_lget_int("checkout", 0));
2375 }
2376 }else{
2377
--- src/db.c
+++ src/db.c
@@ -929,11 +929,11 @@
929 **
930 ** This routine always opens the user database regardless of whether or
931 ** not the repository database is found. If the _FOSSIL_ or .fslckout file
932 ** is found, it is attached to the open database connection too.
933 */
934 int db_open_local(const char *zDbName){
935 int i, n;
936 char zPwd[2000];
937 static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
938
939 if( g.localOpen) return 1;
@@ -951,11 +951,11 @@
951 zPwd[n] = 0;
952 }
953 g.zLocalRoot = mprintf("%s/", zPwd);
954 g.localOpen = 1;
955 db_open_config(0);
956 db_open_repository(zDbName);
957 return 1;
958 }
959 }
960 n--;
961 while( n>0 && zPwd[n]!='/' ){ n--; }
@@ -1044,11 +1044,11 @@
1044 const char *zRep = find_option("repository", "R", 1);
1045 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1046 zRep = g.argv[nArgUsed];
1047 }
1048 if( zRep==0 ){
1049 if( db_open_local(0)==0 ){
1050 goto rep_not_found;
1051 }
1052 zRep = db_repository_filename();
1053 if( zRep==0 ){
1054 goto rep_not_found;
@@ -1130,18 +1130,18 @@
1130 Blob repo;
1131 char *zRepo;
1132 if( g.argc!=3 ){
1133 usage("PATHNAME");
1134 }
 
 
 
 
1135 file_canonical_name(g.argv[2], &repo, 0);
1136 zRepo = blob_str(&repo);
1137 if( file_access(zRepo, 0) ){
1138 fossil_fatal("no such file: %s", zRepo);
1139 }
1140 if( db_open_local(zRepo)==0 ){
1141 fossil_fatal("not in a local checkout");
1142 return;
1143 }
1144 db_open_or_attach(zRepo, "test_repo", 0);
1145 db_lset("repository", blob_str(&repo));
1146 db_close(1);
1147 }
@@ -1149,11 +1149,11 @@
1149
1150 /*
1151 ** Open the local database. If unable, exit with an error.
1152 */
1153 void db_must_be_within_tree(void){
1154 if( db_open_local(0)==0 ){
1155 fossil_fatal("current directory is not within an open checkout");
1156 }
1157 db_open_repository(0);
1158 db_verify_schema();
1159 }
@@ -1964,11 +1964,10 @@
1964 ** --nested Allow opening a repository inside an opened checkout
1965 **
1966 ** See also: close
1967 */
1968 void cmd_open(void){
 
1969 int vid;
1970 int keepFlag;
1971 int allowNested;
1972 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
1973
@@ -1976,15 +1975,14 @@
1975 keepFlag = find_option("keep",0,0)!=0;
1976 allowNested = find_option("nested",0,0)!=0;
1977 if( g.argc!=3 && g.argc!=4 ){
1978 usage("REPOSITORY-FILENAME ?VERSION?");
1979 }
1980 if( !allowNested && db_open_local(0) ){
1981 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1982 }
1983 db_open_repository(g.argv[2]);
 
1984 #if defined(_WIN32) || defined(__CYGWIN__)
1985 # define LOCALDB_NAME "./_FOSSIL_"
1986 #else
1987 # define LOCALDB_NAME "./.fslckout"
1988 #endif
@@ -1992,13 +1990,13 @@
1990 #ifdef FOSSIL_LOCAL_WAL
1991 "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1992 #endif
1993 (char*)0);
1994 db_delete_on_failure(LOCALDB_NAME);
1995 db_open_local(0);
1996 db_lset("repository", g.argv[2]);
1997 db_record_repository_filename(g.argv[2]);
1998 vid = db_int(0, "SELECT pid FROM plink y"
1999 " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
2000 if( vid==0 ){
2001 db_lset_int("checkout", 1);
2002 }else{
@@ -2342,11 +2340,11 @@
2340 }
2341 if( unsetFlag && g.argc!=3 ){
2342 usage("PROPERTY ?-global?");
2343 }
2344 if( g.argc==2 ){
2345 int openLocal = db_open_local(0);
2346 for(i=0; ctrlSettings[i].name; i++){
2347 print_setting(&ctrlSettings[i], openLocal);
2348 }
2349 }else if( g.argc==3 || g.argc==4 ){
2350 const char *zName = g.argv[2];
@@ -2366,11 +2364,11 @@
2364 db_unset(ctrlSettings[i].name, globalFlag);
2365 }else if( g.argc==4 ){
2366 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
2367 }else{
2368 isManifest = 0;
2369 print_setting(&ctrlSettings[i], db_open_local(0));
2370 }
2371 if( isManifest && g.localOpen ){
2372 manifest_to_disk(db_lget_int("checkout", 0));
2373 }
2374 }else{
2375
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -395,11 +395,11 @@
395395
}
396396
}else{
397397
goto doc_not_found;
398398
}
399399
}
400
- if( fossil_strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){
400
+ if( fossil_strcmp(zBaseline,"ckout")==0 && db_open_local(0)==0 ){
401401
sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip");
402402
}
403403
if( fossil_strcmp(zBaseline,"ckout")==0 ){
404404
/* Read from the local checkout */
405405
char *zFullpath;
406406
--- src/doc.c
+++ src/doc.c
@@ -395,11 +395,11 @@
395 }
396 }else{
397 goto doc_not_found;
398 }
399 }
400 if( fossil_strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){
401 sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip");
402 }
403 if( fossil_strcmp(zBaseline,"ckout")==0 ){
404 /* Read from the local checkout */
405 char *zFullpath;
406
--- src/doc.c
+++ src/doc.c
@@ -395,11 +395,11 @@
395 }
396 }else{
397 goto doc_not_found;
398 }
399 }
400 if( fossil_strcmp(zBaseline,"ckout")==0 && db_open_local(0)==0 ){
401 sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip");
402 }
403 if( fossil_strcmp(zBaseline,"ckout")==0 ){
404 /* Read from the local checkout */
405 char *zFullpath;
406
--- src/json_status.c
+++ src/json_status.c
@@ -46,11 +46,11 @@
4646
cson_object * tmpO;
4747
char * zTmp;
4848
i64 iMtime;
4949
cson_array * aFiles;
5050
51
- if(!db_open_local()){
51
+ if(!db_open_local(0)){
5252
json_set_err(FSL_JSON_E_DB_NEEDS_CHECKOUT, NULL);
5353
return NULL;
5454
}
5555
oPay = cson_new_object();
5656
cson_object_set(oPay, "repository",
5757
--- src/json_status.c
+++ src/json_status.c
@@ -46,11 +46,11 @@
46 cson_object * tmpO;
47 char * zTmp;
48 i64 iMtime;
49 cson_array * aFiles;
50
51 if(!db_open_local()){
52 json_set_err(FSL_JSON_E_DB_NEEDS_CHECKOUT, NULL);
53 return NULL;
54 }
55 oPay = cson_new_object();
56 cson_object_set(oPay, "repository",
57
--- src/json_status.c
+++ src/json_status.c
@@ -46,11 +46,11 @@
46 cson_object * tmpO;
47 char * zTmp;
48 i64 iMtime;
49 cson_array * aFiles;
50
51 if(!db_open_local(0)){
52 json_set_err(FSL_JSON_E_DB_NEEDS_CHECKOUT, NULL);
53 return NULL;
54 }
55 oPay = cson_new_object();
56 cson_object_set(oPay, "repository",
57
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
11751175
if( !g.perm.Setup ){
11761176
login_needed();
11771177
}
11781178
11791179
style_header("Settings");
1180
- db_open_local();
1180
+ db_open_local(0);
11811181
db_begin_transaction();
11821182
@ <p>This page provides a simple interface to the "fossil setting" command.
11831183
@ See the "fossil help setting" output below for further information on
11841184
@ the meaning of each setting.</p><hr />
11851185
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
11861186
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
1175 if( !g.perm.Setup ){
1176 login_needed();
1177 }
1178
1179 style_header("Settings");
1180 db_open_local();
1181 db_begin_transaction();
1182 @ <p>This page provides a simple interface to the "fossil setting" command.
1183 @ See the "fossil help setting" output below for further information on
1184 @ the meaning of each setting.</p><hr />
1185 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1186
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
1175 if( !g.perm.Setup ){
1176 login_needed();
1177 }
1178
1179 style_header("Settings");
1180 db_open_local(0);
1181 db_begin_transaction();
1182 @ <p>This page provides a simple interface to the "fossil setting" command.
1183 @ See the "fossil help setting" output below for further information on
1184 @ the meaning of each setting.</p><hr />
1185 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1186
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
11751175
if( !g.perm.Setup ){
11761176
login_needed();
11771177
}
11781178
11791179
style_header("Settings");
1180
- db_open_local();
1180
+ db_open_local(0);
11811181
db_begin_transaction();
11821182
@ <p>This page provides a simple interface to the "fossil setting" command.
11831183
@ See the "fossil help setting" output below for further information on
11841184
@ the meaning of each setting.</p><hr />
11851185
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
11861186
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
1175 if( !g.perm.Setup ){
1176 login_needed();
1177 }
1178
1179 style_header("Settings");
1180 db_open_local();
1181 db_begin_transaction();
1182 @ <p>This page provides a simple interface to the "fossil setting" command.
1183 @ See the "fossil help setting" output below for further information on
1184 @ the meaning of each setting.</p><hr />
1185 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1186
--- src/setup.c
+++ src/setup.c
@@ -1175,11 +1175,11 @@
1175 if( !g.perm.Setup ){
1176 login_needed();
1177 }
1178
1179 style_header("Settings");
1180 db_open_local(0);
1181 db_begin_transaction();
1182 @ <p>This page provides a simple interface to the "fossil setting" command.
1183 @ See the "fossil help setting" output below for further information on
1184 @ the meaning of each setting.</p><hr />
1185 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1186

Keyboard Shortcuts

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