Fossil SCM

Improve the label of tree-view so that it shows the number of files and the number of check-ins, if appropriate. Make tree-view the default for the "files" link of /vinfo.

drh 2014-01-01 20:25 trunk
Commit 9930c46ee5e918a96fed4d04ca32d644d409f972
2 files changed +20 -15 +1 -1
+20 -15
--- src/browse.c
+++ src/browse.c
@@ -164,11 +164,11 @@
164164
if( zD ){
165165
url_add_parameter(&sURI, "name", zD);
166166
blob_append(&dirname, "in directory ", -1);
167167
hyperlinked_path(zD, &dirname, zCI, "dir", "");
168168
zPrefix = mprintf("%s/", zD);
169
- style_submenu_element("Top", "Top", "%s",
169
+ style_submenu_element("Top-Level", "Top-Level", "%s",
170170
url_render(&sURI, "name", 0, 0, 0));
171171
}else{
172172
blob_append(&dirname, "in the top-level directory", -1);
173173
zPrefix = "";
174174
}
@@ -418,10 +418,11 @@
418418
const char *zCI = P("ci");
419419
int rid = 0;
420420
char *zUuid = 0;
421421
Blob dirname;
422422
Manifest *pM = 0;
423
+ int nFile = 0; /* Number of files */
423424
int linkTrunk = 1; /* include link to "trunk" */
424425
int linkTip = 1; /* include link to "tip" */
425426
const char *zRE; /* the value for the re=REGEXP query parameter */
426427
char *zPrefix; /* Prefix on all filenames */
427428
char *zREx = ""; /* Extra parameters for path hyperlinks */
@@ -474,41 +475,32 @@
474475
url_add_parameter(&sURI, "name", zD);
475476
blob_append(&dirname, "within directory ", -1);
476477
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
477478
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
478479
zPrefix = mprintf("%T/", zD);
479
- style_submenu_element("Top", "Top", "%s",
480
+ style_submenu_element("Top-Level", "Top-Level", "%s",
480481
url_render(&sURI, "name", 0, 0, 0));
481482
}else{
482483
if( zRE ){
483484
blob_appendf(&dirname, "matching \"%s\"", zRE);
484485
}
485486
zPrefix = "";
486487
}
488
+ if( zCI ){
489
+ style_submenu_element("All", "All", "%s",
490
+ url_render(&sURI, "ci", 0, 0, 0));
491
+ }
487492
if( linkTrunk ){
488493
style_submenu_element("Trunk", "Trunk", "%s",
489494
url_render(&sURI, "ci", "trunk", 0, 0));
490495
}
491496
if ( linkTip ){
492497
style_submenu_element("Tip", "Tip", "%s",
493498
url_render(&sURI, "ci", "tip", 0, 0));
494499
}
495
- style_submenu_element("All", "All", "%s",
496
- url_render(&sURI, "ci", 0, 0, 0));
497500
style_submenu_element("Flat-View", "Flat-View", "%s",
498501
url_render(&sURI, "type", "flat", 0, 0));
499
- if( zCI ){
500
- char zShort[20];
501
- memcpy(zShort, zUuid, 10);
502
- zShort[10] = 0;
503
- @ <h2>Files of check-in [%z(href("vinfo?name=%T",zUuid))%s(zShort)</a>]
504
- @ %s(blob_str(&dirname))</h2>
505
- }else{
506
- @ <h2>The union of all files from all check-ins
507
- @ %s(blob_str(&dirname))</h2>
508
- }
509
-
510502
/* Compute the file hierarchy.
511503
*/
512504
if( zCI ){
513505
Stmt ins, q;
514506
ManifestFile *pFile;
@@ -536,10 +528,11 @@
536528
}
537529
db_finalize(&ins);
538530
db_prepare(&q, "SELECT x, uuid FROM filelist ORDER BY x");
539531
while( db_step(&q)==SQLITE_ROW ){
540532
tree_add_node(&sTree, db_column_text(&q,0), db_column_text(&q,1));
533
+ nFile++;
541534
}
542535
db_finalize(&q);
543536
}else{
544537
Stmt q;
545538
db_prepare(&q, "SELECT name FROM filename ORDER BY name COLLATE nocase");
@@ -548,13 +541,25 @@
548541
if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
549542
continue;
550543
}
551544
if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
552545
tree_add_node(&sTree, z+nD, 0);
546
+ nFile++;
553547
}
554548
db_finalize(&q);
555549
}
550
+
551
+ if( zCI ){
552
+ @ <h2>%d(nFile) files of
553
+ @ check-in [%z(href("vinfo?name=%T",zUuid))%S(zUuid)</a>]
554
+ @ %s(blob_str(&dirname))</h2>
555
+ }else{
556
+ int n = db_int(0, "SELECT count(*) FROM plink");
557
+ @ <h2>%d(nFile) files from all %d(n) check-ins
558
+ @ %s(blob_str(&dirname))</h2>
559
+ }
560
+
556561
557562
/* Generate a multi-column table listing the contents of zD[]
558563
** directory.
559564
*/
560565
@ <pre>
561566
--- src/browse.c
+++ src/browse.c
@@ -164,11 +164,11 @@
164 if( zD ){
165 url_add_parameter(&sURI, "name", zD);
166 blob_append(&dirname, "in directory ", -1);
167 hyperlinked_path(zD, &dirname, zCI, "dir", "");
168 zPrefix = mprintf("%s/", zD);
169 style_submenu_element("Top", "Top", "%s",
170 url_render(&sURI, "name", 0, 0, 0));
171 }else{
172 blob_append(&dirname, "in the top-level directory", -1);
173 zPrefix = "";
174 }
@@ -418,10 +418,11 @@
418 const char *zCI = P("ci");
419 int rid = 0;
420 char *zUuid = 0;
421 Blob dirname;
422 Manifest *pM = 0;
 
423 int linkTrunk = 1; /* include link to "trunk" */
424 int linkTip = 1; /* include link to "tip" */
425 const char *zRE; /* the value for the re=REGEXP query parameter */
426 char *zPrefix; /* Prefix on all filenames */
427 char *zREx = ""; /* Extra parameters for path hyperlinks */
@@ -474,41 +475,32 @@
474 url_add_parameter(&sURI, "name", zD);
475 blob_append(&dirname, "within directory ", -1);
476 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
477 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
478 zPrefix = mprintf("%T/", zD);
479 style_submenu_element("Top", "Top", "%s",
480 url_render(&sURI, "name", 0, 0, 0));
481 }else{
482 if( zRE ){
483 blob_appendf(&dirname, "matching \"%s\"", zRE);
484 }
485 zPrefix = "";
486 }
 
 
 
 
487 if( linkTrunk ){
488 style_submenu_element("Trunk", "Trunk", "%s",
489 url_render(&sURI, "ci", "trunk", 0, 0));
490 }
491 if ( linkTip ){
492 style_submenu_element("Tip", "Tip", "%s",
493 url_render(&sURI, "ci", "tip", 0, 0));
494 }
495 style_submenu_element("All", "All", "%s",
496 url_render(&sURI, "ci", 0, 0, 0));
497 style_submenu_element("Flat-View", "Flat-View", "%s",
498 url_render(&sURI, "type", "flat", 0, 0));
499 if( zCI ){
500 char zShort[20];
501 memcpy(zShort, zUuid, 10);
502 zShort[10] = 0;
503 @ <h2>Files of check-in [%z(href("vinfo?name=%T",zUuid))%s(zShort)</a>]
504 @ %s(blob_str(&dirname))</h2>
505 }else{
506 @ <h2>The union of all files from all check-ins
507 @ %s(blob_str(&dirname))</h2>
508 }
509
510 /* Compute the file hierarchy.
511 */
512 if( zCI ){
513 Stmt ins, q;
514 ManifestFile *pFile;
@@ -536,10 +528,11 @@
536 }
537 db_finalize(&ins);
538 db_prepare(&q, "SELECT x, uuid FROM filelist ORDER BY x");
539 while( db_step(&q)==SQLITE_ROW ){
540 tree_add_node(&sTree, db_column_text(&q,0), db_column_text(&q,1));
 
541 }
542 db_finalize(&q);
543 }else{
544 Stmt q;
545 db_prepare(&q, "SELECT name FROM filename ORDER BY name COLLATE nocase");
@@ -548,13 +541,25 @@
548 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
549 continue;
550 }
551 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
552 tree_add_node(&sTree, z+nD, 0);
 
553 }
554 db_finalize(&q);
555 }
 
 
 
 
 
 
 
 
 
 
 
556
557 /* Generate a multi-column table listing the contents of zD[]
558 ** directory.
559 */
560 @ <pre>
561
--- src/browse.c
+++ src/browse.c
@@ -164,11 +164,11 @@
164 if( zD ){
165 url_add_parameter(&sURI, "name", zD);
166 blob_append(&dirname, "in directory ", -1);
167 hyperlinked_path(zD, &dirname, zCI, "dir", "");
168 zPrefix = mprintf("%s/", zD);
169 style_submenu_element("Top-Level", "Top-Level", "%s",
170 url_render(&sURI, "name", 0, 0, 0));
171 }else{
172 blob_append(&dirname, "in the top-level directory", -1);
173 zPrefix = "";
174 }
@@ -418,10 +418,11 @@
418 const char *zCI = P("ci");
419 int rid = 0;
420 char *zUuid = 0;
421 Blob dirname;
422 Manifest *pM = 0;
423 int nFile = 0; /* Number of files */
424 int linkTrunk = 1; /* include link to "trunk" */
425 int linkTip = 1; /* include link to "tip" */
426 const char *zRE; /* the value for the re=REGEXP query parameter */
427 char *zPrefix; /* Prefix on all filenames */
428 char *zREx = ""; /* Extra parameters for path hyperlinks */
@@ -474,41 +475,32 @@
475 url_add_parameter(&sURI, "name", zD);
476 blob_append(&dirname, "within directory ", -1);
477 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
478 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
479 zPrefix = mprintf("%T/", zD);
480 style_submenu_element("Top-Level", "Top-Level", "%s",
481 url_render(&sURI, "name", 0, 0, 0));
482 }else{
483 if( zRE ){
484 blob_appendf(&dirname, "matching \"%s\"", zRE);
485 }
486 zPrefix = "";
487 }
488 if( zCI ){
489 style_submenu_element("All", "All", "%s",
490 url_render(&sURI, "ci", 0, 0, 0));
491 }
492 if( linkTrunk ){
493 style_submenu_element("Trunk", "Trunk", "%s",
494 url_render(&sURI, "ci", "trunk", 0, 0));
495 }
496 if ( linkTip ){
497 style_submenu_element("Tip", "Tip", "%s",
498 url_render(&sURI, "ci", "tip", 0, 0));
499 }
 
 
500 style_submenu_element("Flat-View", "Flat-View", "%s",
501 url_render(&sURI, "type", "flat", 0, 0));
 
 
 
 
 
 
 
 
 
 
 
502 /* Compute the file hierarchy.
503 */
504 if( zCI ){
505 Stmt ins, q;
506 ManifestFile *pFile;
@@ -536,10 +528,11 @@
528 }
529 db_finalize(&ins);
530 db_prepare(&q, "SELECT x, uuid FROM filelist ORDER BY x");
531 while( db_step(&q)==SQLITE_ROW ){
532 tree_add_node(&sTree, db_column_text(&q,0), db_column_text(&q,1));
533 nFile++;
534 }
535 db_finalize(&q);
536 }else{
537 Stmt q;
538 db_prepare(&q, "SELECT name FROM filename ORDER BY name COLLATE nocase");
@@ -548,13 +541,25 @@
541 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
542 continue;
543 }
544 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
545 tree_add_node(&sTree, z+nD, 0);
546 nFile++;
547 }
548 db_finalize(&q);
549 }
550
551 if( zCI ){
552 @ <h2>%d(nFile) files of
553 @ check-in [%z(href("vinfo?name=%T",zUuid))%S(zUuid)</a>]
554 @ %s(blob_str(&dirname))</h2>
555 }else{
556 int n = db_int(0, "SELECT count(*) FROM plink");
557 @ <h2>%d(nFile) files from all %d(n) check-ins
558 @ %s(blob_str(&dirname))</h2>
559 }
560
561
562 /* Generate a multi-column table listing the contents of zD[]
563 ** directory.
564 */
565 @ <pre>
566
+1 -1
--- src/info.c
+++ src/info.c
@@ -629,11 +629,11 @@
629629
fossil_free(zUrl);
630630
}
631631
@ </td></tr>
632632
@ <tr><th>Other&nbsp;Links:</th>
633633
@ <td>
634
- @ %z(href("%R/dir?ci=%S",zUuid))files</a>
634
+ @ %z(href("%R/tree?ci=%S",zUuid))files</a>
635635
@ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
636636
@ | %z(href("%R/artifact/%S",zUuid))manifest</a>
637637
if( g.perm.Write ){
638638
@ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
639639
}
640640
--- src/info.c
+++ src/info.c
@@ -629,11 +629,11 @@
629 fossil_free(zUrl);
630 }
631 @ </td></tr>
632 @ <tr><th>Other&nbsp;Links:</th>
633 @ <td>
634 @ %z(href("%R/dir?ci=%S",zUuid))files</a>
635 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
636 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
637 if( g.perm.Write ){
638 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
639 }
640
--- src/info.c
+++ src/info.c
@@ -629,11 +629,11 @@
629 fossil_free(zUrl);
630 }
631 @ </td></tr>
632 @ <tr><th>Other&nbsp;Links:</th>
633 @ <td>
634 @ %z(href("%R/tree?ci=%S",zUuid))files</a>
635 @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
636 @ | %z(href("%R/artifact/%S",zUuid))manifest</a>
637 if( g.perm.Write ){
638 @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
639 }
640

Keyboard Shortcuts

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