Fossil SCM

Construct event records for tickets correctly even when the ticket change artifacts arrive out of order.

drh 2009-09-14 14:08 trunk
Commit 95f5520a09efb7698179f5123fbca8e3f33fbb39
+103 -58
--- src/manifest.c
+++ src/manifest.c
@@ -881,10 +881,109 @@
881881
}
882882
j++;
883883
}
884884
manifest_clear(&other);
885885
}
886
+
887
+/*
888
+** True if manifest_crosslink_begin() has been called but
889
+** manifest_crosslink_end() is still pending.
890
+*/
891
+static int manifest_crosslink_busy = 0;
892
+
893
+/*
894
+** Setup to do multiple manifest_crosslink() calls.
895
+** This is only required if processing ticket changes.
896
+*/
897
+void manifest_crosslink_begin(void){
898
+ assert( manifest_crosslink_busy==0 );
899
+ manifest_crosslink_busy = 1;
900
+ db_begin_transaction();
901
+ db_multi_exec("CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE)");
902
+}
903
+
904
+/*
905
+** Finish up a sequence of manifest_crosslink calls.
906
+*/
907
+void manifest_crosslink_end(void){
908
+ Stmt q;
909
+ assert( manifest_crosslink_busy==1 );
910
+ db_prepare(&q, "SELECT uuid FROM pending_tkt");
911
+ while( db_step(&q)==SQLITE_ROW ){
912
+ const char *zUuid = db_column_text(&q, 0);
913
+ ticket_rebuild_entry(zUuid);
914
+ }
915
+ db_finalize(&q);
916
+ db_end_transaction(0);
917
+ manifest_crosslink_busy = 0;
918
+}
919
+
920
+/*
921
+** Make an entry in the event table for a ticket change artifact.
922
+*/
923
+void manifest_ticket_event(
924
+ int rid, /* Artifact ID of the change ticket artifact */
925
+ const Manifest *pManifest, /* Parsed content of the artifact */
926
+ int isNew /* True if this is the first event */
927
+){
928
+ int i;
929
+ char *zTitle;
930
+ Blob comment;
931
+ char *zNewStatus = 0;
932
+ static char *zTitleExpr = 0;
933
+ static char *zStatusColumn = 0;
934
+ static int once = 1;
935
+
936
+ blob_zero(&comment);
937
+ if( once ){
938
+ once = 0;
939
+ zTitleExpr = db_get("ticket-title-expr", "title");
940
+ zStatusColumn = db_get("ticket-status-column", "status");
941
+ }
942
+ zTitle = db_text("unknown",
943
+ "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
944
+ zTitleExpr, pManifest->zTicketUuid
945
+ );
946
+ if( !isNew ){
947
+ for(i=0; i<pManifest->nField; i++){
948
+ if( strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
949
+ zNewStatus = pManifest->aField[i].zValue;
950
+ }
951
+ }
952
+ if( zNewStatus ){
953
+ blob_appendf(&comment, "%h ticket [%.10s]: <i>%h</i>",
954
+ zNewStatus, pManifest->zTicketUuid, zTitle
955
+ );
956
+ if( pManifest->nField>1 ){
957
+ blob_appendf(&comment, " plus %d other change%s",
958
+ pManifest->nField-1, pManifest->nField==2 ? "" : "s");
959
+ }
960
+ }else{
961
+ zNewStatus = db_text("unknown",
962
+ "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
963
+ zStatusColumn, pManifest->zTicketUuid
964
+ );
965
+ blob_appendf(&comment, "Ticket [%.10s] <i>%h</i> status still %h with "
966
+ "%d other change%s",
967
+ pManifest->zTicketUuid, zTitle, zNewStatus, pManifest->nField,
968
+ pManifest->nField==1 ? "" : "s"
969
+ );
970
+ free(zNewStatus);
971
+ }
972
+ }else{
973
+ blob_appendf(&comment, "New ticket [%.10s] <i>%h</i>.",
974
+ pManifest->zTicketUuid, zTitle
975
+ );
976
+ }
977
+ free(zTitle);
978
+ db_multi_exec(
979
+ "REPLACE INTO event(type,mtime,objid,user,comment)"
980
+ "VALUES('t',%.17g,%d,%Q,%Q)",
981
+ pManifest->rDate, rid, pManifest->zUser, blob_str(&comment)
982
+ );
983
+ blob_reset(&comment);
984
+}
886985
887986
/*
888987
** Scan artifact rid/pContent to see if it is a control artifact of
889988
** any key:
890989
**
@@ -1024,72 +1123,18 @@
10241123
TAG_COMMENT, rid
10251124
);
10261125
free(zComment);
10271126
}
10281127
if( m.type==CFTYPE_TICKET ){
1029
- int i;
1030
- char *zTitle;
10311128
char *zTag;
1032
- Blob comment;
1033
- char *zNewStatus = 0;
1034
- static char *zTitleExpr = 0;
1035
- static char *zStatusColumn = 0;
1036
- static int once = 1;
1037
- int isNew;
1038
-
1039
- isNew = ticket_insert(&m, 1, 1);
1129
+
1130
+ assert( manifest_crosslink_busy==1 );
10401131
zTag = mprintf("tkt-%s", m.zTicketUuid);
10411132
tag_insert(zTag, 1, 0, rid, m.rDate, rid);
10421133
free(zTag);
1043
- blob_zero(&comment);
1044
- if( once ){
1045
- once = 0;
1046
- zTitleExpr = db_get("ticket-title-expr", "title");
1047
- zStatusColumn = db_get("ticket-status-column", "status");
1048
- }
1049
- zTitle = db_text("unknown",
1050
- "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
1051
- zTitleExpr, m.zTicketUuid
1052
- );
1053
- if( !isNew ){
1054
- for(i=0; i<m.nField; i++){
1055
- if( strcmp(m.aField[i].zName, zStatusColumn)==0 ){
1056
- zNewStatus = m.aField[i].zValue;
1057
- }
1058
- }
1059
- if( zNewStatus ){
1060
- blob_appendf(&comment, "%h ticket [%.10s]: <i>%h</i>",
1061
- zNewStatus, m.zTicketUuid, zTitle
1062
- );
1063
- if( m.nField>1 ){
1064
- blob_appendf(&comment, " plus %d other change%s",
1065
- m.nField-1, m.nField==2 ? "" : "s");
1066
- }
1067
- }else{
1068
- zNewStatus = db_text("unknown",
1069
- "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
1070
- zStatusColumn, m.zTicketUuid
1071
- );
1072
- blob_appendf(&comment, "Ticket [%.10s] <i>%h</i> status still %h with "
1073
- "%d other change%s",
1074
- m.zTicketUuid, zTitle, zNewStatus, m.nField,
1075
- m.nField==1 ? "" : "s"
1076
- );
1077
- free(zNewStatus);
1078
- }
1079
- }else{
1080
- blob_appendf(&comment, "New ticket [%.10s] <i>%h</i>.",
1081
- m.zTicketUuid, zTitle
1082
- );
1083
- }
1084
- free(zTitle);
1085
- db_multi_exec(
1086
- "REPLACE INTO event(type,mtime,objid,user,comment)"
1087
- "VALUES('t',%.17g,%d,%Q,%Q)",
1088
- m.rDate, rid, m.zUser, blob_str(&comment)
1089
- );
1090
- blob_reset(&comment);
1134
+ db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
1135
+ m.zTicketUuid);
10911136
}
10921137
db_end_transaction(0);
10931138
manifest_clear(&m);
10941139
return 1;
10951140
}
10961141
--- src/manifest.c
+++ src/manifest.c
@@ -881,10 +881,109 @@
881 }
882 j++;
883 }
884 manifest_clear(&other);
885 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
887 /*
888 ** Scan artifact rid/pContent to see if it is a control artifact of
889 ** any key:
890 **
@@ -1024,72 +1123,18 @@
1024 TAG_COMMENT, rid
1025 );
1026 free(zComment);
1027 }
1028 if( m.type==CFTYPE_TICKET ){
1029 int i;
1030 char *zTitle;
1031 char *zTag;
1032 Blob comment;
1033 char *zNewStatus = 0;
1034 static char *zTitleExpr = 0;
1035 static char *zStatusColumn = 0;
1036 static int once = 1;
1037 int isNew;
1038
1039 isNew = ticket_insert(&m, 1, 1);
1040 zTag = mprintf("tkt-%s", m.zTicketUuid);
1041 tag_insert(zTag, 1, 0, rid, m.rDate, rid);
1042 free(zTag);
1043 blob_zero(&comment);
1044 if( once ){
1045 once = 0;
1046 zTitleExpr = db_get("ticket-title-expr", "title");
1047 zStatusColumn = db_get("ticket-status-column", "status");
1048 }
1049 zTitle = db_text("unknown",
1050 "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
1051 zTitleExpr, m.zTicketUuid
1052 );
1053 if( !isNew ){
1054 for(i=0; i<m.nField; i++){
1055 if( strcmp(m.aField[i].zName, zStatusColumn)==0 ){
1056 zNewStatus = m.aField[i].zValue;
1057 }
1058 }
1059 if( zNewStatus ){
1060 blob_appendf(&comment, "%h ticket [%.10s]: <i>%h</i>",
1061 zNewStatus, m.zTicketUuid, zTitle
1062 );
1063 if( m.nField>1 ){
1064 blob_appendf(&comment, " plus %d other change%s",
1065 m.nField-1, m.nField==2 ? "" : "s");
1066 }
1067 }else{
1068 zNewStatus = db_text("unknown",
1069 "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
1070 zStatusColumn, m.zTicketUuid
1071 );
1072 blob_appendf(&comment, "Ticket [%.10s] <i>%h</i> status still %h with "
1073 "%d other change%s",
1074 m.zTicketUuid, zTitle, zNewStatus, m.nField,
1075 m.nField==1 ? "" : "s"
1076 );
1077 free(zNewStatus);
1078 }
1079 }else{
1080 blob_appendf(&comment, "New ticket [%.10s] <i>%h</i>.",
1081 m.zTicketUuid, zTitle
1082 );
1083 }
1084 free(zTitle);
1085 db_multi_exec(
1086 "REPLACE INTO event(type,mtime,objid,user,comment)"
1087 "VALUES('t',%.17g,%d,%Q,%Q)",
1088 m.rDate, rid, m.zUser, blob_str(&comment)
1089 );
1090 blob_reset(&comment);
1091 }
1092 db_end_transaction(0);
1093 manifest_clear(&m);
1094 return 1;
1095 }
1096
--- src/manifest.c
+++ src/manifest.c
@@ -881,10 +881,109 @@
881 }
882 j++;
883 }
884 manifest_clear(&other);
885 }
886
887 /*
888 ** True if manifest_crosslink_begin() has been called but
889 ** manifest_crosslink_end() is still pending.
890 */
891 static int manifest_crosslink_busy = 0;
892
893 /*
894 ** Setup to do multiple manifest_crosslink() calls.
895 ** This is only required if processing ticket changes.
896 */
897 void manifest_crosslink_begin(void){
898 assert( manifest_crosslink_busy==0 );
899 manifest_crosslink_busy = 1;
900 db_begin_transaction();
901 db_multi_exec("CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE)");
902 }
903
904 /*
905 ** Finish up a sequence of manifest_crosslink calls.
906 */
907 void manifest_crosslink_end(void){
908 Stmt q;
909 assert( manifest_crosslink_busy==1 );
910 db_prepare(&q, "SELECT uuid FROM pending_tkt");
911 while( db_step(&q)==SQLITE_ROW ){
912 const char *zUuid = db_column_text(&q, 0);
913 ticket_rebuild_entry(zUuid);
914 }
915 db_finalize(&q);
916 db_end_transaction(0);
917 manifest_crosslink_busy = 0;
918 }
919
920 /*
921 ** Make an entry in the event table for a ticket change artifact.
922 */
923 void manifest_ticket_event(
924 int rid, /* Artifact ID of the change ticket artifact */
925 const Manifest *pManifest, /* Parsed content of the artifact */
926 int isNew /* True if this is the first event */
927 ){
928 int i;
929 char *zTitle;
930 Blob comment;
931 char *zNewStatus = 0;
932 static char *zTitleExpr = 0;
933 static char *zStatusColumn = 0;
934 static int once = 1;
935
936 blob_zero(&comment);
937 if( once ){
938 once = 0;
939 zTitleExpr = db_get("ticket-title-expr", "title");
940 zStatusColumn = db_get("ticket-status-column", "status");
941 }
942 zTitle = db_text("unknown",
943 "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
944 zTitleExpr, pManifest->zTicketUuid
945 );
946 if( !isNew ){
947 for(i=0; i<pManifest->nField; i++){
948 if( strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
949 zNewStatus = pManifest->aField[i].zValue;
950 }
951 }
952 if( zNewStatus ){
953 blob_appendf(&comment, "%h ticket [%.10s]: <i>%h</i>",
954 zNewStatus, pManifest->zTicketUuid, zTitle
955 );
956 if( pManifest->nField>1 ){
957 blob_appendf(&comment, " plus %d other change%s",
958 pManifest->nField-1, pManifest->nField==2 ? "" : "s");
959 }
960 }else{
961 zNewStatus = db_text("unknown",
962 "SELECT %s FROM ticket WHERE tkt_uuid='%s'",
963 zStatusColumn, pManifest->zTicketUuid
964 );
965 blob_appendf(&comment, "Ticket [%.10s] <i>%h</i> status still %h with "
966 "%d other change%s",
967 pManifest->zTicketUuid, zTitle, zNewStatus, pManifest->nField,
968 pManifest->nField==1 ? "" : "s"
969 );
970 free(zNewStatus);
971 }
972 }else{
973 blob_appendf(&comment, "New ticket [%.10s] <i>%h</i>.",
974 pManifest->zTicketUuid, zTitle
975 );
976 }
977 free(zTitle);
978 db_multi_exec(
979 "REPLACE INTO event(type,mtime,objid,user,comment)"
980 "VALUES('t',%.17g,%d,%Q,%Q)",
981 pManifest->rDate, rid, pManifest->zUser, blob_str(&comment)
982 );
983 blob_reset(&comment);
984 }
985
986 /*
987 ** Scan artifact rid/pContent to see if it is a control artifact of
988 ** any key:
989 **
@@ -1024,72 +1123,18 @@
1123 TAG_COMMENT, rid
1124 );
1125 free(zComment);
1126 }
1127 if( m.type==CFTYPE_TICKET ){
 
 
1128 char *zTag;
1129
1130 assert( manifest_crosslink_busy==1 );
 
 
 
 
 
 
1131 zTag = mprintf("tkt-%s", m.zTicketUuid);
1132 tag_insert(zTag, 1, 0, rid, m.rDate, rid);
1133 free(zTag);
1134 db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
1135 m.zTicketUuid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1136 }
1137 db_end_transaction(0);
1138 manifest_clear(&m);
1139 return 1;
1140 }
1141
--- src/rebuild.c
+++ src/rebuild.c
@@ -241,10 +241,11 @@
241241
db_prepare(&s,
242242
"SELECT rid, size FROM blob"
243243
" WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
244244
" AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)"
245245
);
246
+ manifest_crosslink_begin();
246247
while( db_step(&s)==SQLITE_ROW ){
247248
int rid = db_column_int(&s, 0);
248249
int size = db_column_int(&s, 1);
249250
if( size>=0 ){
250251
Blob content;
@@ -270,10 +271,11 @@
270271
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
271272
rebuild_step_done(rid);
272273
}
273274
}
274275
db_finalize(&s);
276
+ manifest_crosslink_end();
275277
rebuild_tag_trunk();
276278
if( ttyOutput ){
277279
printf("\n");
278280
}
279281
return errCnt;
280282
--- src/rebuild.c
+++ src/rebuild.c
@@ -241,10 +241,11 @@
241 db_prepare(&s,
242 "SELECT rid, size FROM blob"
243 " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
244 " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)"
245 );
 
246 while( db_step(&s)==SQLITE_ROW ){
247 int rid = db_column_int(&s, 0);
248 int size = db_column_int(&s, 1);
249 if( size>=0 ){
250 Blob content;
@@ -270,10 +271,11 @@
270 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
271 rebuild_step_done(rid);
272 }
273 }
274 db_finalize(&s);
 
275 rebuild_tag_trunk();
276 if( ttyOutput ){
277 printf("\n");
278 }
279 return errCnt;
280
--- src/rebuild.c
+++ src/rebuild.c
@@ -241,10 +241,11 @@
241 db_prepare(&s,
242 "SELECT rid, size FROM blob"
243 " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
244 " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)"
245 );
246 manifest_crosslink_begin();
247 while( db_step(&s)==SQLITE_ROW ){
248 int rid = db_column_int(&s, 0);
249 int size = db_column_int(&s, 1);
250 if( size>=0 ){
251 Blob content;
@@ -270,10 +271,11 @@
271 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
272 rebuild_step_done(rid);
273 }
274 }
275 db_finalize(&s);
276 manifest_crosslink_end();
277 rebuild_tag_trunk();
278 if( ttyOutput ){
279 printf("\n");
280 }
281 return errCnt;
282
+3 -2
--- src/tag.c
+++ src/tag.c
@@ -142,11 +142,11 @@
142142
}
143143
144144
/*
145145
** Insert a tag into the database.
146146
*/
147
-void tag_insert(
147
+int tag_insert(
148148
const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
149149
int tagtype, /* 0:cancel 1:singleton 2:propagated */
150150
const char *zValue, /* Value if the tag is really a property */
151151
int srcId, /* Artifact that contains this tag */
152152
double mtime, /* Timestamp. Use default if <=0.0 */
@@ -170,11 +170,11 @@
170170
db_bind_double(&s, ":mtime", mtime);
171171
rc = db_step(&s);
172172
db_finalize(&s);
173173
if( rc==SQLITE_ROW ){
174174
/* Another entry that is more recent already exists. Do nothing */
175
- return;
175
+ return tagid;
176176
}
177177
db_prepare(&s,
178178
"REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
179179
" VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
180180
tagid, tagtype, srcId, rid, zValue, rid
@@ -208,10 +208,11 @@
208208
zValue, rid);
209209
}
210210
if( tagtype==0 || tagtype==2 ){
211211
tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
212212
}
213
+ return tagid;
213214
}
214215
215216
216217
/*
217218
** COMMAND: test-tag
218219
--- src/tag.c
+++ src/tag.c
@@ -142,11 +142,11 @@
142 }
143
144 /*
145 ** Insert a tag into the database.
146 */
147 void tag_insert(
148 const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
149 int tagtype, /* 0:cancel 1:singleton 2:propagated */
150 const char *zValue, /* Value if the tag is really a property */
151 int srcId, /* Artifact that contains this tag */
152 double mtime, /* Timestamp. Use default if <=0.0 */
@@ -170,11 +170,11 @@
170 db_bind_double(&s, ":mtime", mtime);
171 rc = db_step(&s);
172 db_finalize(&s);
173 if( rc==SQLITE_ROW ){
174 /* Another entry that is more recent already exists. Do nothing */
175 return;
176 }
177 db_prepare(&s,
178 "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
179 " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
180 tagid, tagtype, srcId, rid, zValue, rid
@@ -208,10 +208,11 @@
208 zValue, rid);
209 }
210 if( tagtype==0 || tagtype==2 ){
211 tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
212 }
 
213 }
214
215
216 /*
217 ** COMMAND: test-tag
218
--- src/tag.c
+++ src/tag.c
@@ -142,11 +142,11 @@
142 }
143
144 /*
145 ** Insert a tag into the database.
146 */
147 int tag_insert(
148 const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
149 int tagtype, /* 0:cancel 1:singleton 2:propagated */
150 const char *zValue, /* Value if the tag is really a property */
151 int srcId, /* Artifact that contains this tag */
152 double mtime, /* Timestamp. Use default if <=0.0 */
@@ -170,11 +170,11 @@
170 db_bind_double(&s, ":mtime", mtime);
171 rc = db_step(&s);
172 db_finalize(&s);
173 if( rc==SQLITE_ROW ){
174 /* Another entry that is more recent already exists. Do nothing */
175 return tagid;
176 }
177 db_prepare(&s,
178 "REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
179 " VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
180 tagid, tagtype, srcId, rid, zValue, rid
@@ -208,10 +208,11 @@
208 zValue, rid);
209 }
210 if( tagtype==0 || tagtype==2 ){
211 tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
212 }
213 return tagid;
214 }
215
216
217 /*
218 ** COMMAND: test-tag
219
+6 -2
--- src/tkt.c
+++ src/tkt.c
@@ -197,11 +197,11 @@
197197
** work of trying to create it.
198198
**
199199
** Return TRUE if a new TICKET entry was created and FALSE if an
200200
** existing entry was revised.
201201
*/
202
-int ticket_insert(Manifest *p, int createFlag, int checkTime){
202
+int ticket_insert(const Manifest *p, int createFlag, int checkTime){
203203
Blob sql;
204204
Stmt q;
205205
int i;
206206
const char *zSep;
207207
int rc = 0;
@@ -264,10 +264,11 @@
264264
while( db_step(&q)==SQLITE_ROW ){
265265
int rid = db_column_int(&q, 0);
266266
content_get(rid, &content);
267267
manifest_parse(&manifest, &content);
268268
ticket_insert(&manifest, createFlag, 0);
269
+ manifest_ticket_event(rid, &manifest, createFlag);
269270
manifest_clear(&manifest);
270271
createFlag = 0;
271272
}
272273
db_finalize(&q);
273274
}
@@ -456,11 +457,13 @@
456457
}else{
457458
rid = content_put(&tktchng, 0, 0);
458459
if( rid==0 ){
459460
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
460461
}
462
+ manifest_crosslink_begin();
461463
manifest_crosslink(rid, &tktchng);
464
+ manifest_crosslink_end();
462465
}
463466
return TH_RETURN;
464467
}
465468
466469
@@ -690,11 +693,12 @@
690693
char zUuid[12];
691694
memcpy(zUuid, zChngUuid, 10);
692695
zUuid[10] = 0;
693696
@
694697
@ Ticket change
695
- @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zUuid)</a>]</a> by
698
+ @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zUuid)</a>]</a>
699
+ @ (rid %d(rid)) by
696700
hyperlink_to_user(m.zUser,zDate," on");
697701
hyperlink_to_date(zDate, ":");
698702
free(zDate);
699703
ticket_output_change_artifact(&m);
700704
}
701705
--- src/tkt.c
+++ src/tkt.c
@@ -197,11 +197,11 @@
197 ** work of trying to create it.
198 **
199 ** Return TRUE if a new TICKET entry was created and FALSE if an
200 ** existing entry was revised.
201 */
202 int ticket_insert(Manifest *p, int createFlag, int checkTime){
203 Blob sql;
204 Stmt q;
205 int i;
206 const char *zSep;
207 int rc = 0;
@@ -264,10 +264,11 @@
264 while( db_step(&q)==SQLITE_ROW ){
265 int rid = db_column_int(&q, 0);
266 content_get(rid, &content);
267 manifest_parse(&manifest, &content);
268 ticket_insert(&manifest, createFlag, 0);
 
269 manifest_clear(&manifest);
270 createFlag = 0;
271 }
272 db_finalize(&q);
273 }
@@ -456,11 +457,13 @@
456 }else{
457 rid = content_put(&tktchng, 0, 0);
458 if( rid==0 ){
459 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
460 }
 
461 manifest_crosslink(rid, &tktchng);
 
462 }
463 return TH_RETURN;
464 }
465
466
@@ -690,11 +693,12 @@
690 char zUuid[12];
691 memcpy(zUuid, zChngUuid, 10);
692 zUuid[10] = 0;
693 @
694 @ Ticket change
695 @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zUuid)</a>]</a> by
 
696 hyperlink_to_user(m.zUser,zDate," on");
697 hyperlink_to_date(zDate, ":");
698 free(zDate);
699 ticket_output_change_artifact(&m);
700 }
701
--- src/tkt.c
+++ src/tkt.c
@@ -197,11 +197,11 @@
197 ** work of trying to create it.
198 **
199 ** Return TRUE if a new TICKET entry was created and FALSE if an
200 ** existing entry was revised.
201 */
202 int ticket_insert(const Manifest *p, int createFlag, int checkTime){
203 Blob sql;
204 Stmt q;
205 int i;
206 const char *zSep;
207 int rc = 0;
@@ -264,10 +264,11 @@
264 while( db_step(&q)==SQLITE_ROW ){
265 int rid = db_column_int(&q, 0);
266 content_get(rid, &content);
267 manifest_parse(&manifest, &content);
268 ticket_insert(&manifest, createFlag, 0);
269 manifest_ticket_event(rid, &manifest, createFlag);
270 manifest_clear(&manifest);
271 createFlag = 0;
272 }
273 db_finalize(&q);
274 }
@@ -456,11 +457,13 @@
457 }else{
458 rid = content_put(&tktchng, 0, 0);
459 if( rid==0 ){
460 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
461 }
462 manifest_crosslink_begin();
463 manifest_crosslink(rid, &tktchng);
464 manifest_crosslink_end();
465 }
466 return TH_RETURN;
467 }
468
469
@@ -690,11 +693,12 @@
693 char zUuid[12];
694 memcpy(zUuid, zChngUuid, 10);
695 zUuid[10] = 0;
696 @
697 @ Ticket change
698 @ [<a href="%s(g.zTop)/artifact/%T(zChngUuid)">%s(zUuid)</a>]</a>
699 @ (rid %d(rid)) by
700 hyperlink_to_user(m.zUser,zDate," on");
701 hyperlink_to_date(zDate, ":");
702 free(zDate);
703 ticket_output_change_artifact(&m);
704 }
705
+4
--- src/xfer.c
+++ src/xfer.c
@@ -580,10 +580,11 @@
580580
581581
db_begin_transaction();
582582
db_multi_exec(
583583
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
584584
);
585
+ manifest_crosslink_begin();
585586
while( blob_line(xfer.pIn, &xfer.line) ){
586587
if( blob_buffer(&xfer.line)[0]=='#' ) continue;
587588
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
588589
589590
/* file UUID SIZE \n CONTENT
@@ -831,10 +832,11 @@
831832
send_unclustered(&xfer);
832833
}
833834
if( recvConfig ){
834835
configure_finalize_receive();
835836
}
837
+ manifest_crosslink_end();
836838
db_end_transaction(0);
837839
}
838840
839841
/*
840842
** COMMAND: test-xfer
@@ -946,10 +948,11 @@
946948
}
947949
if( pushFlag ){
948950
blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
949951
nCard++;
950952
}
953
+ manifest_crosslink_begin();
951954
printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
952955
953956
while( go ){
954957
int newPhantom = 0;
955958
char *zRandomness;
@@ -1228,7 +1231,8 @@
12281231
printf("Total network traffic: %d bytes sent, %d bytes received\n",
12291232
nSent, nRcvd);
12301233
transport_close();
12311234
socket_global_shutdown();
12321235
db_multi_exec("DROP TABLE onremote");
1236
+ manifest_crosslink_end();
12331237
db_end_transaction(0);
12341238
}
12351239
--- src/xfer.c
+++ src/xfer.c
@@ -580,10 +580,11 @@
580
581 db_begin_transaction();
582 db_multi_exec(
583 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
584 );
 
585 while( blob_line(xfer.pIn, &xfer.line) ){
586 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
587 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
588
589 /* file UUID SIZE \n CONTENT
@@ -831,10 +832,11 @@
831 send_unclustered(&xfer);
832 }
833 if( recvConfig ){
834 configure_finalize_receive();
835 }
 
836 db_end_transaction(0);
837 }
838
839 /*
840 ** COMMAND: test-xfer
@@ -946,10 +948,11 @@
946 }
947 if( pushFlag ){
948 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
949 nCard++;
950 }
 
951 printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
952
953 while( go ){
954 int newPhantom = 0;
955 char *zRandomness;
@@ -1228,7 +1231,8 @@
1228 printf("Total network traffic: %d bytes sent, %d bytes received\n",
1229 nSent, nRcvd);
1230 transport_close();
1231 socket_global_shutdown();
1232 db_multi_exec("DROP TABLE onremote");
 
1233 db_end_transaction(0);
1234 }
1235
--- src/xfer.c
+++ src/xfer.c
@@ -580,10 +580,11 @@
580
581 db_begin_transaction();
582 db_multi_exec(
583 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
584 );
585 manifest_crosslink_begin();
586 while( blob_line(xfer.pIn, &xfer.line) ){
587 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
588 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
589
590 /* file UUID SIZE \n CONTENT
@@ -831,10 +832,11 @@
832 send_unclustered(&xfer);
833 }
834 if( recvConfig ){
835 configure_finalize_receive();
836 }
837 manifest_crosslink_end();
838 db_end_transaction(0);
839 }
840
841 /*
842 ** COMMAND: test-xfer
@@ -946,10 +948,11 @@
948 }
949 if( pushFlag ){
950 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
951 nCard++;
952 }
953 manifest_crosslink_begin();
954 printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
955
956 while( go ){
957 int newPhantom = 0;
958 char *zRandomness;
@@ -1228,7 +1231,8 @@
1231 printf("Total network traffic: %d bytes sent, %d bytes received\n",
1232 nSent, nRcvd);
1233 transport_close();
1234 socket_global_shutdown();
1235 db_multi_exec("DROP TABLE onremote");
1236 manifest_crosslink_end();
1237 db_end_transaction(0);
1238 }
1239

Keyboard Shortcuts

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