Fossil SCM
Further enhancements to the ticket history mechanism so that it takes into account the difference between TICKET and TICKETCHNG fields.
Commit
fc70ec085e81b3f521d6f4193f4e5911cca695185ad05b1c66c00023ef487e10
Parent
f1e8cd6977e0de3…
2 files changed
+1
-1
+30
-18
+1
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2477,11 +2477,11 @@ | ||
| 2477 | 2477 | @ </blockquote> |
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | 2480 | @ <div class="section">Changes</div> |
| 2481 | 2481 | @ <p> |
| 2482 | - ticket_output_change_artifact(pTktChng, 0); | |
| 2482 | + ticket_output_change_artifact(pTktChng, 0, 1); | |
| 2483 | 2483 | manifest_destroy(pTktChng); |
| 2484 | 2484 | style_footer(); |
| 2485 | 2485 | } |
| 2486 | 2486 | |
| 2487 | 2487 | |
| 2488 | 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); |
| 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 @@ | ||
| 990 | 990 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 991 | 991 | " AND blob.rid=attachid" |
| 992 | 992 | " ORDER BY 1", |
| 993 | 993 | tagid, tagid |
| 994 | 994 | ); |
| 995 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 995 | + for(nChng=0; db_step(&q)==SQLITE_ROW; nChng++){ | |
| 996 | 996 | Manifest *pTicket; |
| 997 | 997 | const char *zDate = db_column_text(&q, 0); |
| 998 | 998 | int rid = db_column_int(&q, 1); |
| 999 | 999 | const char *zChngUuid = db_column_text(&q, 2); |
| 1000 | 1000 | const char *zFile = db_column_text(&q, 4); |
| 1001 | 1001 | if( nChng==0 ){ |
| 1002 | 1002 | @ <ol> |
| 1003 | 1003 | } |
| 1004 | - nChng++; | |
| 1005 | 1004 | if( zFile!=0 ){ |
| 1006 | 1005 | const char *zSrc = db_column_text(&q, 3); |
| 1007 | 1006 | const char *zUser = db_column_text(&q, 5); |
| 1008 | 1007 | if( zSrc==0 || zSrc[0]==0 ){ |
| 1009 | 1008 | @ |
| @@ -1033,11 +1032,11 @@ | ||
| 1033 | 1032 | @ <blockquote><pre> |
| 1034 | 1033 | @ %h(blob_str(&c)) |
| 1035 | 1034 | @ </pre></blockquote> |
| 1036 | 1035 | blob_reset(&c); |
| 1037 | 1036 | }else{ |
| 1038 | - ticket_output_change_artifact(pTicket, "a"); | |
| 1037 | + ticket_output_change_artifact(pTicket, "a", nChng); | |
| 1039 | 1038 | } |
| 1040 | 1039 | } |
| 1041 | 1040 | manifest_destroy(pTicket); |
| 1042 | 1041 | } |
| 1043 | 1042 | } |
| @@ -1062,32 +1061,45 @@ | ||
| 1062 | 1061 | |
| 1063 | 1062 | /* |
| 1064 | 1063 | ** The pTkt object is a ticket change artifact. Output a detailed |
| 1065 | 1064 | ** description of this object. |
| 1066 | 1065 | */ |
| 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 | +){ | |
| 1068 | 1071 | int i; |
| 1069 | - int wikiFlags = WIKI_NOBADLINKS; | |
| 1070 | - const char *zBlock = "<blockquote><pre class='verbatim'>"; | |
| 1071 | - const char *zEnd = "</pre></blockquote>"; | |
| 1072 | 1072 | if( zListType==0 ) zListType = "1"; |
| 1073 | + getAllTicketFields(); | |
| 1073 | 1074 | @ <ol type="%s(zListType)"> |
| 1074 | 1075 | for(i=0; i<pTkt->nField; i++){ |
| 1075 | 1076 | Blob val; |
| 1076 | - const char *z; | |
| 1077 | + const char *z, *zX; | |
| 1078 | + int id; | |
| 1077 | 1079 | z = pTkt->aField[i].zName; |
| 1078 | 1080 | 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> | |
| 1089 | 1101 | } |
| 1090 | 1102 | blob_reset(&val); |
| 1091 | 1103 | } |
| 1092 | 1104 | @ </ol> |
| 1093 | 1105 | } |
| 1094 | 1106 |
| --- 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 |