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.
Commit
9930c46ee5e918a96fed4d04ca32d644d409f972
Parent
daff9d20621480a…
2 files changed
+20
-15
+1
-1
+20
-15
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -164,11 +164,11 @@ | ||
| 164 | 164 | if( zD ){ |
| 165 | 165 | url_add_parameter(&sURI, "name", zD); |
| 166 | 166 | blob_append(&dirname, "in directory ", -1); |
| 167 | 167 | hyperlinked_path(zD, &dirname, zCI, "dir", ""); |
| 168 | 168 | zPrefix = mprintf("%s/", zD); |
| 169 | - style_submenu_element("Top", "Top", "%s", | |
| 169 | + style_submenu_element("Top-Level", "Top-Level", "%s", | |
| 170 | 170 | url_render(&sURI, "name", 0, 0, 0)); |
| 171 | 171 | }else{ |
| 172 | 172 | blob_append(&dirname, "in the top-level directory", -1); |
| 173 | 173 | zPrefix = ""; |
| 174 | 174 | } |
| @@ -418,10 +418,11 @@ | ||
| 418 | 418 | const char *zCI = P("ci"); |
| 419 | 419 | int rid = 0; |
| 420 | 420 | char *zUuid = 0; |
| 421 | 421 | Blob dirname; |
| 422 | 422 | Manifest *pM = 0; |
| 423 | + int nFile = 0; /* Number of files */ | |
| 423 | 424 | int linkTrunk = 1; /* include link to "trunk" */ |
| 424 | 425 | int linkTip = 1; /* include link to "tip" */ |
| 425 | 426 | const char *zRE; /* the value for the re=REGEXP query parameter */ |
| 426 | 427 | char *zPrefix; /* Prefix on all filenames */ |
| 427 | 428 | char *zREx = ""; /* Extra parameters for path hyperlinks */ |
| @@ -474,41 +475,32 @@ | ||
| 474 | 475 | url_add_parameter(&sURI, "name", zD); |
| 475 | 476 | blob_append(&dirname, "within directory ", -1); |
| 476 | 477 | hyperlinked_path(zD, &dirname, zCI, "tree", zREx); |
| 477 | 478 | if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE); |
| 478 | 479 | zPrefix = mprintf("%T/", zD); |
| 479 | - style_submenu_element("Top", "Top", "%s", | |
| 480 | + style_submenu_element("Top-Level", "Top-Level", "%s", | |
| 480 | 481 | url_render(&sURI, "name", 0, 0, 0)); |
| 481 | 482 | }else{ |
| 482 | 483 | if( zRE ){ |
| 483 | 484 | blob_appendf(&dirname, "matching \"%s\"", zRE); |
| 484 | 485 | } |
| 485 | 486 | zPrefix = ""; |
| 486 | 487 | } |
| 488 | + if( zCI ){ | |
| 489 | + style_submenu_element("All", "All", "%s", | |
| 490 | + url_render(&sURI, "ci", 0, 0, 0)); | |
| 491 | + } | |
| 487 | 492 | if( linkTrunk ){ |
| 488 | 493 | style_submenu_element("Trunk", "Trunk", "%s", |
| 489 | 494 | url_render(&sURI, "ci", "trunk", 0, 0)); |
| 490 | 495 | } |
| 491 | 496 | if ( linkTip ){ |
| 492 | 497 | style_submenu_element("Tip", "Tip", "%s", |
| 493 | 498 | url_render(&sURI, "ci", "tip", 0, 0)); |
| 494 | 499 | } |
| 495 | - style_submenu_element("All", "All", "%s", | |
| 496 | - url_render(&sURI, "ci", 0, 0, 0)); | |
| 497 | 500 | style_submenu_element("Flat-View", "Flat-View", "%s", |
| 498 | 501 | 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 | 502 | /* Compute the file hierarchy. |
| 511 | 503 | */ |
| 512 | 504 | if( zCI ){ |
| 513 | 505 | Stmt ins, q; |
| 514 | 506 | ManifestFile *pFile; |
| @@ -536,10 +528,11 @@ | ||
| 536 | 528 | } |
| 537 | 529 | db_finalize(&ins); |
| 538 | 530 | db_prepare(&q, "SELECT x, uuid FROM filelist ORDER BY x"); |
| 539 | 531 | while( db_step(&q)==SQLITE_ROW ){ |
| 540 | 532 | tree_add_node(&sTree, db_column_text(&q,0), db_column_text(&q,1)); |
| 533 | + nFile++; | |
| 541 | 534 | } |
| 542 | 535 | db_finalize(&q); |
| 543 | 536 | }else{ |
| 544 | 537 | Stmt q; |
| 545 | 538 | db_prepare(&q, "SELECT name FROM filename ORDER BY name COLLATE nocase"); |
| @@ -548,13 +541,25 @@ | ||
| 548 | 541 | if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){ |
| 549 | 542 | continue; |
| 550 | 543 | } |
| 551 | 544 | if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue; |
| 552 | 545 | tree_add_node(&sTree, z+nD, 0); |
| 546 | + nFile++; | |
| 553 | 547 | } |
| 554 | 548 | db_finalize(&q); |
| 555 | 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 | + | |
| 556 | 561 | |
| 557 | 562 | /* Generate a multi-column table listing the contents of zD[] |
| 558 | 563 | ** directory. |
| 559 | 564 | */ |
| 560 | 565 | @ <pre> |
| 561 | 566 |
| --- 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 @@ | ||
| 629 | 629 | fossil_free(zUrl); |
| 630 | 630 | } |
| 631 | 631 | @ </td></tr> |
| 632 | 632 | @ <tr><th>Other Links:</th> |
| 633 | 633 | @ <td> |
| 634 | - @ %z(href("%R/dir?ci=%S",zUuid))files</a> | |
| 634 | + @ %z(href("%R/tree?ci=%S",zUuid))files</a> | |
| 635 | 635 | @ | %z(href("%R/fileage?name=%S",zUuid))file ages</a> |
| 636 | 636 | @ | %z(href("%R/artifact/%S",zUuid))manifest</a> |
| 637 | 637 | if( g.perm.Write ){ |
| 638 | 638 | @ | %z(href("%R/ci_edit?r=%S",zUuid))edit</a> |
| 639 | 639 | } |
| 640 | 640 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -629,11 +629,11 @@ | |
| 629 | fossil_free(zUrl); |
| 630 | } |
| 631 | @ </td></tr> |
| 632 | @ <tr><th>Other 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 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 |