Fossil SCM

Further enhancements to the ticket history mechanism so that it takes into account the difference between TICKET and TICKETCHNG fields.

drh 2020-03-22 15:58 trunk
Commit fc70ec085e81b3f521d6f4193f4e5911cca695185ad05b1c66c00023ef487e10
2 files changed +1 -1 +30 -18
+1 -1
--- src/info.c
+++ src/info.c
@@ -2477,11 +2477,11 @@
24772477
@ </blockquote>
24782478
}
24792479
24802480
@ <div class="section">Changes</div>
24812481
@ <p>
2482
- ticket_output_change_artifact(pTktChng, 0);
2482
+ ticket_output_change_artifact(pTktChng, 0, 1);
24832483
manifest_destroy(pTktChng);
24842484
style_footer();
24852485
}
24862486
24872487
24882488
--- src/info.c
+++ src/info.c
@@ -2477,11 +2477,11 @@
2477 @ </blockquote>
2478 }
2479
2480 @ <div class="section">Changes</div>
2481 @ <p>
2482 ticket_output_change_artifact(pTktChng, 0);
2483 manifest_destroy(pTktChng);
2484 style_footer();
2485 }
2486
2487
2488
--- src/info.c
+++ src/info.c
@@ -2477,11 +2477,11 @@
2477 @ </blockquote>
2478 }
2479
2480 @ <div class="section">Changes</div>
2481 @ <p>
2482 ticket_output_change_artifact(pTktChng, 0, 1);
2483 manifest_destroy(pTktChng);
2484 style_footer();
2485 }
2486
2487
2488
+30 -18
--- src/tkt.c
+++ src/tkt.c
@@ -990,20 +990,19 @@
990990
" WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
991991
" AND blob.rid=attachid"
992992
" ORDER BY 1",
993993
tagid, tagid
994994
);
995
- while( db_step(&q)==SQLITE_ROW ){
995
+ for(nChng=0; db_step(&q)==SQLITE_ROW; nChng++){
996996
Manifest *pTicket;
997997
const char *zDate = db_column_text(&q, 0);
998998
int rid = db_column_int(&q, 1);
999999
const char *zChngUuid = db_column_text(&q, 2);
10001000
const char *zFile = db_column_text(&q, 4);
10011001
if( nChng==0 ){
10021002
@ <ol>
10031003
}
1004
- nChng++;
10051004
if( zFile!=0 ){
10061005
const char *zSrc = db_column_text(&q, 3);
10071006
const char *zUser = db_column_text(&q, 5);
10081007
if( zSrc==0 || zSrc[0]==0 ){
10091008
@
@@ -1033,11 +1032,11 @@
10331032
@ <blockquote><pre>
10341033
@ %h(blob_str(&c))
10351034
@ </pre></blockquote>
10361035
blob_reset(&c);
10371036
}else{
1038
- ticket_output_change_artifact(pTicket, "a");
1037
+ ticket_output_change_artifact(pTicket, "a", nChng);
10391038
}
10401039
}
10411040
manifest_destroy(pTicket);
10421041
}
10431042
}
@@ -1062,32 +1061,45 @@
10621061
10631062
/*
10641063
** The pTkt object is a ticket change artifact. Output a detailed
10651064
** description of this object.
10661065
*/
1067
-void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
1066
+void ticket_output_change_artifact(
1067
+ Manifest *pTkt, /* Parsed artifact for the ticket change */
1068
+ const char *zListType, /* Which type of list */
1069
+ int n /* Which ticket change is this */
1070
+){
10681071
int i;
1069
- int wikiFlags = WIKI_NOBADLINKS;
1070
- const char *zBlock = "<blockquote><pre class='verbatim'>";
1071
- const char *zEnd = "</pre></blockquote>";
10721072
if( zListType==0 ) zListType = "1";
1073
+ getAllTicketFields();
10731074
@ <ol type="%s(zListType)">
10741075
for(i=0; i<pTkt->nField; i++){
10751076
Blob val;
1076
- const char *z;
1077
+ const char *z, *zX;
1078
+ int id;
10771079
z = pTkt->aField[i].zName;
10781080
blob_set(&val, pTkt->aField[i].zValue);
1079
- if( z[0]=='+' ){
1080
- @ <li>Appended to %h(&z[1]):%s(zBlock)
1081
- @ %h(blob_str(&val))
1082
- @ %s(zEnd)</li>
1083
- }else if( blob_size(&val)>50 || contains_newline(&val) ){
1084
- @ <li>Change %h(z) to:%s(zBlock)
1085
- @ %h(blob_str(&val))
1086
- @ %s(zEnd)</li>
1087
- }else{
1088
- @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
1081
+ zX = z[0]=='+' ? z+1 : z;
1082
+ id = fieldId(zX);
1083
+ @ <li>\
1084
+ if( id<0 ){
1085
+ @ Untracked field %h(zX):
1086
+ }else if( aField[id].mUsed==USEDBY_TICKETCHNG ){
1087
+ @ %h(zX):
1088
+ }else if( n==0 ){
1089
+ @ %h(zX) initialized to:
1090
+ }else if( z[0]=='+' && (aField[id].mUsed&USEDBY_TICKET)!=0 ){
1091
+ @ Appended to %h(zX):
1092
+ }else{
1093
+ @ %h(zX) changed to:
1094
+ }
1095
+ if( blob_size(&val)>50 || contains_newline(&val) ){
1096
+ @ <blockquote><pre class='verbatim'>
1097
+ @ %h(blob_str(&val))
1098
+ @ </pre></blockquote></li>
1099
+ }else{
1100
+ @ "%h(blob_str(&val))"</li>
10891101
}
10901102
blob_reset(&val);
10911103
}
10921104
@ </ol>
10931105
}
10941106
--- src/tkt.c
+++ src/tkt.c
@@ -990,20 +990,19 @@
990 " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
991 " AND blob.rid=attachid"
992 " ORDER BY 1",
993 tagid, tagid
994 );
995 while( db_step(&q)==SQLITE_ROW ){
996 Manifest *pTicket;
997 const char *zDate = db_column_text(&q, 0);
998 int rid = db_column_int(&q, 1);
999 const char *zChngUuid = db_column_text(&q, 2);
1000 const char *zFile = db_column_text(&q, 4);
1001 if( nChng==0 ){
1002 @ <ol>
1003 }
1004 nChng++;
1005 if( zFile!=0 ){
1006 const char *zSrc = db_column_text(&q, 3);
1007 const char *zUser = db_column_text(&q, 5);
1008 if( zSrc==0 || zSrc[0]==0 ){
1009 @
@@ -1033,11 +1032,11 @@
1033 @ <blockquote><pre>
1034 @ %h(blob_str(&c))
1035 @ </pre></blockquote>
1036 blob_reset(&c);
1037 }else{
1038 ticket_output_change_artifact(pTicket, "a");
1039 }
1040 }
1041 manifest_destroy(pTicket);
1042 }
1043 }
@@ -1062,32 +1061,45 @@
1062
1063 /*
1064 ** The pTkt object is a ticket change artifact. Output a detailed
1065 ** description of this object.
1066 */
1067 void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
 
 
 
 
1068 int i;
1069 int wikiFlags = WIKI_NOBADLINKS;
1070 const char *zBlock = "<blockquote><pre class='verbatim'>";
1071 const char *zEnd = "</pre></blockquote>";
1072 if( zListType==0 ) zListType = "1";
 
1073 @ <ol type="%s(zListType)">
1074 for(i=0; i<pTkt->nField; i++){
1075 Blob val;
1076 const char *z;
 
1077 z = pTkt->aField[i].zName;
1078 blob_set(&val, pTkt->aField[i].zValue);
1079 if( z[0]=='+' ){
1080 @ <li>Appended to %h(&z[1]):%s(zBlock)
1081 @ %h(blob_str(&val))
1082 @ %s(zEnd)</li>
1083 }else if( blob_size(&val)>50 || contains_newline(&val) ){
1084 @ <li>Change %h(z) to:%s(zBlock)
1085 @ %h(blob_str(&val))
1086 @ %s(zEnd)</li>
1087 }else{
1088 @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
 
 
 
 
 
 
 
 
 
 
1089 }
1090 blob_reset(&val);
1091 }
1092 @ </ol>
1093 }
1094
--- src/tkt.c
+++ src/tkt.c
@@ -990,20 +990,19 @@
990 " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
991 " AND blob.rid=attachid"
992 " ORDER BY 1",
993 tagid, tagid
994 );
995 for(nChng=0; db_step(&q)==SQLITE_ROW; nChng++){
996 Manifest *pTicket;
997 const char *zDate = db_column_text(&q, 0);
998 int rid = db_column_int(&q, 1);
999 const char *zChngUuid = db_column_text(&q, 2);
1000 const char *zFile = db_column_text(&q, 4);
1001 if( nChng==0 ){
1002 @ <ol>
1003 }
 
1004 if( zFile!=0 ){
1005 const char *zSrc = db_column_text(&q, 3);
1006 const char *zUser = db_column_text(&q, 5);
1007 if( zSrc==0 || zSrc[0]==0 ){
1008 @
@@ -1033,11 +1032,11 @@
1032 @ <blockquote><pre>
1033 @ %h(blob_str(&c))
1034 @ </pre></blockquote>
1035 blob_reset(&c);
1036 }else{
1037 ticket_output_change_artifact(pTicket, "a", nChng);
1038 }
1039 }
1040 manifest_destroy(pTicket);
1041 }
1042 }
@@ -1062,32 +1061,45 @@
1061
1062 /*
1063 ** The pTkt object is a ticket change artifact. Output a detailed
1064 ** description of this object.
1065 */
1066 void ticket_output_change_artifact(
1067 Manifest *pTkt, /* Parsed artifact for the ticket change */
1068 const char *zListType, /* Which type of list */
1069 int n /* Which ticket change is this */
1070 ){
1071 int i;
 
 
 
1072 if( zListType==0 ) zListType = "1";
1073 getAllTicketFields();
1074 @ <ol type="%s(zListType)">
1075 for(i=0; i<pTkt->nField; i++){
1076 Blob val;
1077 const char *z, *zX;
1078 int id;
1079 z = pTkt->aField[i].zName;
1080 blob_set(&val, pTkt->aField[i].zValue);
1081 zX = z[0]=='+' ? z+1 : z;
1082 id = fieldId(zX);
1083 @ <li>\
1084 if( id<0 ){
1085 @ Untracked field %h(zX):
1086 }else if( aField[id].mUsed==USEDBY_TICKETCHNG ){
1087 @ %h(zX):
1088 }else if( n==0 ){
1089 @ %h(zX) initialized to:
1090 }else if( z[0]=='+' && (aField[id].mUsed&USEDBY_TICKET)!=0 ){
1091 @ Appended to %h(zX):
1092 }else{
1093 @ %h(zX) changed to:
1094 }
1095 if( blob_size(&val)>50 || contains_newline(&val) ){
1096 @ <blockquote><pre class='verbatim'>
1097 @ %h(blob_str(&val))
1098 @ </pre></blockquote></li>
1099 }else{
1100 @ "%h(blob_str(&val))"</li>
1101 }
1102 blob_reset(&val);
1103 }
1104 @ </ol>
1105 }
1106

Keyboard Shortcuts

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