Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch ui-local-diff Excluding Merge-Ins
This is equivalent to a diff from 3380c7fef1 to d57463cc00
|
2024-11-13
| ||
| 07:20 | Amend the previous commit not to break (test) builds with SSL/TLS disabled. check-in: aa0b696ea3 user: florian tags: trunk | |
|
2024-11-07
| ||
| 06:50 | Merge trunk into ui-local-diff branch, resolving one merge conflict in info.c:hexdump_page(). Closed-Leaf check-in: d57463cc00 user: stephan tags: ui-local-diff | |
| 05:39 | Merge from trunk check-in: 26ea82a740 user: brickviking tags: bv-infotool | |
|
2024-11-06
| ||
| 13:29 | Merge all the latest trunk enhancements and fixes into the bv-corrections01 branch. check-in: c1aefb00c3 user: drh tags: bv-corrections01 | |
| 13:22 | Add the --no-cert-verify option to the test-httpmsg command. check-in: 3380c7fef1 user: drh tags: trunk | |
| 13:21 | Increase the version number to 2.26 in order to start the next release cycle. Update the built-in SQLite to the latest 3.48.0 pre-release for testing. Add the 2_26 tag to the change log. check-in: 66899f89c6 user: drh tags: trunk | |
|
2024-11-04
| ||
| 12:12 | Add the --no-cert-verify option to the test-httpmsg command. check-in: 5a6fd8820c user: drh tags: httpmsg-debug | |
|
2023-01-24
| ||
| 16:34 | Make all variable declarations C89 compliant. check-in: 462eb0cca0 user: drh tags: ui-local-diff | |
Changes to src/checkin.c.
| ︙ | ︙ | |||
64 65 66 67 68 69 70 | ** all unmanaged files contained underneath those directories. If there ** are no files or directories named on the command-line, then add all ** unmanaged files anywhere in the check-out. ** ** This routine never follows symlinks. It always treats symlinks as ** object unto themselves. */ | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
** all unmanaged files contained underneath those directories. If there
** are no files or directories named on the command-line, then add all
** unmanaged files anywhere in the check-out.
**
** This routine never follows symlinks. It always treats symlinks as
** object unto themselves.
*/
void locate_unmanaged_files(
int argc, /* Number of command-line arguments to examine */
char **argv, /* values of command-line arguments */
unsigned scanFlags, /* Zero or more SCAN_xxx flags */
Glob *pIgnore /* Do not add files that match this GLOB */
){
Blob name; /* Name of a candidate file or directory */
char *zName; /* Name of a candidate file or directory */
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | int nContext; /* Number of lines of context */ int wColumn; /* Column width in -y mode */ u32 nFile; /* Number of files diffed so far */ const char *zDiffCmd; /* External diff command to use instead of builtin */ const char *zBinGlob; /* GLOB pattern for binary files */ ReCompiled *pRe; /* Show only changes matching this pattern */ const char *zLeftHash; /* HASH-id of the left file */ }; #endif /* INTERFACE */ /* ** Initialize memory for a DiffConfig based on just a diffFlags integer. */ | > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | int nContext; /* Number of lines of context */ int wColumn; /* Column width in -y mode */ u32 nFile; /* Number of files diffed so far */ const char *zDiffCmd; /* External diff command to use instead of builtin */ const char *zBinGlob; /* GLOB pattern for binary files */ ReCompiled *pRe; /* Show only changes matching this pattern */ const char *zLeftHash; /* HASH-id of the left file */ const char *zLocalName; /* Filename for /localdiff case */ }; #endif /* INTERFACE */ /* ** Initialize memory for a DiffConfig based on just a diffFlags integer. */ |
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** "info" command gives command-line access to information about ** the current tree, or a particular artifact or check-in. */ #include "config.h" #include "info.h" #include <assert.h> /* ** Return a string (in memory obtained from malloc) holding a ** comma-separated list of tags that apply to check-in with ** record-id rid. If the "propagatingOnly" flag is true, then only ** show branch tags (tags that propagate to children). ** ** Return NULL if there are no such tags. | > > > > > > > > > > > > > > > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ** "info" command gives command-line access to information about ** the current tree, or a particular artifact or check-in. */ #include "config.h" #include "info.h" #include <assert.h> /*----------------------------------------------------------------------------- ** LOCAL DIFF CHANGES ** ** The goal is to show "(working) changes in the current checkout" in much the ** same way as the current "check-in" pages show the changes within a check-in. ** ** The page is on "/local" (no parameters needed; an alias of "/vinfo" and ** "/ci"), but at present there are no links to it within Fossil. Other changes: ** "/localpatch" produces a patch-set for all changes in the current checkout; ** "/localdiff" is an alias for "/fdiff" to show changes for an individual file; ** both "/file" and "/hexdump" have been extended to support local files. ** ** A number of points-of-query are labeld "TODO:LD". Most relate to these ** changes, although some are about existing code. ** ** In "checkin.c", the function "locate_unmanaged_files()" has been made ** non-static so that it can be called from here. **----------------------------------------------------------------------------- ** Options to control the "local changes" changes. At present, these are ** defines: if these changes are adopted, some may want to be made into ** configuration options. -----------------------------------------------------------------------------*/ /* ** Return a string (in memory obtained from malloc) holding a ** comma-separated list of tags that apply to check-in with ** record-id rid. If the "propagatingOnly" flag is true, then only ** show branch tags (tags that propagate to children). ** ** Return NULL if there are no such tags. |
| ︙ | ︙ | |||
320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|TIMELINE_NOSCROLL
|TIMELINE_XMERGE
|TIMELINE_CHPICK,
0, 0, 0, rid, rid2, 0);
db_finalize(&q);
}
/*
** Append the difference between artifacts to the output
*/
static void append_diff(
const char *zFrom, /* Diff from this artifact */
const char *zTo, /* ... to this artifact */
| > > > > > > > > > > > > > > > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
|TIMELINE_NOSCROLL
|TIMELINE_XMERGE
|TIMELINE_CHPICK,
0, 0, 0, rid, rid2, 0);
db_finalize(&q);
}
/*
** Read the content of file zName (prepended with the checkout directory) and
** put it into the uninitialized blob, returning 1. The blob is zeroed if the
** file does not exist or cannot be accessed, in which case it returns 0.
*/
static int content_from_file(
const char *zName, /* Filename (relative to checkout) of file to be read */
Blob *pBlob /* Pointer to blob to receive contents */
){
const char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
blob_zero(pBlob);
if( file_size(zFullPath, ExtFILE)<0 ){
return 0;
}
blob_read_from_file(pBlob, zFullPath, ExtFILE);
return 1;
}
/*
** Append the difference between artifacts to the output
*/
static void append_diff(
const char *zFrom, /* Diff from this artifact */
const char *zTo, /* ... to this artifact */
|
| ︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
}else{
blob_zero(&from);
pCfg->zLeftHash = 0;
}
if( zTo ){
toid = uuid_to_rid(zTo, 0);
content_get(toid, &to);
}else{
blob_zero(&to);
}
if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
}else{
pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
| > > | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
}else{
blob_zero(&from);
pCfg->zLeftHash = 0;
}
if( zTo ){
toid = uuid_to_rid(zTo, 0);
content_get(toid, &to);
}else if( pCfg->zLocalName ){ /* Read the file on disk */
content_from_file(pCfg->zLocalName, &to);
}else{
blob_zero(&to);
}
if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
}else{
pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
|
| ︙ | ︙ | |||
445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
@
@ %z(href("%R/fdiff?v1=%!S&v2=%!S",zOld,zNew))[diff]</a>
}
}
}
@ </p>
}
/*
** Generate javascript to enhance HTML diffs.
*/
void append_diff_javascript(int diffType){
if( diffType==0 ) return;
builtin_fossil_js_bundle_or("diff", NULL);
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
@
@ %z(href("%R/fdiff?v1=%!S&v2=%!S",zOld,zNew))[diff]</a>
}
}
}
@ </p>
}
/*
** Append notice of executable or symlink being gained or lost.
*/
static void append_status(
const char *zAction, /* Whether status was gained or lost */
const char *zStatus, /* The status that was gained/lost */
const char *zName, /* Name of file */
const char *zOld /* Existing artifact */
){
if( !g.perm.Hyperlink ){
@ %h(zName) %h(zAction) %h(zStatus) status.
}else{
@ %z(href("%R/finfo?name=%T&m=%!S",zName,zOld))%h(zName)</a>
@ from %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>
@ %h(zAction) %h(zStatus) status.
}
}
/*
** Append web-page output that shows changes between a file at last check-in
** and its current state on disk (i.e. any uncommitted changes). The status
** ("changed", "missing" etc.) is a blend of that from append_file_change_line()
** and diff_against_disk() (in "diffcmd.c").
**
** The file-differences (if being shown) use append_diff() as before, but
** there is an additional parameter (zLocal) which, if non-NULL, causes it
** to compare the checked-in version against the named file on disk.
*/
static void append_local_file_change_line(
const char *zName, /* Name of the file that has changed */
const char *zOld, /* blob.uuid before change. NULL for added files */
int isDeleted, /* Has the file-on-disk been removed from Fossil? */
int isChnged, /* Has the file changed in some way (see vfile.c) */
int isNew, /* Has the file been ADDed but not yet committed? */
int isLink, /* Is the file a symbolic link? */
DiffConfig *pCfg, /* Flags for text_diff() or NULL to omit all */
int pass /* 0x01 - Display single-line entries only */
/* 0x02 - Display entries with "diff blocks" only */
/* 0x03 - Display both */
){
/* This remembers whether a side-by-side "diff-block" was shown the last
** time through. If it was, we will add "<hr/>" to better separate the
** blocks.
*/
static int diffShownLastTime = 0;
char *zFullName = mprintf("%s%s", g.zLocalRoot, zName);
int isFilePresent = !file_access(zFullName, F_OK);
/* Determing up-front whether we would be showing a "diff-block" so we can
** filter them according to which pass we are on: the first pass will show
** only the "single-line" entries; the second will show only those with
** diff-blocks.
*/
int showDiff = ( isDeleted && isFilePresent )
|| ( !isDeleted && !isNew && ( ( isChnged == 1 )
|| ( isChnged == 2 )
|| ( isChnged == 4 )
)
);
/* We don't use 'diffFlags' in these tests so that whether "Hide diffs" is
** in effect or not, the order won't change.
*/
if( showDiff && (pass == 1) ){ return; } /* Don't do diff on pass 1 of 2 */
if( !showDiff && (pass == 2) ){ return; } /* Don't do line on pass 2 of 2 */
/* If a SBS diff-block was shown by the previous entry, add a divider */
if( diffShownLastTime && (pCfg->diffFlags & DIFF_SIDEBYSIDE) ){
@ <hr/>
}
/* Record whether we will be showing a diff-block this time. We DO factor in
** 'diffFlags' here so that in "Hide diffs" mode, we don't get extra lines.
*/
diffShownLastTime = showDiff && pCfg->diffFlags;
@ <p>
if( !g.perm.Hyperlink ){
if( isDeleted ){
if( isFilePresent ){
@ Deleted %h(zName) (still present as a local file).
}else{
@ Deleted %h(zName).
}
}else if( isNew ){
if( isFilePresent ){
@ Added %h(zName) but not committed.
}else{
@ Missing %h(zName) (was added to checkout).
}
}else switch( isChnged ){
case 3:
@ Added %h(zName) due to a merge.
break;
case 5:
@ Added %h(zName) due to an integrate-merge.
break;
case 6: append_status( "gained", "executable", zName, zOld); break;
case 7: append_status( "gained", "symlink", zName, zOld); break;
case 8: append_status( "lost", "executable", zName, zOld); break;
case 9: append_status( "lost", "symlink", zName, zOld); break;
default: /* Normal edit */
switch( isChnged ){
case 1:
@ Local changes
break;
case 2:
@ Merge
break;
case 4:
@ Integrate-merge
break;
}
@ of %h(zName).
}
if( showDiff && pCfg ){
append_diff(zOld, zName, pCfg);
}
}else{ /* With hyperlinks */
if( isDeleted ){
if( isFilePresent ){ /* DELETEd but still on disk */
@ Deleted %z(href("%R/finfo?name=%T&m=%!S",zName,zOld))%h(zName)</a>
@ from %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a> (still present
@ as %z(href("%R/file/%T?ci=ckout&annot=removed from checkout",zName))
@ [local file]</a>).
}else{ /* DELETEd and deleted from disk */
@ Deleted %z(href("%R/finfo?name=%T&m=%!S",zName,zOld))%h(zName)</a>
@ from %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>.
}
}else if( isNew ){
if( isFilePresent ){ /* ADDed and present on disk */
@ Added %z(href("%R/file/%T?ci=ckout",zName))%h(zName)</a>
@ but not committed.
}else{ /* ADDed but not present on disk */
@ Missing %h(zName) (was added to checkout).
}
}else switch( isChnged ){
case 3: /* Added by a merge */
@ Added
@ %z(href("%R/file/%T?ci=ckout&annot=added by merge",zName))%h(zName)
@ </a> to %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a> due to merge.
break;
case 5: /* Added by an integration merge */
@ Added
@ %z(href("%R/file/%T?ci=ckout&annot=added by integration-merge",zName))
@ %h(zName)</a> to
@ %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a> due to integrate merge.
break;
case 6: append_status( "gained", "executable", zName, zOld); break;
case 7: append_status( "gained", "symlink", zName, zOld); break;
case 8: append_status( "lost", "executable", zName, zOld); break;
case 9: append_status( "lost", "symlink", zName, zOld); break;
default: /* Normal edit */
switch( isChnged ){
case 1:
@ Local changes
break;
case 2:
@ Merge
break;
case 4:
@ Integrate-merge
break;
}
@ of %z(href("%R/finfo?name=%T&m=%!S",zName,zOld))%h(zName)</a>
@ from %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a> to
@ %z(href("%R/file/%T?ci=ckout&annot=edited locally",zName))
@ [local file]</a>
}
if( showDiff ){
if( pCfg ){
append_diff(zOld, zName, pCfg);
}else if( isChnged ){
@
@ %z(href("%R/localdiff?name=%T&from=%!S",zName,zOld))[diff]</a>
}
}
}
@ </p>
fossil_free(zFullName);
}
/*
** Generate javascript to enhance HTML diffs.
*/
void append_diff_javascript(int diffType){
if( diffType==0 ) return;
builtin_fossil_js_bundle_or("diff", NULL);
|
| ︙ | ︙ | |||
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
db_prepare(&q, "%s", blob_sql_text(&sql));
www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
0, 0, 0, rid, 0, 0);
db_finalize(&q);
style_finish_page();
}
/*
** WEBPAGE: vinfo
** WEBPAGE: ci
** URL: /ci/ARTIFACTID
** OR: /ci?name=ARTIFACTID
**
** Display information about a particular check-in. The exact
** same information is shown on the /info page if the name query
** parameter to /info describes a check-in.
**
** The ARTIFACTID can be a unique prefix for the HASH of the check-in,
** or a tag or branch name that identifies the check-in.
*/
void ci_page(void){
Stmt q1, q2, q3;
int rid;
int isLeaf;
int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
const char *zName; /* Name of the check-in to be displayed */
const char *zUuid; /* Hash of zName, found via blob.uuid */
const char *zParent; /* Hash of the parent check-in (if any) */
const char *zRe; /* regex parameter */
ReCompiled *pRe = 0; /* regex */
const char *zW; /* URL param for ignoring whitespace */
const char *zPage = "vinfo"; /* Page that shows diffs */
const char *zPageHide = "ci"; /* Page that hides diffs */
const char *zBrName; /* Branch name */
DiffConfig DCfg,*pCfg; /* Type of diff */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_set_current_feature("vinfo");
zName = P("name");
rid = name_to_rid_www("name");
if( rid==0 ){
style_header("Check-in Information Error");
@ No such object: %h(zName)
style_finish_page();
return;
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 |
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
db_prepare(&q, "%s", blob_sql_text(&sql));
www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
0, 0, 0, rid, 0, 0);
db_finalize(&q);
style_finish_page();
}
/*
** Options for the "extras" report in "local-diff" mode. The bit-mask versions
** are used for "&ef=.." to select which category(ies) to show.
*/
enum {
EXB_PLAIN, EXB_IGNORE, EXB_CLEAN, EXB_KEEP,
EX_PLAIN = 1 << EXB_PLAIN, /* Matches none of the others */
EX_IGNORE = 1 << EXB_IGNORE, /* Matches "ignore-glob" */
EX_CLEAN = 1 << EXB_CLEAN, /* Matches "clean-glob" */
EX_KEEP = 1 << EXB_KEEP, /* Matches "keep-glob" */
EX_ALL = EX_PLAIN /* All entries */
| EX_IGNORE
| EX_CLEAN
| EX_KEEP
};
/*
** Called while generating "/local": appends a report of any "extra" files that
** might be present in the current checkout.
**
** The format is controlled by "zExtra" (the value from the "ex=" URL option).
** This is converted to an int ("extrasFlags") and treated as a collection of
** the EX_xxx flags defined above. Thus "1" will list all "plain" files:
** unmanaged files that match none of the ignore/clean/keep blob-lists, and "2"
** would list all files matching the ignore-blob setting. "3" would list both
** those sets of files.
**
** An empty "zExtra" is a special case: it converts to zero which would normally
** select none of the EX_xxx flags above. Instead, it is converted to EX_PLAIN
** (=1) but with a (smallish) upper-limit on the number of files that will be
** listed. This is the "default" mode as it offers a combination of usefulness
** and non-intrusiveness:
** o If the glob-lists are configured well, the only files that will show are
** likely to be new source files that have not been "fossil add"ed.
** o If the glob-lists HAVEN'T been configured, only a relatively small number
** of temporary files (e.g. ".o" or ".obj") will be shown.
**
*/
static void append_extras_report(
const char *zExtra, /* Value of "ef=" from URL */
const int diffType, /* Used to preserve current */
const char *zW /* settings in URLs */
){
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
Glob *pIgnore, *pKeep, *pClean;
int nRoot;
Stmt q;
Blob repo;
int maxExtrasToShow = 5; /* Before showing "+ xx others" */
int extrasFlags = atoi(zExtra); /* Which entries to show */
int nExtras;
int nMatch;
int nShown;
int nPlain;
int nIgnore;
int nClean;
int nKeep;
zIgnoreFlag = db_get("ignore-glob", 0); /* Patterns to ignore */
zCleanFlag = db_get("clean-glob", 0); /* ...that "clean" clobbers */
zKeepFlag = db_get("keep-glob", 0); /* ...that "clean" won't touch */
pIgnore = glob_create(zIgnoreFlag); /* Object versions of above */
pKeep = glob_create(zKeepFlag);
pClean = glob_create(zCleanFlag);
nRoot = (int)strlen(g.zLocalRoot); /* Length of root component */
locate_unmanaged_files(0, NULL, 0, NULL); /* Get all unmanaged files */
/*TODO:LD
** The first two of these exclusions come from clean_cmd() in checkin.c.
** Not sure exactly what they are intended to do (seem to have no effect on
** my test repos).
*/
if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
db_multi_exec("DELETE FROM sfile WHERE pathname=%B", &repo);
}
db_multi_exec("DELETE FROM sfile WHERE pathname IN"
" (SELECT pathname FROM vfile)");
db_multi_exec("DELETE FROM sfile WHERE pathname IN (%s)",
fossil_all_reserved_names(0));
/* Handle the special case where zExtra was empty (and got converted to zero).
** If so, show "plain" files (those not matching any glob-list) but with an
** upper limit to the number shown (set above). If a value WAS given (i.e.
** after following a link), display all of the selected entries. */
if( extrasFlags==0 ){
extrasFlags = EX_PLAIN;
}else{
maxExtrasToShow = 0x7fffffff; /* Basically, all of them... */
}
/* Describe the files listed. Currently, the only "built-in" options are to
** list "plain" files (those unmanaged files not matching any glob-list),
** or to list those files matching ONE of the glob-lists. However, manual
** editing would allow selecting combinations of matching files.
**
** If only EX_PLAIN is present, then other types are explicitly excluded
** by definition: PLAIN means "not matching any glob-list". For all other
** cases, we cannot say things like "not ignored" because a file can match
** more than one list.
*/
@ <p><b>Extra Files
if( extrasFlags == EX_PLAIN ){
@ (unmanaged, not ignored, not for cleaning, not kept)
}else{
Blob desc;
blob_zero(&desc);
if( extrasFlags & EX_PLAIN ){ blob_appendf(&desc, " + unmanaged" ); }
if( extrasFlags & EX_IGNORE ){ blob_appendf(&desc, " + ignored" ); }
if( extrasFlags & EX_CLEAN ){ blob_appendf(&desc, " + to be cleaned"); }
if( extrasFlags & EX_KEEP ){ blob_appendf(&desc, " + to be kept" ); }
if( blob_size(&desc) > 3 ){ /* Should never fail... */
/* Add the string built above, skipping the leading " + " */
@ (%h(blob_str(&desc)+3))
}
blob_reset(&desc);
}
@ </b></p>
db_prepare(&q,
"SELECT %Q || pathname FROM sfile"
" ORDER BY 1", /*TODO:LD Order by pathname, as for differences? */
g.zLocalRoot
);
/*
** Put the file-list in one paragraph with line-breaks between.
*/
@ <p>
nExtras = nMatch = nShown = nPlain = nKeep = nClean = nIgnore = 0;
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
int entryFlags = 0
| ( glob_match(pIgnore, zName+nRoot) ? EX_IGNORE : 0 )
| ( glob_match(pClean, zName+nRoot) ? EX_CLEAN : 0 )
| ( glob_match(pKeep, zName+nRoot) ? EX_KEEP : 0 ) ;
if( entryFlags == 0 ){
entryFlags = EX_PLAIN;
}
if( entryFlags & EX_PLAIN ){ nPlain++; }
if( entryFlags & EX_IGNORE ){ nIgnore++; }
if( entryFlags & EX_CLEAN ){ nClean++; }
if( entryFlags & EX_KEEP ){ nKeep++; }
nExtras++;
if( entryFlags & extrasFlags ){
nMatch++ ;
if( nShown < maxExtrasToShow ){
nShown++;
if( g.perm.Hyperlink ){
@ %z(href("%R/file/%T?ci=ckout&annot=not managed",zName+nRoot))
@ %h(zName+nRoot)</a>
}else{
@ %h(zName+nRoot)
}
if( entryFlags & EX_IGNORE ){
@ (marked ignore)
}
if( entryFlags & EX_CLEAN ){
@ (marked clean)
}
if( entryFlags & EX_KEEP ){
@ (marked keep)
}
@ <br/>
}
}
}
if( nShown < nMatch ){
const int nHidden = nMatch - nShown;
@ ... plus %d(nHidden) other matching file%h(nHidden==1?"":"s")
@ (%z(href("/local?diff=%d%s&ef=%d",diffType,zW,extrasFlags))
@ show all)</a>.
}
@ </p>
@ <p>
if( nExtras==0 ){
@ No unmanaged files in checkout\
}else if( (nPlain==0) && (P("ef")==NULL) ){
@ No extra files in checkout
@ (%z(href("%R/local?diff=%d%s&ef=1",diffType,zW))show exclusions</a>)\
}else{
/* Report types and counts of extra files, with links to see all of the
** selected type. Note the extra space before "including": the output of
** append_count() ends with "\" to get the formatting correct.
*/
append_count( EX_ALL, nExtras, "extra file", 1, 0, diffType,zW );
@ including
append_count( EX_PLAIN, nPlain, "unmanaged", 0, 1, diffType,zW );
append_count( EX_IGNORE, nIgnore, "marked ignore", 0, 1, diffType,zW );
append_count( EX_CLEAN, nClean, "to be cleaned", 0, 1, diffType,zW );
append_count( EX_KEEP, nKeep, "to be kept", 0, 1, diffType,zW );
}
@ .</p><hr/>
blob_reset(&repo);
db_finalize(&q);
}
/*
** Append "26 extra files" type message as a link (assuming count is non-zero),
** with pluralisation if requested and needed. If "commaBefore" is true, the
** link is preceded by ", " if there have been earler entries with commaBefore
** set. If false, it resets the count. This allows correct construction of
** variants like:
** 27 extra files including 27 ignored.
** 30 extra files including 3 unmanaged, 27 ignored.
** The dt (diffType) and zW parameters pass on formatting selections from the
** rest of the /local page.
*/
void append_count(
int ef, /* Flags for link */
int count, /* Number of files */
const char *linkText, /* Link text after count */
int pluralise, /* Add optional "s"? */
int commaBefore, /* Precede with ", " if earlier non-zero counts */
int dt, /* DiffType */
const char *zW /* Whitespace setting ("" or "&w") */
){
static int earlierCounts = 0;
if( count == 0 ){
return;
}
if( !commaBefore ){
earlierCounts = 0 ;
}else if( earlierCounts ){
@ ,
}
@ %z(href("%R/local?diff=%d%s&ef=%d",dt,zW,ef))%d(count) %h(linkText)\
if( pluralise ){
@ %h(count==1?"":"s")\
}
@ </a>\
if( commaBefore ){
earlierCounts += count;
}
}
/*
** WEBPAGE: vinfo
** WEBPAGE: ci
** WEBPAGE: local
** URL: /ci/ARTIFACTID
** OR: /ci?name=ARTIFACTID
**
** Display information about a particular check-in. The exact
** same information is shown on the /info page if the name query
** parameter to /info describes a check-in.
**
** The ARTIFACTID can be a unique prefix for the HASH of the check-in,
** or a tag or branch name that identifies the check-in.
**
** Use of /local (or the use of "ckout" for ARTIFACTID) will show the
** same header details as /ci/tip, but then displays any (uncommitted)
** edits made to files in the checkout directory. It can also display
** any "extra" files (roughly equivalent to "fossil extras").
*/
void ci_page(void){
Stmt q1, q2, q3;
int rid;
int isLeaf;
int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
const char *zName; /* Name of the check-in to be displayed */
const char *zUuid; /* Hash of zName, found via blob.uuid */
const char *zParent; /* Hash of the parent check-in (if any) */
const char *zRe; /* regex parameter */
ReCompiled *pRe = 0; /* regex */
const char *zW; /* URL param for ignoring whitespace */
const char *zPage = "vinfo"; /* Page that shows diffs */
const char *zPageHide = "ci"; /* Page that hides diffs */
const char *zBrName; /* Branch name */
DiffConfig DCfg,*pCfg; /* Type of diff */
int bLocalMode; /* TRUE for /local; FALSE otherwise */
int vid; /* Virtual file system? */
int showExtras; /* Whether to show the extras report */
const char *zExtra; /* How to show the report */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_set_current_feature("vinfo");
zName = P("name");
/*
** "zExtra" controls if, and how, the "extras report" is displayed. It is a
** string, because when passed around in the URL (as "ef=") a value of "" has
** a different meaning to "0". A value of "" means "show a limited number of
** unmanaged files" (those that aren't ignored, marked to be cleaned, or
** marked kept)... this is what you'd most want to see if you've created a new
** source file and forgotten to "fossil add" it. A value of "0" will hide the
** extras report. Other (numeric) values control what the report shows (e.g.
** "1" would list ALL unmanaged files without limiting their number).
**
** If the "ef=" is absent then default to "" (show (some) unmanaged files).
*/
zExtra = P("ef");
if( zExtra==NULL ) {
zExtra = "";
}
showExtras = strcmp(zExtra,"0")!=0;
/* Local mode is selected by either "/local" or with a "name" of "ckout".
** First, check we have access to the checkout (and report to the user if we
** don't), then refresh the "vfile" table (recording which files in the
** checkout have changed etc.). We then change the "name" parameter to "tip"
** so that the "header" section displays info about the check-in that the
** checkout came from.
*/
bLocalMode = (g.zPath[0]=='l') || (fossil_strcmp(zName,"ckout")==0);
if( bLocalMode ){
vid = g.localOpen ? db_lget_int("checkout", 0) : 0;
if( vid==0 ){
style_header("No Local Checkout");
@ No access to local checkout.
style_finish_page();
return;
}
db_unprotect(PROTECT_NONE);
vfile_check_signature(vid, CKSIG_ENOTFILE);
db_protect_pop();
zName = "tip";
cgi_replace_parameter("name","tip"); /* Needed to get rid below */
}
rid = name_to_rid_www("name");
if( rid==0 ){
style_header("Check-in Information Error");
@ No such object: %h(zName)
style_finish_page();
return;
}
|
| ︙ | ︙ | |||
676 677 678 679 680 681 682 |
const char *zDate;
const char *zOrigDate;
int okWiki = 0;
Blob wiki_read_links = BLOB_INITIALIZER;
Blob wiki_add_links = BLOB_INITIALIZER;
Th_Store("current_checkin", zName);
| > > > | > | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 |
const char *zDate;
const char *zOrigDate;
int okWiki = 0;
Blob wiki_read_links = BLOB_INITIALIZER;
Blob wiki_add_links = BLOB_INITIALIZER;
Th_Store("current_checkin", zName);
if( bLocalMode ){
style_header("Local Changes from Check-in [%S]", zUuid);
}else{
style_header("Check-in [%S]", zUuid);
}
login_anonymous_available();
zEUser = db_text(0,
"SELECT value FROM tagxref"
" WHERE tagid=%d AND rid=%d AND tagtype>0",
TAG_USER, rid);
zEComment = db_text(0,
"SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
|
| ︙ | ︙ | |||
889 890 891 892 893 894 895 |
if( !PB("nowiki") ){
wiki_render_associated("checkin", zUuid, 0);
}
render_backlink_graph(zUuid,
"<div class=\"section accordion\">References</div>\n");
@ <div class="section accordion">Context</div><div class="accordion_panel">
render_checkin_context(rid, 0, 0, 0);
| > > > > | > > > > > > > > > | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 |
if( !PB("nowiki") ){
wiki_render_associated("checkin", zUuid, 0);
}
render_backlink_graph(zUuid,
"<div class=\"section accordion\">References</div>\n");
@ <div class="section accordion">Context</div><div class="accordion_panel">
render_checkin_context(rid, 0, 0, 0);
@ </div>
if( bLocalMode ){
@ <div class="section accordion">Uncommitted Changes</div>
}else{
@ <div class="section accordion">Changes</div>
}
@ <div class="accordion_panel">
@ <div class="sectionmenu info-changes-menu">
/* ^^^ .info-changes-menu is used by diff scroll sync */
pCfg = construct_diff_flags(diffType, &DCfg);
DCfg.pRe = pRe;
zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
/* In local mode, having displayed the header info for "tip", switch zName
** to be "ckout" so the style-altering links (unified or side-by-side etc.)
** will correctly re-select local-mode.
*/
if( bLocalMode ){
zName = "ckout";
}
if( diffType!=0 ){
@ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
@ Hide Diffs</a>
}
if( diffType!=1 ){
@ %z(chref("button","%R/%s/%T?diff=1%s",zPage,zName,zW))\
@ Unified Diffs</a>
|
| ︙ | ︙ | |||
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 |
@ %z(chref("button","%R/%s/%T",zPage,zName))
@ Show Whitespace Changes</a>
}else{
@ %z(chref("button","%R/%s/%T?w",zPage,zName))
@ Ignore Whitespace</a>
}
}
if( zParent ){
@ %z(chref("button","%R/vpatch?from=%!S&to=%!S",zParent,zUuid))
@ Patch</a>
}
if( g.perm.Admin ){
@ %z(chref("button","%R/mlink?ci=%!S",zUuid))MLink Table</a>
}
@ </div>
if( pRe ){
@ <p><b>Only differences that match regular expression "%h(zRe)"
@ are shown.</b></p>
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 |
@ %z(chref("button","%R/%s/%T",zPage,zName))
@ Show Whitespace Changes</a>
}else{
@ %z(chref("button","%R/%s/%T?w",zPage,zName))
@ Ignore Whitespace</a>
}
}
if( bLocalMode ){
@ %z(chref("button","%R/localpatch")) Patch</a>
if( showExtras ){
@ %z(chref("button","%R/local?diff=%d%s&ef=0",diffType,zW))Hide Extras</a>
}else{
@ %z(chref("button","%R/local?diff=%d%s&ef=",diffType,zW))Show Extras</a>
}
}else //TODO:LD Rejoin else-if?
if( zParent ){
@ %z(chref("button","%R/vpatch?from=%!S&to=%!S",zParent,zUuid))
@ Patch</a>
}
if( g.perm.Admin ){
@ %z(chref("button","%R/mlink?ci=%!S",zUuid))MLink Table</a>
}
@ </div>
if( pRe ){
@ <p><b>Only differences that match regular expression "%h(zRe)"
@ are shown.</b></p>
}
if( bLocalMode ){
int pass;
int anyDifferences = 0;
if( showExtras ){
append_extras_report(zExtra, diffType, zW);
}
/* Following SQL taken from diff_against_disk() in diffcmd.c */
db_begin_transaction();
db_prepare(&q3,
"SELECT pathname, deleted, chnged , rid==0, rid, islink"
" FROM vfile"
" WHERE vid=%d"
" AND (deleted OR chnged OR rid==0)"
" ORDER BY pathname /*scan*/",
vid
);
/* To prevent single-line diff-entries (those without "diff-blocks") from
** getting "lost", the first pass will only show one-line entries and the
** second pass will only show those with diff-blocks.
** TODO:LD Add this to the original (non-local) loop?
*/
for(pass=1; pass<=2; pass++) {
while( db_step(&q3)==SQLITE_ROW ){
const char *zPathname = db_column_text(&q3,0);
int isDeleted = db_column_int(&q3, 1);
int isChnged = db_column_int(&q3,2);
int isNew = db_column_int(&q3,3);
int srcid = db_column_int(&q3, 4);
int isLink = db_column_int(&q3, 5);
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", srcid);
append_local_file_change_line(zPathname, zUuid,
isDeleted, isChnged, isNew, isLink, pCfg, pass);
free(zUuid);
anyDifferences = 1;
}
db_reset(&q3);
}
if( !anyDifferences ){
@ <p>No changes in the local checkout.</p>
}
db_end_transaction(1); /* ROLLBACK to fix uncommitted xaction complaint */
/*TODO:LD: Implement the optional two-pass code? */
}else{ /* Normal, non-local-mode: show diffs against parent */
db_prepare(&q3,
"SELECT name,"
" mperm,"
" (SELECT uuid FROM blob WHERE rid=mlink.pid),"
" (SELECT uuid FROM blob WHERE rid=mlink.fid),"
" (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
" WHERE mlink.mid=%d AND NOT mlink.isaux"
" AND (mlink.fid>0"
" OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
" ORDER BY name /*sort*/",
rid, rid
);
while( db_step(&q3)==SQLITE_ROW ){
const char *zName = db_column_text(&q3,0);
int mperm = db_column_int(&q3, 1);
const char *zOld = db_column_text(&q3,2);
const char *zNew = db_column_text(&q3,3);
const char *zOldName = db_column_text(&q3, 4);
append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
pCfg,mperm);
}
}
db_finalize(&q3);
@ </div>
append_diff_javascript(diffType);
style_finish_page();
}
/*
** WEBPAGE: localpatch
** URL: /localpatch
**
** Shows a patch from the current checkout, incorporating any
** uncommitted local edits.
*/
void localpatch_page(void){
Stmt q3;
int vid;
DiffConfig DCfg;
diff_config_init(&DCfg, 0);
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
vid = g.localOpen ? db_lget_int("checkout", 0) : 0;
if( vid==0 ){
style_header("No Local Checkout");
@ No access to local checkout.
style_finish_page();
return;
}
db_unprotect(PROTECT_NONE);
vfile_check_signature(vid, CKSIG_ENOTFILE);
db_protect_pop();
diff_config_init(&DCfg, 0);
cgi_set_content_type("text/plain");
db_begin_transaction();
/*TODO:LD
** This query is the same as in ci_page() for local-mode (as well as in
** diff_against_disk() in diffcmd.c, where it was originally taken from).
** Should they be "coalesced" in some way?
*/
db_prepare(&q3,
"SELECT pathname, deleted, chnged , rid==0, rid, islink"
" FROM vfile"
" WHERE vid=%d"
" AND (deleted OR chnged OR rid==0)"
" ORDER BY pathname /*scan*/",
vid
);
while( db_step(&q3)==SQLITE_ROW ){
const char *zPathname = db_column_text(&q3,0);
int isChnged = db_column_int(&q3,2);
int srcid = db_column_int(&q3, 4);
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", srcid);
if( isChnged ){
Blob c1, c2; /* Content to diff */
Blob out; /* Diff output text */
DCfg.diffFlags = 4;
content_get(srcid, &c1);
content_from_file(zPathname, &c2);
blob_zero(&out);
text_diff(&c1, &c2, &out, &DCfg);
blob_reset(&c1);
blob_reset(&c2);
if( blob_size(&out) ){
diff_print_index(zPathname, &DCfg, 0);
diff_print_filenames(zPathname, zPathname, &DCfg, 0);
fossil_print("%s\n", blob_str(&out));
}
/* Release memory resources */
blob_reset(&out);
}
free(zUuid);
}
db_finalize(&q3);
db_end_transaction(1); /* ROLLBACK */
}
/*
** WEBPAGE: winfo
** URL: /winfo?name=HASH
**
** Display information about a wiki page.
*/
|
| ︙ | ︙ | |||
1273 1274 1275 1276 1277 1278 1279 |
if( diffType!=0 ){
style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob);
}
if( diffType!=2 ){
style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp,
&qpGlob);
}
| | | 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 |
if( diffType!=0 ){
style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob);
}
if( diffType!=2 ){
style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp,
&qpGlob);
}
if( diffType!=1 ){
style_submenu_element("Unified Diff", "%R/vdiff?diff=1&%b%b", &qp, &qpGlob);
}
if( zBranch==0 ){
style_submenu_element("Invert","%R/vdiff?diff=%d&inv&%b%b", diffType,
&qp, &qpGlob);
}
if( zGlob ){
|
| ︙ | ︙ | |||
1456 1457 1458 1459 1460 1461 1462 |
if( cnt==1 ){
@ %z(href("%R/whatis/%!S",zUuid))[more...]</a>
}
cnt++;
continue;
}
if( !sameFilename ){
| | | 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 |
if( cnt==1 ){
@ %z(href("%R/whatis/%!S",zUuid))[more...]</a>
}
cnt++;
continue;
}
if( !sameFilename ){
if( prevName && showDetail ){
@ </ul>
}
if( mPerm==PERM_LNK ){
@ <li>Symbolic link
objType |= OBJTYPE_SYMLINK;
}else if( mPerm==PERM_EXE ){
@ <li>Executable file
|
| ︙ | ︙ | |||
1577 1578 1579 1580 1581 1582 1583 |
}else if( zType[0]=='t' ){
@ Ticket change
objType |= OBJTYPE_TICKET;
}else if( zType[0]=='c' ){
@ Manifest of check-in
objType |= OBJTYPE_CHECKIN;
}else if( zType[0]=='e' ){
| | | 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 |
}else if( zType[0]=='t' ){
@ Ticket change
objType |= OBJTYPE_TICKET;
}else if( zType[0]=='c' ){
@ Manifest of check-in
objType |= OBJTYPE_CHECKIN;
}else if( zType[0]=='e' ){
if( eventTagId != 0){
@ Instance of technote
objType |= OBJTYPE_EVENT;
hyperlink_to_event_tagid(db_column_int(&q, 5));
}else{
@ Attachment to technote
}
}else if( zType[0]=='f' ){
|
| ︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( fossil_is_artifact_hash(zTarget) ){
| | | 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 |
if( cnt>0 ){
@ Also attachment "%h(zFilename)" to
}else{
@ Attachment "%h(zFilename)" to
}
objType |= OBJTYPE_ATTACHMENT;
if( fossil_is_artifact_hash(zTarget) ){
if( db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'",
zTarget)
){
if( g.perm.Hyperlink && g.anon.RdTkt ){
@ ticket [%z(href("%R/tktview?name=%!S",zTarget))%S(zTarget)</a>]
}else{
@ ticket [%S(zTarget)]
}
|
| ︙ | ︙ | |||
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
cookie_link_parameter("diff","diff", zDflt);
return atoi(PD_NoBot("diff",zDflt));
}
/*
** WEBPAGE: fdiff
** URL: fdiff?v1=HASH&v2=HASH
**
** Two arguments, v1 and v2, identify the artifacts to be diffed.
** Show diff side by side unless sbs is 0. Generate plain text if
** "patch" is present, otherwise generate "pretty" HTML.
**
** Alternative URL: fdiff?from=filename1&to=filename2&ci=checkin
**
** If the "from" and "to" query parameters are both present, then they are
** the names of two files within the check-in "ci" that are diffed. If the
** "ci" parameter is omitted, then the most recent check-in ("tip") is
** used.
**
** Additional parameters:
**
** dc=N Show N lines of context around each diff
** patch Use the patch diff format
** regex=REGEX Only show differences that match REGEX
** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on)
| > > > > > > | 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 |
cookie_link_parameter("diff","diff", zDflt);
return atoi(PD_NoBot("diff",zDflt));
}
/*
** WEBPAGE: fdiff
** WEBPAGE: localdiff
** URL: fdiff?v1=HASH&v2=HASH
** URL: localdiff?name=filename&from=HASH
**
** Two arguments, v1 and v2, identify the artifacts to be diffed.
** Show diff side by side unless sbs is 0. Generate plain text if
** "patch" is present, otherwise generate "pretty" HTML.
**
** Alternative URL: fdiff?from=filename1&to=filename2&ci=checkin
**
** If the "from" and "to" query parameters are both present, then they are
** the names of two files within the check-in "ci" that are diffed. If the
** "ci" parameter is omitted, then the most recent check-in ("tip") is
** used.
**
** The /localdiff from shows changes to the locally-checkedout copy of "name"
** compared with the artifact identified by "from" (normally the version which
** was originally checked-out).
**
** Additional parameters:
**
** dc=N Show N lines of context around each diff
** patch Use the patch diff format
** regex=REGEX Only show differences that match REGEX
** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on)
|
| ︙ | ︙ | |||
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 |
int verbose = PB("verbose");
DiffConfig DCfg;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
diff_config_init(&DCfg, 0);
diffType = preferred_diff_type();
if( P("from") && P("to") ){
v1 = artifact_from_ci_and_filename("from");
v2 = artifact_from_ci_and_filename("to");
}else{
Stmt q;
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
| > > > > > | 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 |
int verbose = PB("verbose");
DiffConfig DCfg;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
diff_config_init(&DCfg, 0);
diffType = preferred_diff_type();
if( g.zPath[0]=='l' ){ /* diff against checkout */
DCfg.zLocalName = P("name");
v1 = name_to_rid_www("from");
v2 = (DCfg.zLocalName!=NULL)?-1:0; /* -1 prevents "not found" check below */
}else
if( P("from") && P("to") ){
v1 = artifact_from_ci_and_filename("from");
v2 = artifact_from_ci_and_filename("to");
}else{
Stmt q;
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
|
| ︙ | ︙ | |||
1808 1809 1810 1811 1812 1813 1814 |
if( isPatch ){
Blob c1, c2, *pOut;
DiffConfig DCfg;
pOut = cgi_output_blob();
cgi_set_content_type("text/plain");
DCfg.diffFlags = DIFF_VERBOSE;
content_get(v1, &c1);
| > > > | > | > | > > > > > > > > | | > > > | | > > > > > | > > > > > | | > | 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 |
if( isPatch ){
Blob c1, c2, *pOut;
DiffConfig DCfg;
pOut = cgi_output_blob();
cgi_set_content_type("text/plain");
DCfg.diffFlags = DIFF_VERBOSE;
content_get(v1, &c1);
if( DCfg.zLocalName ){
content_from_file(DCfg.zLocalName, &c2);
}else{
content_get(v2, &c2);
}
DCfg.pRe = pRe;
text_diff(&c1, &c2, pOut, &DCfg);
blob_reset(&c1);
blob_reset(&c2);
return;
}
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
construct_diff_flags(diffType, &DCfg);
DCfg.diffFlags |= DIFF_HTML;
style_set_current_feature("fdiff");
style_header("Diff");
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
if( DCfg.zLocalName ){
if( diffType==2 ){
style_submenu_element("Unified Diff", "%R/localdiff?name=%T&diff=1",
DCfg.zLocalName);
}else{
style_submenu_element("Side-by-side Diff", "%R/localdiff?name=%T&diff=2",
DCfg.zLocalName);
}
}else /* Normal */
if( diffType==2 ){
style_submenu_element("Unified Diff", "%R/fdiff?v1=%T&v2=%T&diff=1",
P("v1"), P("v2"));
}else{
style_submenu_element("Side-by-side Diff", "%R/fdiff?v1=%T&v2=%T&diff=2",
P("v1"), P("v2"));
}
style_submenu_checkbox("verbose", "Verbose", 0, 0);
if( DCfg.zLocalName ){
style_submenu_element("Patch", "%R/localdiff?name=%T&patch", DCfg.zLocalName);
}else{
style_submenu_element("Patch", "%R/fdiff?v1=%T&v2=%T&patch",
P("v1"), P("v2"));
}
if( P("smhdr")!=0 ){
@ <h2>Differences From Artifact
@ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To
if( DCfg.zLocalName ){
@ %z(href("%R/local"))[Local Changes]</a> of
@ %z(href("%R/file/%T?ci=ckout",DCfg.zLocalName))%h(DCfg.zLocalName)</a>.
}else{
@ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2>
}
}else{
@ <h2>Differences From
@ Artifact %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a>:</h2>
object_description(v1, objdescFlags,0, 0);
if( DCfg.zLocalName ){
@ <h2>To %z(href("%R/local"))[Local Changes]</a>
@ of %z(href("%R/file/%T?ci=ckout",DCfg.zLocalName))%h(DCfg.zLocalName)</a>.</h2>
}else{
@ <h2>To Artifact %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>:</h2>
object_description(v2, objdescFlags,0, 0);
}
}
if( pRe ){
@ <b>Only differences that match regular expression "%h(zRe)"
@ are shown.</b>
DCfg.pRe = pRe;
}
@ <hr>
|
| ︙ | ︙ | |||
2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 |
cgi_append_content(zLine, k);
}
}
/*
** WEBPAGE: hexdump
** URL: /hexdump?name=ARTIFACTID
**
** Show the complete content of a file identified by ARTIFACTID
** as preformatted text.
**
** Other parameters:
**
** verbose Show more detail when describing the object
*/
void hexdump_page(void){
int rid;
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
| > > > > > > | | | | | | | | | | > > > > > > > | | | | | | | | | | | | | | > > > > > > > | > > | 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 |
cgi_append_content(zLine, k);
}
}
/*
** WEBPAGE: hexdump
** URL: /hexdump?name=ARTIFACTID
** URL: /hexdump?local=FILENAME
**
** Show the complete content of a file identified by ARTIFACTID
** as preformatted text.
**
** The second version does the same for FILENAME from the local checkout.
**
** Other parameters:
**
** verbose Show more detail when describing the object
*/
void hexdump_page(void){
int rid;
Blob content;
Blob downloadName;
char *zUuid;
u32 objdescFlags = 0;
const char *zLocalName = P("local");
int bLocalMode = zLocalName!=NULL;
rid = name_to_rid_www("name");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( !bLocalMode ){
if( rid==0 ) fossil_redirect_home();
cgi_check_for_malice();
if( g.perm.Admin ){
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( db_exists("SELECT 1 FROM shun WHERE uuid=%Q", zUuid) ){
style_submenu_element("Unshun", "%R/shun?accept=%s&sub=1#delshun", zUuid);
}else{
style_submenu_element("Shun", "%R/shun?shun=%s#addshun", zUuid);
}
}
}
style_header("Hex Artifact Content");
/*TODO:LD
** Could the call to style_header() be moved so these two exclusion
** blocks could be merged? I don't think any of them make sense for
** a local file.
*/
if( !bLocalMode ){
zUuid = db_text("?","SELECT uuid FROM blob WHERE rid=%d", rid);
etag_check(ETAG_HASH, zUuid);
@ <h2>Artifact
style_copy_button(1, "hash-ar", 0, 2, "%s", zUuid);
if( g.perm.Setup ){
@ (%d(rid)):</h2>
}else{
@ :</h2>
}
blob_zero(&downloadName);
if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
object_description(rid, objdescFlags, 0, &downloadName);
style_submenu_element("Download", "%R/raw/%s?at=%T",
zUuid, file_tail(blob_str(&downloadName)));
}else{
@ <h2>File %z(href("%R/finfo?name=%T&m=tip",zLocalName))%h(zLocalName)</a>
@ from %z(href("%R/local"))[Local Changes]</a></h2>
}
@ <hr>
if( bLocalMode ){
content_from_file(zLocalName, &content);
}else{
content_get(rid, &content);
}
if( !g.isHuman ){
/* Prevent robots from running hexdump on megabyte-sized source files
** and there by eating up lots of CPU time and bandwidth. There is
** no good reason for a robot to need a hexdump. */
@ <p>A hex dump of this file is not available.
@ Please download the raw binary file and generate a hex dump yourself.</p>
}else{
@ <blockquote><pre>
hexdump(&content);
/* TODO:LD: Should content (and downloadName?) be reset/freed? */
@ </pre></blockquote>
}
style_finish_page();
}
/*
** Look for "ci" and "filename" query parameters. If found, try to
|
| ︙ | ︙ | |||
2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 |
** parameter is also present, then name= must refer to a file name.
** If ci= is omitted, then the hash interpretation is preferred but
** if name= cannot be understood as a hash, a default "tip" value is
** used for ci=.
**
** For /file, name= can only be interpreted as a filename. As before,
** a default value of "tip" is used for ci= if ci= is omitted.
*/
void artifact_page(void){
int rid = 0;
Blob content;
const char *zMime;
Blob downloadName;
int renderAsWiki = 0;
| > > > | 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 |
** parameter is also present, then name= must refer to a file name.
** If ci= is omitted, then the hash interpretation is preferred but
** if name= cannot be understood as a hash, a default "tip" value is
** used for ci=.
**
** For /file, name= can only be interpreted as a filename. As before,
** a default value of "tip" is used for ci= if ci= is omitted.
**
** If ci=ckout then display the content of the file NAME in the local
** checkout directory.
*/
void artifact_page(void){
int rid = 0;
Blob content;
const char *zMime;
Blob downloadName;
int renderAsWiki = 0;
|
| ︙ | ︙ | |||
2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 |
const char *zName = P("name");
const char *zCI = P("ci");
HQuery url;
char *zCIUuid = 0;
int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */
int isBranchCI = 0; /* ci= refers to a branch name */
char *zHeader = 0;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
cgi_check_for_malice();
style_set_current_feature("artifact");
/* Capture and normalize the name= and ci= query parameters */
| > | 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 |
const char *zName = P("name");
const char *zCI = P("ci");
HQuery url;
char *zCIUuid = 0;
int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */
int isBranchCI = 0; /* ci= refers to a branch name */
char *zHeader = 0;
int bLocalMode = 0; /* TRUE if trying to show file in local checkout */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
cgi_check_for_malice();
style_set_current_feature("artifact");
/* Capture and normalize the name= and ci= query parameters */
|
| ︙ | ︙ | |||
2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 |
if( zCI==0 && !isFile ){
/* If there is no ci= query parameter, then prefer to interpret
** name= as a hash for /artifact and /whatis. But not for /file.
** For /file, a name= without a ci= will prefer to use the default
** "tip" value for ci=. */
rid = name_to_rid(zName);
}
if( rid==0 ){
rid = artifact_from_ci_and_filename(0);
}
if( rid==0 ){ /* Artifact not found */
if( isFile ){
Stmt q;
| > > > > > | 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 |
if( zCI==0 && !isFile ){
/* If there is no ci= query parameter, then prefer to interpret
** name= as a hash for /artifact and /whatis. But not for /file.
** For /file, a name= without a ci= will prefer to use the default
** "tip" value for ci=. */
rid = name_to_rid(zName);
}
if( fossil_strcmp(zCI,"ckout")==0 ){
/* "ci=ckout" is an extension for viewing files in the local checkout. */
bLocalMode = 1;
rid = -1; /* Dummy value to make it look found */
}else
if( rid==0 ){
rid = artifact_from_ci_and_filename(0);
}
if( rid==0 ){ /* Artifact not found */
if( isFile ){
Stmt q;
|
| ︙ | ︙ | |||
2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 |
objdescFlags |= OBJDESC_DETAIL;
}
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
etag_check(ETAG_HASH, zUuid);
asText = P("txt")!=0;
if( isFile ){
if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){
zCI = "tip";
@ <h2>File %z(href("%R/finfo?name=%T&m&ci=tip",zName))%h(zName)</a>
@ from the %z(href("%R/info/tip"))latest check-in</a></h2>
}else{
const char *zPath;
Blob path;
blob_zero(&path);
hyperlinked_path(zName, &path, zCI, "dir", "", LINKPATH_FINFO);
zPath = blob_str(&path);
@ <h2>File %s(zPath) artifact \
style_copy_button(1,"hash-fid",0,0,"%z%S</a> ",
href("%R/info/%s",zUuid),zUuid);
if( isBranchCI ){
@ on branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2>
}else if( isSymbolicCI ){
@ part of check-in %z(href("%R/info/%!S",zCIUuid))%s(zCI)</a></h2>
}else{
@ part of check-in %z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a></h2>
}
blob_reset(&path);
}
| > > > > > > > > > > > > > > > > > | | | | | | > > | | | | | | | | | | | | > > > | 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 |
objdescFlags |= OBJDESC_DETAIL;
}
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
etag_check(ETAG_HASH, zUuid);
asText = P("txt")!=0;
if( isFile ){
if( bLocalMode ){
/*TODO:LD
** Is this the best way of handling annotations to the description?
** If "annot=message" is part of the URL, the message is appended
** to the description of the file. Only used for "local" files to
** distinguish such files from part of the repository.
*/
const char *annot = P("annot");
@ <h2>File %z(href("%R/finfo?name=%T&m=tip",zName))%h(zName)</a>
@ from %z(href("%R/local"))[Local Changes]</a>
if( annot ){
@ (%h(annot))
}
@ </h2>
}else
if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){
zCI = "tip";
isSymbolicCI = 1; /* Mark default-to-"tip" as symbolic */
@ <h2>File %z(href("%R/finfo?name=%T&m&ci=tip",zName))%h(zName)</a>
@ from the %z(href("%R/info/tip"))latest check-in</a></h2>
}else{
const char *zPath;
Blob path;
blob_zero(&path);
hyperlinked_path(zName, &path, zCI, "dir", "", LINKPATH_FINFO);
zPath = blob_str(&path);
@ <h2>File %s(zPath) artifact \
style_copy_button(1,"hash-fid",0,0,"%z%S</a> ",
href("%R/info/%s",zUuid),zUuid);
if( isBranchCI ){
@ on branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a></h2>
}else if( isSymbolicCI ){
@ part of check-in %z(href("%R/info/%!S",zCIUuid))%s(zCI)</a></h2>
}else{
@ part of check-in %z(href("%R/info/%!S",zCIUuid))%S(zCIUuid)</a></h2>
}
blob_reset(&path);
}
if( !bLocalMode ){
style_submenu_element("Artifact", "%R/artifact/%S", zUuid);
zMime = mimetype_from_name(zName);
style_submenu_element("Annotate", "%R/annotate?filename=%T&checkin=%T",
zName, zCI);
style_submenu_element("Blame", "%R/blame?filename=%T&checkin=%T",
zName, zCI);
}
style_submenu_element("Doc", "%R/doc/%T/%T", zCI, zName);
blob_init(&downloadName, zName, -1);
objType = OBJTYPE_CONTENT;
}else{
@ <h2>Artifact
style_copy_button(1, "hash-ar", 0, 2, "%s", zUuid);
if( g.perm.Setup ){
@ (%d(rid)):</h2>
}else{
@ :</h2>
}
blob_zero(&downloadName);
if( asText ) objdescFlags &= ~OBJDESC_BASE;
objType = object_description(rid, objdescFlags,
(isFile?zName:0), &downloadName);
zMime = mimetype_from_name(blob_str(&downloadName));
}
if( !bLocalMode ){
if( !descOnly && P("download")!=0 ){
cgi_redirectf("%R/raw/%s?at=%T",
db_text("x", "SELECT uuid FROM blob WHERE rid=%d", rid),
file_tail(blob_str(&downloadName)));
/*NOTREACHED*/
}
if( g.perm.Admin ){
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( db_exists("SELECT 1 FROM shun WHERE uuid=%Q", zUuid) ){
style_submenu_element("Unshun", "%R/shun?accept=%s&sub=1#accshun", zUuid);
}else{
style_submenu_element("Shun", "%R/shun?shun=%s#addshun",zUuid);
}
}
}
if( isFile ){
if( isSymbolicCI ){
zHeader = mprintf("%s at %s", file_tail(zName), zCI);
style_set_current_page("doc/%t/%T", zCI, zName);
}else if( bLocalMode ){
zHeader = mprintf("%s (local changes)", file_tail(zName));
}else if( zCIUuid && zCIUuid[0] ){
zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid);
style_set_current_page("doc/%S/%T", zCIUuid, zName);
}else{
zHeader = mprintf("%s", file_tail(zName));
style_set_current_page("doc/tip/%T", zName);
}
|
| ︙ | ︙ | |||
2653 2654 2655 2656 2657 2658 2659 |
const char *zUser = db_column_text(&q,0);
const char *zDate = db_column_text(&q,1);
const char *zIp = db_column_text(&q,2);
@ <p>Received on %s(zDate) from %h(zUser) at %h(zIp).</p>
}
db_finalize(&q);
}
| > | | | > > > | 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 |
const char *zUser = db_column_text(&q,0);
const char *zDate = db_column_text(&q,1);
const char *zIp = db_column_text(&q,2);
@ <p>Received on %s(zDate) from %h(zUser) at %h(zIp).</p>
}
db_finalize(&q);
}
if( !bLocalMode ){
style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
style_submenu_element("Check-ins Using", "%R/timeline?uf=%s", zUuid);
}
} else {
zMime = mimetype_from_name(blob_str(&downloadName));
}
if( zMime ){
if( fossil_strcmp(zMime, "text/html")==0 ){
if( asText ){
style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsHtml = 1;
|
| ︙ | ︙ | |||
2683 2684 2685 2686 2687 2688 2689 |
if( asText ){
style_submenu_element("Svg", "%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsSvg = 1;
style_submenu_element("Text", "%s", url_render(&url, "txt", "1", 0, 0));
}
}
| > | | | | > > > > > > | > > > > | > | 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 |
if( asText ){
style_submenu_element("Svg", "%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsSvg = 1;
style_submenu_element("Text", "%s", url_render(&url, "txt", "1", 0, 0));
}
}
if( !bLocalMode ){ /* This way madness lies... */
if( fileedit_is_editable(zName) ){
style_submenu_element("Edit",
"%R/fileedit?filename=%T&checkin=%!S",
zName, zCI);
}
}
}
if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
style_submenu_element("Parsed", "%R/info/%s", zUuid);
}
if( descOnly ){
style_submenu_element("Content", "%R/artifact/%s", zUuid);
}else{
@ <hr>
if( bLocalMode ){
if( !content_from_file(zName, &content) ){
fossil_warning("Cannot find/access %s.", zName);
}
}else{
content_get(rid, &content);
}
if( renderAsWiki ){
safe_html_context(DOCSRC_FILE);
wiki_render_by_mimetype(&content, zMime);
document_emit_js();
}else if( renderAsHtml ){
@ <iframe src="%R/raw/%s(zUuid)"
@ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
@ sandbox="allow-same-origin" id="ifm1">
@ </iframe>
@ <script nonce="%h(style_nonce())">/* info.c:%d(__LINE__) */
@ document.getElementById("ifm1").addEventListener("load",
@ function(){
@ this.height=this.contentDocument.documentElement.scrollHeight + 75;
@ }
@ );
@ </script>
}else if( renderAsSvg ){
@ <object type="image/svg+xml" data="%R/raw/%s(zUuid)"></object>
}else{
const char *zContentMime;
if( bLocalMode ){
style_submenu_element("Hex", "%R/hexdump?local=%s", zName);
}else{
style_submenu_element("Hex", "%R/hexdump?name=%s", zUuid);
}
if( zLn==0 || atoi(zLn)==0 ){
style_submenu_checkbox("ln", "Line Numbers", 0, 0);
}
blob_to_utf8_no_bom(&content, 0);
zContentMime = mimetype_from_content(&content);
if( zMime==0 ) zMime = zContentMime;
@ <blockquote class="file-content">
|
| ︙ | ︙ |