Fossil SCM

The "fossil all ui" command still does not work for repos that do not end in ".fossil", but it at least does not hyperlink them any more.

drh 2017-01-06 13:09 trunk
Commit 805122df65c582a04bb880fe6131831c144da34c
1 file changed +14 -5
+14 -5
--- src/main.c
+++ src/main.c
@@ -1258,20 +1258,29 @@
12581258
n = db_int(0, "SELECT count(*) FROM sfile");
12591259
if( n>0 ){
12601260
Stmt q;
12611261
@ <h1>Available Repositories:</h1>
12621262
@ <ol>
1263
- db_prepare(&q, "SELECT pathname, substr(pathname,-7,-100000)||'/home'"
1263
+ db_prepare(&q, "SELECT pathname"
12641264
" FROM sfile ORDER BY pathname COLLATE nocase;");
12651265
while( db_step(&q)==SQLITE_ROW ){
12661266
const char *zName = db_column_text(&q, 0);
1267
- const char *zUrl = db_column_text(&q, 1);
1268
- if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
1269
- @ <li><a href="%R/%T(zUrl)" target="_blank">/%h(zName)</a></li>
1267
+ int nName = (int)strlen(zName);
1268
+ char *zUrl;
1269
+ if( nName<7 ) continue;
1270
+ zUrl = sqlite3_mprintf("%.*s", nName-7, zName);
1271
+ if( sqlite3_strglob("*.fossil", zName)!=0 ){
1272
+ /* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands
1273
+ ** do not work for repositories whose names do not end in ".fossil".
1274
+ ** So do not hyperlink those cases. */
1275
+ @ <li>%h(zName)</li>
1276
+ } else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
1277
+ @ <li><a href="%R/%T(zUrl)/home" target="_blank">/%h(zName)</a></li>
12701278
}else{
1271
- @ <li><a href="%R/%T(zUrl)" target="_blank">%h(zName)</a></li>
1279
+ @ <li><a href="%R/%T(zUrl)/home" target="_blank">%h(zName)</a></li>
12721280
}
1281
+ sqlite3_free(zUrl);
12731282
}
12741283
@ </ol>
12751284
}else{
12761285
@ <h1>No Repositories Found</h1>
12771286
}
12781287
--- src/main.c
+++ src/main.c
@@ -1258,20 +1258,29 @@
1258 n = db_int(0, "SELECT count(*) FROM sfile");
1259 if( n>0 ){
1260 Stmt q;
1261 @ <h1>Available Repositories:</h1>
1262 @ <ol>
1263 db_prepare(&q, "SELECT pathname, substr(pathname,-7,-100000)||'/home'"
1264 " FROM sfile ORDER BY pathname COLLATE nocase;");
1265 while( db_step(&q)==SQLITE_ROW ){
1266 const char *zName = db_column_text(&q, 0);
1267 const char *zUrl = db_column_text(&q, 1);
1268 if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
1269 @ <li><a href="%R/%T(zUrl)" target="_blank">/%h(zName)</a></li>
 
 
 
 
 
 
 
 
1270 }else{
1271 @ <li><a href="%R/%T(zUrl)" target="_blank">%h(zName)</a></li>
1272 }
 
1273 }
1274 @ </ol>
1275 }else{
1276 @ <h1>No Repositories Found</h1>
1277 }
1278
--- src/main.c
+++ src/main.c
@@ -1258,20 +1258,29 @@
1258 n = db_int(0, "SELECT count(*) FROM sfile");
1259 if( n>0 ){
1260 Stmt q;
1261 @ <h1>Available Repositories:</h1>
1262 @ <ol>
1263 db_prepare(&q, "SELECT pathname"
1264 " FROM sfile ORDER BY pathname COLLATE nocase;");
1265 while( db_step(&q)==SQLITE_ROW ){
1266 const char *zName = db_column_text(&q, 0);
1267 int nName = (int)strlen(zName);
1268 char *zUrl;
1269 if( nName<7 ) continue;
1270 zUrl = sqlite3_mprintf("%.*s", nName-7, zName);
1271 if( sqlite3_strglob("*.fossil", zName)!=0 ){
1272 /* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands
1273 ** do not work for repositories whose names do not end in ".fossil".
1274 ** So do not hyperlink those cases. */
1275 @ <li>%h(zName)</li>
1276 } else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){
1277 @ <li><a href="%R/%T(zUrl)/home" target="_blank">/%h(zName)</a></li>
1278 }else{
1279 @ <li><a href="%R/%T(zUrl)/home" target="_blank">%h(zName)</a></li>
1280 }
1281 sqlite3_free(zUrl);
1282 }
1283 @ </ol>
1284 }else{
1285 @ <h1>No Repositories Found</h1>
1286 }
1287

Keyboard Shortcuts

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