Fossil SCM

Merge updates from trunk.

mistachkin 2014-06-15 23:55 dbCloseConfig merge
Commit eabb27e8c77c260da077970176ce3fc251f75a57
+1 -1
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
10711071
** use the repository of the open checkout if there is one.
10721072
**
10731073
** Error out if the repository cannot be opened.
10741074
*/
10751075
void db_find_and_open_repository(int bFlags, int nArgUsed){
1076
- const char *zRep = find_option("repository", "R", 1);
1076
+ const char *zRep = find_repository_option();
10771077
if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
10781078
zRep = g.argv[nArgUsed];
10791079
}
10801080
if( zRep==0 ){
10811081
if( db_open_local(0)==0 ){
10821082
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
1071 ** use the repository of the open checkout if there is one.
1072 **
1073 ** Error out if the repository cannot be opened.
1074 */
1075 void db_find_and_open_repository(int bFlags, int nArgUsed){
1076 const char *zRep = find_option("repository", "R", 1);
1077 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1078 zRep = g.argv[nArgUsed];
1079 }
1080 if( zRep==0 ){
1081 if( db_open_local(0)==0 ){
1082
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
1071 ** use the repository of the open checkout if there is one.
1072 **
1073 ** Error out if the repository cannot be opened.
1074 */
1075 void db_find_and_open_repository(int bFlags, int nArgUsed){
1076 const char *zRep = find_repository_option();
1077 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1078 zRep = g.argv[nArgUsed];
1079 }
1080 if( zRep==0 ){
1081 if( db_open_local(0)==0 ){
1082
+1 -1
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
10711071
** use the repository of the open checkout if there is one.
10721072
**
10731073
** Error out if the repository cannot be opened.
10741074
*/
10751075
void db_find_and_open_repository(int bFlags, int nArgUsed){
1076
- const char *zRep = find_option("repository", "R", 1);
1076
+ const char *zRep = find_repository_option();
10771077
if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
10781078
zRep = g.argv[nArgUsed];
10791079
}
10801080
if( zRep==0 ){
10811081
if( db_open_local(0)==0 ){
10821082
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
1071 ** use the repository of the open checkout if there is one.
1072 **
1073 ** Error out if the repository cannot be opened.
1074 */
1075 void db_find_and_open_repository(int bFlags, int nArgUsed){
1076 const char *zRep = find_option("repository", "R", 1);
1077 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1078 zRep = g.argv[nArgUsed];
1079 }
1080 if( zRep==0 ){
1081 if( db_open_local(0)==0 ){
1082
--- src/db.c
+++ src/db.c
@@ -1071,11 +1071,11 @@
1071 ** use the repository of the open checkout if there is one.
1072 **
1073 ** Error out if the repository cannot be opened.
1074 */
1075 void db_find_and_open_repository(int bFlags, int nArgUsed){
1076 const char *zRep = find_repository_option();
1077 if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
1078 zRep = g.argv[nArgUsed];
1079 }
1080 if( zRep==0 ){
1081 if( db_open_local(0)==0 ){
1082
+7 -3
--- src/fusefs.c
+++ src/fusefs.c
@@ -122,10 +122,11 @@
122122
** Implementation of stat()
123123
*/
124124
static int fusefs_getattr(const char *zPath, struct stat *stbuf){
125125
int n, rid;
126126
ManifestFile *pFile;
127
+ char *zDir;
127128
stbuf->st_uid = getuid();
128129
stbuf->st_gid = getgid();
129130
n = fusefs_parse_path(zPath);
130131
if( n==0 ){
131132
stbuf->st_mode = S_IFDIR | 0555;
@@ -145,14 +146,13 @@
145146
stbuf->st_nlink = 2;
146147
return 0;
147148
}
148149
fusefs_load_rid(rid, fusefs.az[1]);
149150
if( fusefs.pMan==0 ) return -ENOENT;
150
- pFile = manifest_file_seek(fusefs.pMan, fusefs.az[2], 1);
151
- if( pFile==0 ) return -ENOENT;
152151
stbuf->st_mtime = (fusefs.pMan->rDate - 2440587.5)*86400.0;
153
- if( strcmp(fusefs.az[2], pFile->zName)==0 ){
152
+ pFile = manifest_file_seek(fusefs.pMan, fusefs.az[2], 0);
153
+ if( pFile ){
154154
static Stmt q;
155155
stbuf->st_mode = S_IFREG |
156156
(manifest_file_mperm(pFile)==PERM_EXE ? 0555 : 0444);
157157
stbuf->st_nlink = 1;
158158
db_static_prepare(&q, "SELECT size FROM blob WHERE uuid=$uuid");
@@ -161,10 +161,14 @@
161161
stbuf->st_size = db_column_int(&q, 0);
162162
}
163163
db_reset(&q);
164164
return 0;
165165
}
166
+ zDir = mprintf("%s/", fusefs.az[2]);
167
+ pFile = manifest_file_seek(fusefs.pMan, zDir, 1);
168
+ fossil_free(zDir);
169
+ if( pFile==0 ) return -ENOENT;
166170
n = (int)strlen(fusefs.az[2]);
167171
if( strncmp(fusefs.az[2], pFile->zName, n)!=0 ) return -ENOENT;
168172
if( pFile->zName[n]!='/' ) return -ENOENT;
169173
stbuf->st_mode = S_IFDIR | 0555;
170174
stbuf->st_nlink = 2;
171175
--- src/fusefs.c
+++ src/fusefs.c
@@ -122,10 +122,11 @@
122 ** Implementation of stat()
123 */
124 static int fusefs_getattr(const char *zPath, struct stat *stbuf){
125 int n, rid;
126 ManifestFile *pFile;
 
127 stbuf->st_uid = getuid();
128 stbuf->st_gid = getgid();
129 n = fusefs_parse_path(zPath);
130 if( n==0 ){
131 stbuf->st_mode = S_IFDIR | 0555;
@@ -145,14 +146,13 @@
145 stbuf->st_nlink = 2;
146 return 0;
147 }
148 fusefs_load_rid(rid, fusefs.az[1]);
149 if( fusefs.pMan==0 ) return -ENOENT;
150 pFile = manifest_file_seek(fusefs.pMan, fusefs.az[2], 1);
151 if( pFile==0 ) return -ENOENT;
152 stbuf->st_mtime = (fusefs.pMan->rDate - 2440587.5)*86400.0;
153 if( strcmp(fusefs.az[2], pFile->zName)==0 ){
 
154 static Stmt q;
155 stbuf->st_mode = S_IFREG |
156 (manifest_file_mperm(pFile)==PERM_EXE ? 0555 : 0444);
157 stbuf->st_nlink = 1;
158 db_static_prepare(&q, "SELECT size FROM blob WHERE uuid=$uuid");
@@ -161,10 +161,14 @@
161 stbuf->st_size = db_column_int(&q, 0);
162 }
163 db_reset(&q);
164 return 0;
165 }
 
 
 
 
166 n = (int)strlen(fusefs.az[2]);
167 if( strncmp(fusefs.az[2], pFile->zName, n)!=0 ) return -ENOENT;
168 if( pFile->zName[n]!='/' ) return -ENOENT;
169 stbuf->st_mode = S_IFDIR | 0555;
170 stbuf->st_nlink = 2;
171
--- src/fusefs.c
+++ src/fusefs.c
@@ -122,10 +122,11 @@
122 ** Implementation of stat()
123 */
124 static int fusefs_getattr(const char *zPath, struct stat *stbuf){
125 int n, rid;
126 ManifestFile *pFile;
127 char *zDir;
128 stbuf->st_uid = getuid();
129 stbuf->st_gid = getgid();
130 n = fusefs_parse_path(zPath);
131 if( n==0 ){
132 stbuf->st_mode = S_IFDIR | 0555;
@@ -145,14 +146,13 @@
146 stbuf->st_nlink = 2;
147 return 0;
148 }
149 fusefs_load_rid(rid, fusefs.az[1]);
150 if( fusefs.pMan==0 ) return -ENOENT;
 
 
151 stbuf->st_mtime = (fusefs.pMan->rDate - 2440587.5)*86400.0;
152 pFile = manifest_file_seek(fusefs.pMan, fusefs.az[2], 0);
153 if( pFile ){
154 static Stmt q;
155 stbuf->st_mode = S_IFREG |
156 (manifest_file_mperm(pFile)==PERM_EXE ? 0555 : 0444);
157 stbuf->st_nlink = 1;
158 db_static_prepare(&q, "SELECT size FROM blob WHERE uuid=$uuid");
@@ -161,10 +161,14 @@
161 stbuf->st_size = db_column_int(&q, 0);
162 }
163 db_reset(&q);
164 return 0;
165 }
166 zDir = mprintf("%s/", fusefs.az[2]);
167 pFile = manifest_file_seek(fusefs.pMan, zDir, 1);
168 fossil_free(zDir);
169 if( pFile==0 ) return -ENOENT;
170 n = (int)strlen(fusefs.az[2]);
171 if( strncmp(fusefs.az[2], pFile->zName, n)!=0 ) return -ENOENT;
172 if( pFile->zName[n]!='/' ) return -ENOENT;
173 stbuf->st_mode = S_IFDIR | 0555;
174 stbuf->st_nlink = 2;
175
+15
--- src/main.c
+++ src/main.c
@@ -124,10 +124,11 @@
124124
sqlite3 *dbConfig; /* Separate connection for global_config table */
125125
int useAttach; /* True if global_config is attached to repository */
126126
const char *zConfigDbName;/* Path of the config database. NULL if not open */
127127
sqlite3_int64 now; /* Seconds since 1970 */
128128
int repositoryOpen; /* True if the main repository database is open */
129
+ char *zRepositoryOption; /* Most recent cached repository option value */
129130
char *zRepositoryName; /* Name of the repository database */
130131
const char *zMainDbType;/* "configdb", "localdb", or "repository" */
131132
const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
132133
int localOpen; /* True if the local database is open */
133134
char *zLocalRoot; /* The directory holding the local database */
@@ -796,10 +797,24 @@
796797
break;
797798
}
798799
}
799800
return zReturn;
800801
}
802
+
803
+/*
804
+** Look for a repository command-line option. If present, [re-]cache it in
805
+** the global state and return the new pointer, freeing any previous value.
806
+** If absent and there is no cached value, return NULL.
807
+*/
808
+const char *find_repository_option(){
809
+ const char *zRepository = find_option("repository", "R", 1);
810
+ if( zRepository ){
811
+ if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption);
812
+ g.zRepositoryOption = mprintf("%s", zRepository);
813
+ }
814
+ return g.zRepositoryOption;
815
+}
801816
802817
/*
803818
** Verify that there are no unprocessed command-line options. If
804819
** Any remaining command-line argument begins with "-" print
805820
** an error message and quit.
806821
--- src/main.c
+++ src/main.c
@@ -124,10 +124,11 @@
124 sqlite3 *dbConfig; /* Separate connection for global_config table */
125 int useAttach; /* True if global_config is attached to repository */
126 const char *zConfigDbName;/* Path of the config database. NULL if not open */
127 sqlite3_int64 now; /* Seconds since 1970 */
128 int repositoryOpen; /* True if the main repository database is open */
 
129 char *zRepositoryName; /* Name of the repository database */
130 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
131 const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
132 int localOpen; /* True if the local database is open */
133 char *zLocalRoot; /* The directory holding the local database */
@@ -796,10 +797,24 @@
796 break;
797 }
798 }
799 return zReturn;
800 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
801
802 /*
803 ** Verify that there are no unprocessed command-line options. If
804 ** Any remaining command-line argument begins with "-" print
805 ** an error message and quit.
806
--- src/main.c
+++ src/main.c
@@ -124,10 +124,11 @@
124 sqlite3 *dbConfig; /* Separate connection for global_config table */
125 int useAttach; /* True if global_config is attached to repository */
126 const char *zConfigDbName;/* Path of the config database. NULL if not open */
127 sqlite3_int64 now; /* Seconds since 1970 */
128 int repositoryOpen; /* True if the main repository database is open */
129 char *zRepositoryOption; /* Most recent cached repository option value */
130 char *zRepositoryName; /* Name of the repository database */
131 const char *zMainDbType;/* "configdb", "localdb", or "repository" */
132 const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
133 int localOpen; /* True if the local database is open */
134 char *zLocalRoot; /* The directory holding the local database */
@@ -796,10 +797,24 @@
797 break;
798 }
799 }
800 return zReturn;
801 }
802
803 /*
804 ** Look for a repository command-line option. If present, [re-]cache it in
805 ** the global state and return the new pointer, freeing any previous value.
806 ** If absent and there is no cached value, return NULL.
807 */
808 const char *find_repository_option(){
809 const char *zRepository = find_option("repository", "R", 1);
810 if( zRepository ){
811 if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption);
812 g.zRepositoryOption = mprintf("%s", zRepository);
813 }
814 return g.zRepositoryOption;
815 }
816
817 /*
818 ** Verify that there are no unprocessed command-line options. If
819 ** Any remaining command-line argument begins with "-" print
820 ** an error message and quit.
821
+5 -1
--- src/manifest.c
+++ src/manifest.c
@@ -1260,11 +1260,15 @@
12601260
}else{
12611261
p->iFile = i;
12621262
return &p->aFile[i];
12631263
}
12641264
}
1265
- return bBest ? &p->aFile[lwr] : 0;
1265
+ if( bBest ){
1266
+ i = (int)strlen(zName);
1267
+ if( strncmp(zName, p->aFile[lwr].zName, i)==0 ) return &p->aFile[lwr];
1268
+ }
1269
+ return 0;
12661270
}
12671271
12681272
/*
12691273
** Locate a file named zName in the aFile[] array of the given manifest.
12701274
** Return a pointer to the appropriate ManifestFile object. Return NULL
12711275
--- src/manifest.c
+++ src/manifest.c
@@ -1260,11 +1260,15 @@
1260 }else{
1261 p->iFile = i;
1262 return &p->aFile[i];
1263 }
1264 }
1265 return bBest ? &p->aFile[lwr] : 0;
 
 
 
 
1266 }
1267
1268 /*
1269 ** Locate a file named zName in the aFile[] array of the given manifest.
1270 ** Return a pointer to the appropriate ManifestFile object. Return NULL
1271
--- src/manifest.c
+++ src/manifest.c
@@ -1260,11 +1260,15 @@
1260 }else{
1261 p->iFile = i;
1262 return &p->aFile[i];
1263 }
1264 }
1265 if( bBest ){
1266 i = (int)strlen(zName);
1267 if( strncmp(zName, p->aFile[lwr].zName, i)==0 ) return &p->aFile[lwr];
1268 }
1269 return 0;
1270 }
1271
1272 /*
1273 ** Locate a file named zName in the aFile[] array of the given manifest.
1274 ** Return a pointer to the appropriate ManifestFile object. Return NULL
1275
+1 -1
--- src/winhttp.c
+++ src/winhttp.c
@@ -674,11 +674,11 @@
674674
const char *zPassword = find_option("password", "W", 1);
675675
const char *zPort = find_option("port", "P", 1);
676676
const char *zNotFound = find_option("notfound", 0, 1);
677677
const char *zFileGlob = find_option("files", 0, 1);
678678
const char *zLocalAuth = find_option("localauth", 0, 0);
679
- const char *zRepository = find_option("repository", "R", 1);
679
+ const char *zRepository = find_repository_option();
680680
int useSCGI = find_option("scgi", 0, 0)!=0;
681681
Blob binPath;
682682
683683
verify_all_options();
684684
if( g.argc==4 ){
685685
686686
ADDED test/subdir-b/readme.txt
687687
ADDED test/subdir/one/two/three/four/five/six/readme.txt
--- src/winhttp.c
+++ src/winhttp.c
@@ -674,11 +674,11 @@
674 const char *zPassword = find_option("password", "W", 1);
675 const char *zPort = find_option("port", "P", 1);
676 const char *zNotFound = find_option("notfound", 0, 1);
677 const char *zFileGlob = find_option("files", 0, 1);
678 const char *zLocalAuth = find_option("localauth", 0, 0);
679 const char *zRepository = find_option("repository", "R", 1);
680 int useSCGI = find_option("scgi", 0, 0)!=0;
681 Blob binPath;
682
683 verify_all_options();
684 if( g.argc==4 ){
685
686 DDED test/subdir-b/readme.txt
687 DDED test/subdir/one/two/three/four/five/six/readme.txt
--- src/winhttp.c
+++ src/winhttp.c
@@ -674,11 +674,11 @@
674 const char *zPassword = find_option("password", "W", 1);
675 const char *zPort = find_option("port", "P", 1);
676 const char *zNotFound = find_option("notfound", 0, 1);
677 const char *zFileGlob = find_option("files", 0, 1);
678 const char *zLocalAuth = find_option("localauth", 0, 0);
679 const char *zRepository = find_repository_option();
680 int useSCGI = find_option("scgi", 0, 0)!=0;
681 Blob binPath;
682
683 verify_all_options();
684 if( g.argc==4 ){
685
686 DDED test/subdir-b/readme.txt
687 DDED test/subdir/one/two/three/four/five/six/readme.txt
--- a/test/subdir-b/readme.txt
+++ b/test/subdir-b/readme.txt
@@ -0,0 +1,3 @@
1
+This file exists in order to create the "subdir-b" subdirectory. There is
2
+exists sibling directory "subdir" that is a prefix of this subdirectory.
3
+This file exists for self-testing.
--- a/test/subdir-b/readme.txt
+++ b/test/subdir-b/readme.txt
@@ -0,0 +1,3 @@
 
 
 
--- a/test/subdir-b/readme.txt
+++ b/test/subdir-b/readme.txt
@@ -0,0 +1,3 @@
1 This file exists in order to create the "subdir-b" subdirectory. There is
2 exists sibling directory "subdir" that is a prefix of this subdirectory.
3 This file exists for self-testing.
--- a/test/subdir/one/two/three/four/five/six/readme.txt
+++ b/test/subdir/one/two/three/four/five/six/readme.txt
@@ -0,0 +1,2 @@
1
+This file exists in order to provide Fossil with a test case of a file
2
+that is deeply nested below many subdirectories.
--- a/test/subdir/one/two/three/four/five/six/readme.txt
+++ b/test/subdir/one/two/three/four/five/six/readme.txt
@@ -0,0 +1,2 @@
 
 
--- a/test/subdir/one/two/three/four/five/six/readme.txt
+++ b/test/subdir/one/two/three/four/five/six/readme.txt
@@ -0,0 +1,2 @@
1 This file exists in order to provide Fossil with a test case of a file
2 that is deeply nested below many subdirectories.
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,9 @@
11
<title>Change Log</title>
22
33
<h2>Changes For Version 1.30 (as yet unreleased)</h2>
4
- * Add setting to control the number of autosync will be tried before
4
+ * Add setting to control the number of times autosync will be tried before
55
returning an error.
66
* Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
77
at the given DIRECTORY and populates it with read-only copies of all
88
historical check-ins. This only works on systems that support FuseFS.
99
1010
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,9 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.30 (as yet unreleased)</h2>
4 * Add setting to control the number of autosync will be tried before
5 returning an error.
6 * Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
7 at the given DIRECTORY and populates it with read-only copies of all
8 historical check-ins. This only works on systems that support FuseFS.
9
10
--- www/changes.wiki
+++ www/changes.wiki
@@ -1,9 +1,9 @@
1 <title>Change Log</title>
2
3 <h2>Changes For Version 1.30 (as yet unreleased)</h2>
4 * Add setting to control the number of times autosync will be tried before
5 returning an error.
6 * Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
7 at the given DIRECTORY and populates it with read-only copies of all
8 historical check-ins. This only works on systems that support FuseFS.
9
10

Keyboard Shortcuts

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